This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The getComputedTiming()
method of the AnimationEffect
interface returns the calculated timing properties for this animation effect.
Although many of the attributes of the returned object are common to the EffectTiming
contained in the object returned by the AnimationEffect.getTiming()
method, the values returned by this object differ in the following ways:
duration
- Returns the calculated value of the iteration duration. If
EffectTiming.duration
is the stringauto
, this attribute will return0
. fill
- The
auto
value is replaced with the appropriateEffectTiming.fill
value.
These values are comparable to the computed styles of an Element returned using window.getComputedStyle(elem)
.
Syntax
var currentTimeValues = animation.getComputedTiming();
Parameters
None.
Return Value
A ComputedEffectTiming
dictionary object, which contains the following properties:
- endTime
- The end time of the animation in milliseconds from the animation's start (if the
KeyframeEffect
is associated with anAnimation
). (Also includesEffectTiming.endDelay
in that calculation.) - activeDuration
- The length of time in milliseconds that the animation's effects will run. This is equal to the iteration duration multiplied by the iteration count.
- localTime
- The current time of the animation in milliseconds. If the
KeyframeEffect
is not associated with anAnimation
, its value isnull
. - progress
- Indicates how far along the animation is through its current iteration with values between
0
and1
. Returnsnull
if the animation is not running or itsKeyframeEffect
isn't associated with anAnimation
. - currentIteration
- The number of times this animation has looped, starting from
0
. Returnsnull
if the animation is not running or itsKeyframeEffect
isn't associated with anAnimation
.
Specifications
Specification | Status | Comment |
---|---|---|
Web Animations The definition of 'AnimationEffect.getComputedTiming()' in that specification. |
Working Draft | Editor's draft. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getComputedTiming | Chrome Full support 75 | Edge Full support 79 | Firefox Full support 63 | IE No support No | Opera Full support 62 | Safari Full support 13.1 | WebView Android Full support 75 | Chrome Android Full support 75 | Firefox Android Full support 63 | Opera Android Full support 54 | Safari iOS Full support 13.4 | Samsung Internet Android Full support 11.0 |
Legend
- Full support
- Full support
- No support
- No support