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

AnimationEffect: getComputedTiming() method

· 52CE 我爱测

The `getComputedTiming()` method of the AnimationEffect interface returns the calculated timing properties for this animation effect.

Web Animations

The getComputedTiming() method of the AnimationEffect interface returns the calculated timing properties for this animation effect.

[!NOTE] These values are comparable to the computed styles of an Element returned using window.getComputedStyle(elem).

Syntax

getComputedTiming()

Parameters

None.

Return value

An object which contains:

  • all of the properties of the object returned by AnimationEffect.getTiming(), except that any "auto" values are replaced by computed values that may depend on the type of AnimationEffect.
  • the following additional properties:
    • endTime

      • : A number indicating the end time of the effect in milliseconds from the effect's start. This is equal to activeDuration plus delay and endDelay.
    • activeDuration

      • : A number indicating the total duration in milliseconds of all iterations of the effect. This is equal to duration multiplied by iterations (or zero if that product would be NaN).
    • localTime

      • : A number or null.

        Indicates the length of time in milliseconds that the effect has run. This is equal to the Animation.currentTime of the associated animation, or null if the effect is not associated with an animation.

    • progress

      • : null or a number.

        Indicates the effect's progress through its current iteration. At the start of the activeDuration, this equals the fractional part of iterationStart.

        The value is typically between 0 and 1, but may fall outside this range depending on the effect's easing-function's output. For example, an easing function of cubic-bezier(0.3, 2, 0.6, 2) would transform the time progress of 0.5 to approximately 1.65.

        Returns null if the effect isn't mid-iteration, for example because the effect is in the delay or endDelay periods, the effect is finished, or localTime is null.

    • currentIteration

      • : null or an integer number.

        Indicates the index of the current iteration. At the start of the activeDuration, this equals the integer part of iterationStart.

        Returns null whenever progress is null.

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

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

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