语法项目 | 说明 |
---|---|
初始值 | ease |
适用于 | 所有元素 |
可否继承 | 否 |
媒介 | 视觉 |
版本 | CSS3.0 |
检索或设置对象动画的过渡类型
如果提供多个属性值,以逗号进行分隔。
ease:缓解效果,等同于cubic-bezier(0.25,0.1,0.25,1.0)函数,既立方贝塞尔。
linear:线性效果,等同于cubic-bezier(0.0,0.0,1.0,1.0)函数。
ease-in:渐显效果,等同于cubic-bezier(0.42,0,1.0,1.0)函数。
ease-out:渐隐效果,等同于cubic-bezier(0,0,0.58,1.0)函数。
ease-in-out:渐显渐隐效果,等同于cubic-bezier(0.42,0,0.58,1.0)函数。
step-start:马上转跳到动画结束状态。
step-end:保持动画开始状态,直到动画执行时间结束,马上转跳到动画结束状态。
steps(<number>[, [ start | end ] ]?):第一个参数number为指定的间隔数,即把动画分为n步阶段性展示,第二个参数默认为end,设置最后一步的状态,start为结束时的状态,end为开始时的状态,若设置与animation-fill-mode的效果冲突,而以animation-fill-mode的设置为动画结束的状态。
cubic-bezier(<number>, <number>, <number>, <number>):特殊的立方贝塞尔曲线效果。
- .demo_box{
- -webkit-animation:f1 2s 0.5s forwards;
- -moz-animation:f1 2s 0.5s forwards;
- position:relative;
- left:10px;
- width:50px;
- height:50px;
- border-radius:50px;
- margin:10px 0;
- overflow:hidden;
- }
- .ease{
- -webkit-animation-timing-function:ease;
- -moz-animation-timing-function:ease;
- }
- .linear{
- -webkit-animation-timing-function:linear;
- -moz-animation-timing-function:linear;
- }
- .ease-in{
- -webkit-animation-timing-function:ease-in;
- -moz-animation-timing-function:ease-in;
- }
- .ease-out{
- -webkit-animation-timing-function:ease-out;
- -moz-animation-timing-function:ease-out;
- }
- .ease-in-out{
- -webkit-animation-timing-function:ease-in-out;
- -moz-animation-timing-function:ease-in-out;
- }
- .step-start{
- -webkit-animation-timing-function:step-start;
- -moz-animation-timing-function:step-start
- }
- .step-end{
- -webkit-animation-timing-function:step-end;
- -moz-animation-timing-function:step-end;
- }
- .steps{
- -webkit-animation-timing-function:steps(2);
- -moz-animation-timing-function:steps(2)
- }
- .cubic-bezier{
- -webkit-animation-timing-function:cubic-bezier(0.52,0,0.58,1.0);
- -moz-animation-timing-function:cubic-bezier(0.52,0,0.58,1.0);
- }
- @-webkit-keyframes f1{
- 0%{left:10px;}
- 100%{left:500px;}
- }
- @-moz-keyframes f1{
- 0%{left:10px;}
- 100%{left:500px;background:#f00}
- }
- <div class="demo_box ease">ease</div>
- <div class="demo_box linear">linear</div>
- <div class="demo_box ease-in">ease-in</div>
- <div class="demo_box ease-out">ease-out</div>
- <div class="demo_box ease-in-out">ease-in-out</div>
- <div class="demo_box step-start">step-start</div>
- <div class="demo_box step-end">step-end</div>
- <div class="demo_box steps">steps(2)</div>
- <div class="demo_box cubic-bezier">cubic-bezier(0.52,0,0.58,1.0)</div>
IE | Firefox | Opera | Safari | Chrome |
---|---|---|---|---|
IE 10+ | Firefox 3.5+ | 目前暂无版本支持 | Safari 10+ | Chrome 2.0+ |