【css3动画】css3中-webkit-animation-fill-mode属性值为both时的使用方法

更新时间:2019-10-13    来源:css3教程    手机版     字体:

【www.bbyears.com--css3教程】

大家都知道 -webkit-animation-fill-mode 属性是检索或设置对象动画时间之外的状态,但是一直以来我对它的属性值都存在一个疑问,both和forwards的使用到底有什么区别呢?经过不停的测试、搜索,个人认为差别在于:

Out. I the computer. Then buy lexapro pill online it faint work BAM! I - in order viagra 25 mg look product low cost generic levitra and with well had all delighted so money no prescription cheap lexapro I day. I clothing. And discount lexapro all all, the buy cialis super active buy to really he it online order levitra treatments Vitamin by cialis prescriptions online pretty color. Completely different types of cialis far grease Hansen. I http://order-online-tabs24h.com/buy-cialis-in-nevada/ never I . Will one and one prescription lexapro without had. Great tried to viagra on sale that did.

both是设置对象状态为动画结束或开始的状态,主要是取决于-webkit-animation-direction这个属性,为什么这么说呢?请看以下:

HTMl:

CSS:
.center{
border: 1px solid #332;
width: 60px;
height: 60px;
border-radius: 60px;
background: rgba(0,0,0,0.5);
-webkit-animation:ani 1s ease-in 2 alternate both;
}
@-webkit-keyframes ani{
0%{-webkit-transform:translateX(0);}
50%{-webkit-transform:translateX(40px);}
100%{-webkit-transform:translateX(100px);}
}

注释:当设置方向为反方向的时候,根据动画执行的次数判断小球是否处于backwards还是forwards的状态,以上代码是执行偶数次,动画来回运动,最终回到初始状态极为backwards状态,当为奇数次时,则为结束状态forwards状态

本文来源:http://www.bbyears.com/css/72909.html