首页 > 代码库 > CSS3动画整理

CSS3动画整理

偷懒使用animate.css来制作效果

animate动画的基本属性:

属性描述CSS
@keyframes规定动画。3
animation所有动画属性的简写属性,除了 animation-play-state 属性。3
animation-name规定 @keyframes 动画的名称。3
animation-duration规定动画完成一个周期所花费的秒或毫秒。默认是 0。3
animation-timing-function规定动画的速度曲线。默认是 "ease"。3
animation-delay规定动画何时开始。默认是 0。3
animation-iteration-count规定动画被播放的次数。默认是 1。3
animation-direction规定动画是否在下一周期逆向地播放。默认是 "normal"。3
animation-play-state规定动画是否正在运行或暂停。默认是 "running"。3
animation-fill-mode规定对象动画时间之外的状态。3

下面的两个例子设置了所有动画属性:

div{animation: myfirst 5s linear 2s infinite alternate;/* Firefox: */-moz-animation: myfirst 5s linear 2s infinite alternate;/* Safari 和 Chrome: */-webkit-animation: myfirst 5s linear 2s infinite alternate;/* Opera: */-o-animation: myfirst 5s linear 2s infinite alternate;}

@keyframes myfirst
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}

@-moz-keyframes myfirst /* Firefox */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}

@-o-keyframes myfirst /* Opera */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
}

 

animate

#slide_one i:nth-child(1) {    opacity: 0;}#slide_one.z-in i:nth-child(1) {    opacity: 1;    -webkit-backface-visibility: hidden;    animation:bounceInRight 1s  both ;    -webkit-animation: bounceInRight 1s  both ;}

 

translate

.chart div:nth-child(1) span{	display: block;	height: 0px;	background: #b94c02;	-webkit-transition: all .5s linear 2s;	transition: all .5s linear 2s;	-webkit-backface-visibility: hidden;}.z-current .chart div:nth-child(1) span{	height: 120px;}

  

animation-fill-mode:none | forwards | backwards | both [ , none | forwards | backwards | both ]*

none:默认值。不设置对象动画之外的状态

forwards:设置对象状态为动画结束时的状态

backwards:设置对象状态为动画开始时的状态

both:设置对象状态为动画结束或开始的状态

animation-fill-mode:both

动画开始时为opacity:0;opacity:1;

 

 

http://css.doyoe.com/

CSS3动画整理