JS简易弹球

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .ba1{
            margin:100px auto;
            width: 100px;
            height: 300px;
            /*border:1px solid red;*/
            position: relative;
        }
        .ba2{
            width: 100px;
            height: 100px;
            border-radius:50%;
            border:1px solid black;
            position: absolute;
            background-color: red;
            animation:move 2s infinite linear;
        }
        @keyframes move{
        
            0%{
                top:0;
                animation-timing-function: ease-in;
            }
            50%{
                height: 100px;
                top:140px;
                animation-timing-function: ease-out;
            }
            55%{
                top:160px;
                height: 80px;
                border-radius: 50px/40px;       
                animation-timing-function: ease-in;
            }
            65%{
                top:120px;
                height: 100px;
                border-radius: 50px;
                animation-timing-function: ease-out;

            }
            100%{
                top:0;
            }
        }
    </style>
</head>
<body>
    <div class="ba1">
        <div class="ba2"></div>
    </div>
</body>
</html>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容