码迷,mamicode.com
首页 > 其他好文 > 详细

Animation用法

时间:2016-06-09 23:35:30      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:

测试代码及说明:

技术分享
<!DOCTYPE html>
<html lang="en-US">
<head>
    <meta charset="UTF-8">
    <title>Simple CSS3 Animation</title>
    <style type="text/css">
        #demo {
            position: absolute;
            left: 30%;
            top: 30%;
            background-color: red;
            width: 200px;
            height: 200px;
            -webkit-animation: animation1 2s linear forwards; /*只有Webkit内核的浏览器才能解析*/
            -moz-animation: animation1 2s linear forwards; /*Firefox浏览器私有属性*/
            -o-animation: animation1 2s linear forwards; /*Opera浏览器私有属性*/
            -ms-animation: animation1 2s linear forwards; /*IE浏览器私有属性*/
            animation: animation1 2s linear forwards; /*Firefox浏览器私有属性*/
        }

        @-webkit-keyframes animation1 {
            0% {
                background: red;
            }

            50% {
                background: blue;
            }

            100% {
                background: yellow;
            }
        }

        @-moz-keyframes animation1 {
            0% {
                background: red;
            }

            50% {
                background: blue;
            }

            100% {
                background: yellow;
            }

        }

        @-o-keyframes animation1 {
            0% {
                background: red;
            }

            50% {
                background: blue;
            }

            100% {
                background: yellow;
            }

        }

        @-ms-keyframes animation1 {
            0% {
                background: red;
            }

            50% {
                background: blue;
            }

            100% {
                background: yellow;
            }
        }

        @keyframes animation1 {
            0% {
                background: red;
            }

            50% {
                background: blue;
            }

            100% {
                background: yellow;
            }

        }
    </style>
</head>
<body>
    <div id="demo">
    </div>
</body>
</html>
View Code

演示效果:

技术分享

 

Animation用法

标签:

原文地址:http://www.cnblogs.com/sccd/p/5571165.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!