动画多状态写法2

Posted divtab

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了动画多状态写法2相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        .box 
            /* infinite 无限循环
            alternate 逆播  */
            animation: changes 3s infinite alternate;
        
        /* 百分比是相对动画时长 */
        @keyframes changes 
            0% 
                width: 100px;
                height: 100px;
                background-color: red;
            
            30% 
                width: 200px;
                height: 400px;
                background-color: blue;
            
            60% 
                width: 300px;
                height: 600px;
                background-color: skyblue;
            
            100% 
                width: 600px;
                height: 800px;
                background-color: #ccc;
            
        
    </style>
</head>

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

</html>

以上是关于动画多状态写法2的主要内容,如果未能解决你的问题,请参考以下文章