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
numberindicating the end time of the effect in milliseconds from the effect's start. This is equal toactiveDurationplusdelayandendDelay.
- : A
-
activeDuration- : A
numberindicating the total duration in milliseconds of all iterations of the effect. This is equal todurationmultiplied byiterations(or zero if that product would be NaN).
- : A
-
localTime-
: A
numberornull.Indicates the length of time in milliseconds that the effect has run. This is equal to the Animation.currentTime of the associated animation, or
nullif the effect is not associated with an animation.
-
-
progress-
:
nullor anumber.Indicates the effect's progress through its current iteration. At the start of the
activeDuration, this equals the fractional part ofiterationStart.The value is typically between
0and1, but may fall outside this range depending on the effect's easing-function's output. For example, an easing function ofcubic-bezier(0.3, 2, 0.6, 2)would transform the time progress of0.5to approximately1.65.Returns
nullif the effect isn't mid-iteration, for example because the effect is in thedelayorendDelayperiods, the effect is finished, orlocalTimeisnull.
-
-
currentIteration-
:
nullor an integernumber.Indicates the index of the current iteration. At the start of the
activeDuration, this equals the integer part ofiterationStart.Returns
nullwheneverprogressisnull.
-
-
Specifications
Browser compatibility
See also
- Web Animations API
- AnimationEffect
- Animation
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
