2D-animation 动画实现

animation

animation:动画名 运动时间 持续次数 运动曲线 延迟 ;
a

animation-timing-function
配置动画的时间;也就是说,通过建立加速曲线,动画如何在关键帧之间过渡。

animation-delay
配置元素加载时间与动画序列开始之间的延迟。

animation-play-state
使您可以暂停和恢复动画序列。
盒子运行一周案例代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./base.css">
    <style>
       .w{
           width: 200px;
           height: 200px;
           background: red;
           animation: dh 5s infinite;
           margin: 0 auto;
       }
       @keyframes dh{
           0%{
               transform: translate(0,0);
           }
           25%{
            transform: translate(100px ,0);
               
           }
           50%{
            transform: translate(100px ,200px);
            

           }
           75%{
            transform: translate(0 ,200px);
           }
           100%{
            transform: translate( 0 ,0);

           }
       }
      
       
        

    </style>
</head>
<body>
    <div class="w">
        
    </div>
</body>
</html>

热点代码

在这里插入代码片
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./base.css">
    <style>
        .w {
            width: 800px;
            height: 500px;
            margin: 0 auto;
            background: #666;
        }

        .w ul {
            width: 300px;
            height: 200px;
            position: relative;
            top: 200px;
            left: 50%;
            transform: translate(-50% ,0);

        }

        .w ul li {
            width: 16px;
            height: 16px;
            position: absolute;
            background-color: red;
            border-radius: 50%;
            box-shadow: yellow 0 0 10px 0;

        }

        .w ul li:first-child {
            z-index: 999;
            width: 10px;
            height: 10px;
            top: 4px;
            left: 4px;
        }
        .w ul li:nth-child(n+2){
            background: #666;
            border: 1px solid yellow;
            animation: rd .6s infinite;
        }
        .w ul li:nth-child(2){
            animation-delay: .1s;
        }
        .w ul li:nth-child(2){
            animation-delay: .2s;
        }
        .w ul li:nth-child(2){
            animation-delay: .3s;
        }
        @keyframes rd{
            0%{
                transform: scale(1);
                opacity: 0.8;

            }
            25%{
                transform: scale(1.5);
                opacity: 0.8;

            }
            50%{
                transform: scale(2);
                opacity: 0.6;

            }
            75%{
                transform: scale(2.5);
                opacity: 0.2;

            }
            100%{
                transform: scale(3);
                opacity: 0;

            }
        }
    </style>
    
</head>

<body>
    <div class="w ">
        <ul>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>

    </div>
</body>

</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值