html动画的变化

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <title>动画</title>

    <!--

        一个样式至另一个样式的过程

        @keyframes

     -->

     <style>

        .a{

            width: 200px;

            height: 200px;

            border: 2px solid black;

            /* 综合写法 */

            animation: myframe 2s infinite linear alternate;

            /* animation-name: myframe; */

            /* animation-duration: 2s; */

            /* animation-timing-function: linear; */

             /*播放次数  */

             /* animation-iteration-count: infinite; */

             /* 正向及逆向 */

             /* animation-duration:altrenate; */

           

        }

        .b{

            animation: myframe1 2s infinite linear alternate;

            width: 200px;

            height: 200px;

            border: 2px solid black;

        }

        .c{

            animation: myframe2 2s infinite linear alternate;

            width: 200px;

            height: 200px;

            border: 2px solid black;

        }

        .d{

            animation: myframe3 2s infinite linear alternate;

            width: 200px;

            height: 200px;

            border: 2px solid black;

        }

        /* 创建动画 */

        @keyframes myframe {

            from{

                background-color: aquamarine;

                transform: translate(200px,200px) rotate(360deg);

                width: 0px;

                height: 0px;

            }

            to{

                background-color: red;

                width: 100px;

                height: 100px;

            }

            0%{

                background-color: brown;

            }

            20%{

                background-color: rgb(42, 63, 165);

            }

            40%{

                background-color: brown;

            }

            60%{

                background-color: rgb(72, 11, 11);

            }

            80%{

                background-color: rgb(118, 165, 42);

            }

            100%{

                background-color: rgba(42, 165, 138, 0.255);

            }

        }

        @keyframes myframe1 {

            from{

                background-color: aquamarine;

                transform: scale(0.5) skew(360deg,40deg);

                width: 0px;

                height: 0px;

            }

            to{

                background-color: red;

                width: 100px;

                height: 100px;

            }

            0%{

                background-color: brown;

            }

            20%{

                background-color: rgb(42, 63, 165);

            }

            40%{

                background-color: brown;

            }

            60%{

                background-color: rgb(72, 11, 11);

            }

            80%{

                background-color: rgb(118, 165, 42);

            }

            100%{

                background-color: rgba(42, 165, 138, 0.255);

            }

        }

        @keyframes myframe2 {

            from{

                background-color: aquamarine;

                transform: translate(200px,200px) skew(360deg,40deg);

                width: 0px;

                height: 0px;

            }

            to{

                background-color: red;

                width: 100px;

                height: 100px;

            }

            0%{

                background-color: brown;

            }

            20%{

                background-color: rgb(42, 63, 165);

            }

            40%{

                background-color: brown;

            }

            60%{

                background-color: rgb(72, 11, 11);

            }

            80%{

                background-color: rgb(118, 165, 42);

            }

            100%{

                background-color: rgba(42, 165, 138, 0.255);

            }

        }

        @keyframes myframe3 {

            from{

                background-color: aquamarine;

                transform: scale(0.5) rotate(360deg);

                width: 0px;

                height: 0px;

            }

            to{

                background-color: red;

                width: 100px;

                height: 100px;

            }

            0%{

                background-color: brown;

            }

            20%{

                background-color: rgb(42, 63, 165);

            }

            40%{

                background-color: brown;

            }

            60%{

                background-color: rgb(72, 11, 11);

            }

            80%{

                background-color: rgb(118, 165, 42);

            }

            100%{

                background-color: rgba(42, 165, 138, 0.255);

            }

        }

        @keyframes myframe {

            from{

                background-color: aquamarine;

                transform: translate(200px,200px) rotate(360deg);

                width: 0px;

                height: 0px;

            }

            to{

                background-color: red;

                width: 100px;

                height: 100px;

            }

            0%{

                background-color: brown;

            }

            20%{

                background-color: rgb(42, 63, 165);

            }

            40%{

                background-color: brown;

            }

            60%{

                background-color: rgb(72, 11, 11);

            }

            80%{

                background-color: rgb(118, 165, 42);

            }

            100%{

                background-color: rgba(42, 165, 138, 0.255);

            }

        }

     </style>

</head>

<body>

    <div class="a"></div>

    <div class="b"></div>

    <div class="c"></div>

    <div class="d"></div>

</body>

</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值