1.cs3 多動畫盒子旋轉 0%-100% ,2.動畫 使用 from to

1.cs3 多動畫盒子旋轉 0%-100%

在這裏插入圖片描述

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 200px;
            background: red;
            /* 動畫名稱 */
            /* animation-name: dong; */
            /* 動畫總時長2s */
            /* animation-duration: 2s; */
            /* 執行3次 */
            /* animation-iteration-count: 3; */
            /* 動畫逆播 */
            /* animation-direction: alternate; */
            /* 動畫勻速執行 */
            /* animation-timing-function: linear; */
            /* 動畫延時1s 執行 */
            /* animation-delay: 1s; */
            /* 動畫執行完後的狀態 */
            /* animation-fill-mode: forwards; */
            /* animation: dong 12s 3 alternate linear 0.5s forwards; */
            /* margin: 200px auto; */
            animation: dong1 6s infinite alternate;
        }
        
        @keyframes dong1 {
            20% {
                width: 300px;
                animation-fill-mode: forwards;
                animation-duration: 5s;
            }
            50% {
                height: 300px;
            }
            60% {}
            100% {
                width: 300px;
                height: 300px;
                background-color: blue;
            }
        }
        
        .mix {
            width: 100px;
            height: 100px;
            margin: 20px;
            background-color: red;
            animation: mixs 5s infinite alternate;
            /*  alternate 逆播  */
        }
        
        @keyframes mixs {
            0% {
                width: 200px;
                height: 200px;
                background-color: red;
            }
            30% {
                height: 250px;
                width: 250px;
                background-color: green;
            }
            60% {
                width: 300px;
                height: 300px;
                background-color: blue;
            }
            80% {
                transform: rotate(360deg);
            }
            100% {
                transform: scale(1.5);
            }
        }
    </style>
</head>

<body>
    <div class="box"> </div>
    <div class="mix"></div>
</body>

</html>

2.動畫 使用 from to

在這裏插入圖片描述

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            border: 1px solid red;
            margin: 200px auto;
            animation: dong 2s infinite linear; // infinite 無限循環  linear 勻速
        }

        img {
            width: 300px;
            height: 300px;
        }

        @keyframes dong {
            from {
                transform: rotate(0deg);
            }
            to {
                transform: rotate(360deg);
            }
        }
    </style>
</head>

<body>
    <div class="box"> 12 </div>
</body>

</html>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章