HTML-----transform简单小游戏

学校刚学的,简单搞个乐子

---------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style type="text/css">
            *{
                background-color: black;
            }
            #door{
                position: absolute;
                top: 15%;
                left: 40%;
                /* border: solid black 3px; */
                width: 100.1px;
                height: 150.1px;
                transition: all 2s;
                visibility: inherit;
            }
            #door:hover{
                transform: rotateY(85deg);
                transform-origin: 0 center 0;
            }
            #door img{
                transition: all 1s;
            }
            #face{
                position: absolute;
                top: 15%;
                left: 40%;
                /* border: solid black 3px; */
                width: 100.1px;
                height: 150.1px;
                transition: all 2s;
                visibility: hidden;
                z-index: -1000;
                animation-timing-function: linear;
            }
            #face img{
                transition: all 1s;
            }
        </style>
    </head>
    <body>
        <div id="door">
            <img id="men" src="1/11/12/13/14/15/door.png" width="100px" height="150px" >
        </div>
        
        <div id="face">
        <img id="lian" src="2/21/22/23/24/25/face.png" width="100px" height="100px" >    
        </div>    
        
            <audio id="music" src="scram.mp3" loop="loop" autoplay="autoplay" >
            </audio>
        
        <script type="text/javascript">
            var a=document.getElementById("men");
            var b=document.getElementById("lian");
            var c=document.getElementById("face");
            var d=document.getElementById("music")
            a.οnclick=function(){
                a.style.width='300px';
                a.style.height="350px";
                    a.οnclick=function(){
                        a.style.width='450px';
                        a.style.height="500px";
                        a.οnclick=function(){
                            c.style.zIndex="100";
                            c.style.visibility="inherit";
                            d.play();
                            b.style.width="700px";
                            b.style.height="700px";
                            
                        }
                            
                }
            }
        </script>        
    </body>
</html>

路径是我担心同学看到图片会猜到哈哈,不禁止套娃

door.png,face.png,scram.mp3可随意发挥

希望同学们一起好好学习,体验代码的乐趣!

---------------------------------------------------------------------------------------------------------------------------

效果

transform

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值