css3アニメーションデモ

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>animation</title>
    <style>
        div {
     
     
            width: 50px;
            height: 50px;
            position: absolute;
            background-color: royalblue;
            animation: yexianli 5s ease-in-out;
            animation-iteration-count: infinite;
        }

        @keyframes yexianli {
     
     
            from {
     
     
                left: 0px;
            }

            to {
     
     
                left: 100px
            }
        }

        p {
     
     
            width: 50px;
            height: 50px;
            position: absolute;
            top: 100px;
            background-color: royalblue;
            animation: yexianli1 5s ease-in-out;
            animation-iteration-count: infinite;
        }

        @keyframes yexianli1 {
     
     
            0% {
     
     
                background-color: skyblue;
            }

            25% {
     
     
                background-color: yellow;
            }

            50% {
     
     
                background-color: yellowgreen;
            }

            75% {
     
     
                background-color: green;
            }

            100% {
     
     
                background-color: royalblue;
            }
        }
    </style>
</head>

<body>
    <div></div>
    <p></p>
</body>

</html>

リンク:アニメーションプロパティの詳細な説明は、ここをクリックしてジャンプできます

おすすめ

転載: blog.csdn.net/qq_26889291/article/details/109092939