CSS3:动画animation

基本使用方法:

先在style定义动画的名字及序列

        @keyframes move {
            0%{
                transform: translate(0 0);
            }

            25%{
                transform: translate(1000px,0);
            }

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

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

再在css中调用,一般来说最少需要两个语句:

一个是对应的动画名字,一个是持续时间:

        div{
            height: 100px;
            width: 100px;
            background-color: pink;
            animation-name: move;
            animation-duration: 3s;
        }

常见属性:

 

简写:

 案例,波纹效果:

    <style>

       


        .city{
            position: relative;
            width: 200px;
            height: 200px;

            margin: 100px auto;
        }
        .dotted{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: blue;
        }
        .city div[class^="pulse"]{
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
            width: 20px;
            height: 20px;
            box-shadow: 0 0 12px blue;
            border-radius: 50%;
            animation: move 1.2s linear infinite;
        }

        @keyframes move {
            0%{}
            70%{
                width: 60px;
                height: 60px;

                opacity: 1;
            }
            100%{
                width: 90px;
                height: 90px;
                opacity: 0;

            }
        }

        .city .pulse2 {
            animation-delay: 0.4s!important;
        }

        .city .pulse3{
            animation-delay: 0.8s!important;
        }




    </style>
</head>
<body>
    <div class="city">
        <div class="dotted"></div>
        <div class="pulse1"></div>
        <div class="pulse2"></div>
        <div class="pulse3"></div>

    </div>

    
</body>

 

animation-timing-function:取值: 

steps()指的是几步完成动画 ,写了就不用写linear或者ease了

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值