Home > Web Front-end > HTML Tutorial > 动画-animation_html/css_WEB-ITnose

动画-animation_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 08:48:28
Original
1288 people have browsed it

动画

=====================================================================================

1.@keyframes规则


2.animation属性


Webkit内核的浏览器(Safari,chrome)需要加-webit-前缀。


持续时间:

animation-duration

-webkit-animation-duration


时间函数:

animation-timing-function

-webkit-animation-timing-function


延迟时间:

animation-delay

-webkit-animation-delay


动画执行次数:

animation-iteration-count: count / infinite(无限次)

-webkit-animation-iteration-count:


动画播放方向:

animation-direction: normal / reverse /alternate / alternate-reverse

                           //正常 / 反向 / 第一次正常第二次反向 / 第一次反向第二次正常

-webkit-animation-direction:


动画播放前后的状态:

animation-fill-mode: none / backwards / forwards /both

  // 默认值 / 设置播放之前的元素状态和第一个关键帧相同 / 播放后的

                                                                  状态和最后一个关键帧相同

-webkit-animation-fill-mode:


控制动画运行或暂停:

animation-play-state: running / paused

-webkit-animation-play-state  


*****************************************************************************************

所有和animation相关的样式都可以写在animation属性内:

    但 1. 至少要有animation-name 和 animation-duration

       2. animation-duration在animation-delay之前


     div{            height:100px;            width:100px;            background: url(images/ball.png);            background-size:99.5%;            animation:myball_1 6s linear infinite alternate, myball_2 6s linear infinite;            -webkit-animation:myball_1 6s linear infinite alternate, myball_2 6s linear infinite;            animation-play-state:running;            -webkit-animation-play-state:running;        }        div:hover{            animation-play-state:paused;            -webkit-animation-play-state:paused;        }        @keyframes myball_1{            100%{ transform :rotate(360deg);}        }        @-webkit-keyframes myball_1{                    100%{transform:rotate(360deg);}        }        @keyframes myball_2{            0%,50%,100%{ opacity :1;}            25%,75%{ opacity:0 ;}        }        @-webkit-keyframes myball_2{                    0%,50%,100%{opacity:1;}                    25%,75%{opacity:0;}        }
Copy after login


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template