--- title: animation-timing-function slug: Web/CSS/animation-timing-function tags: - CSS - CSS Animations - CSS Property - Experimental - Reference translation_of: Web/CSS/animation-timing-function ---
{{CSSRef}}
CSS animation-timing-function属性定义CSS动画在每一动画周期中执行的节奏。
可能值为一或多个 {{cssxref("<timing-function>")}}。
对于关键帧动画来说,timing function作用于一个关键帧周期而非整个动画周期,即从关键帧开始开始,到关键帧结束结束。
定义于一个关键帧区块的缓动函数(animation timing function)应用到改关键帧;另外,若该关键帧没有定义缓动函数,则使用定义于整个动画的缓动函数。
/* Keyword values */
animation-timing-function: ease;
animation-timing-function: ease-in;
animation-timing-function: ease-out;
animation-timing-function: ease-in-out;
animation-timing-function: linear;
animation-timing-function: step-start;
animation-timing-function: step-end;
/* Function values */
animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
animation-timing-function: steps(4, end);
animation-timing-function: frames(10);
/* Multiple animations */
animation-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1);
/* Global values */
animation-timing-function: inherit;
animation-timing-function: initial;
animation-timing-function: unset;
通常用{{cssxref("animation")}}简写定义整个动画属性更为方便。
{{cssinfo}}
<timingfunction>
规范 | 状态 | 备注 |
---|---|---|
{{SpecName('CSS3 Animations', '#animation-timing-function', 'animation-timing-function')}} | {{Spec2('CSS3 Animations')}} |
{{Compat("css.properties.animation-timing-function")}}