大网数据广告活动
Web 标准与前端开发

AnimationEffect: getTiming() method

· 52CE 我爱测

The `AnimationEffect.getTiming()` method of the AnimationEffect interface returns an object containing the timing properties for the Animation Effect.

Web Animations

The AnimationEffect.getTiming() method of the AnimationEffect interface returns an object containing the timing properties for the Animation Effect.

[!NOTE] Several of the timing properties returned by getTiming() may take on the placeholder value "auto". To obtain resolved values for use in timing computations, instead use AnimationEffect.getComputedTiming().

In the future, "auto" or similar values might be added to the types of more timing properties, and new types of AnimationEffect might resolve "auto" to different values.

Syntax

getTiming()

Parameters

None.

Return value

An object containing the following properties:

  • delay

    • : The number of milliseconds of delay before the start of the effect.

      (See also animation-delay.)

  • direction

    • : "normal", "reverse", "alternate", or "alternate-reverse".

      Indicates whether the effect runs forwards ("normal"), backwards ("reverse"), switches direction after each iteration ("alternate"), or runs backwards and switches direction after each iteration ("alternate-reverse").

      (See also animation-direction.)

  • duration

    • : A number of milliseconds or the string "auto".

      Indicates the time one iteration of the animation takes to complete.

      The meaning of "auto" may differ depending on the type of effect; for KeyframeEffect, "auto" is the same as 0.

      (See also animation-duration.)

  • easing

    • : A string representing an easing-function describing the rate of change of the effect over time.

      (See also animation-timing-function.)

  • endDelay

    • : The number of milliseconds of delay after the end of the effect.

      This is primarily of use when sequencing animations based on the end time of another animation.

  • fill

    • : "none", "forwards", "backwards", "both", or "auto".

      Indicates whether the effect is reflected by its target(s) prior to playing ("backwards"), retained after the effect has completed ("forwards"), "both", or neither ("none").

      The meaning of "auto" may differ depending on the type of effect; for KeyframeEffect, "auto" is the same as "none".

      (See also animation-fill-mode.)

  • iterations

    • : The number of times the effect will repeat. A value of Infinity indicates that the effect repeats indefinitely.

      (See also animation-iteration-count.)

  • iterationStart

    • : A number indicating at what point in the iteration the effect starts. For example, an effect with an iterationStart of 0.5 and 2 iterations would start halfway through its first iteration and end halfway through a third iteration.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。