--- 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>
每个 {{cssxref("<timing-function>")}}代表了应用于动画的timing function,定义于{{cssxref("animation-property")}}.

正式语法

{{csssyntax("animation-timing-function")}}

示例

参见 CSS animations

规范

规范 状态 备注
{{SpecName('CSS3 Animations', '#animation-timing-function', 'animation-timing-function')}} {{Spec2('CSS3 Animations')}}

浏览器兼容性

{{Compat("css.properties.animation-timing-function")}}

参见