This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Web Animations API's AnimationEffectTimingProperties
dictionary's iterationStart
property specifies the repetition number which repetition the animation begins at and its progress through it.
Element.animate()
, KeyframeEffectReadOnly.KeyframeEffectReadOnly()
, and KeyframeEffect.KeyframeEffect()
all accept an object of timing properties including iterationStart.
The value of iterationStart
corresponds directly to AnimationEffectTimingReadOnly.iterationStart
in timing
objects returned by AnimationEffectReadOnly
, KeyframeEffectReadOnly
, and KeyframeEffect
.
var timingProperties = { iterationStart = iterationNumber }; timingProperties.iterationStart = iterationNumber;
A floating-point value whose value is at least 0 and is not +Infinity
, indicating the offset into the number of iterations the animation sequence is to run at which to start animating. iterationStart
represents the iteration index at which the animation effect begins as well as its progress through that iteration.
Usually you'll use a value between 0.0 and 1.0 to indicate an offset into the first run of the animation at which to begin the animation performance, but any positive, non-infinite value is allowed. Since all animations' iteration indexes start at 0, a value of 0.5 would start the animation halfway through its first iteration or loop. Meanwhile, a value of 1.2 means the animation will begin playback 20% of the way through its second iteration, and so forth.
It's currently undefined what happens if you specify a value of iterationStart
which is greater than the value of AnimationEffectTimingProperties.iterations
. See issue 170 in the Web Animations API specification's issue tracker for details and status of any changes to the specification in this regard.
Specification | Status | Comment |
---|---|---|
Web Animations The definition of 'iterationStart' in that specification. | Working Draft | Editor's draft. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes) | 45 (45)[1] | No support | (Yes) | No support |
Feature | Android | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|---|
Basic support | ? | ? | ? | 45.0 (45)[1] | ? | No support | No support | No support |
[1] The Web Animations API is only enabled by default in Firefox Developer Edition and Nightly builds. You can enable it in beta and release builds by setting the preference dom.animations-api.core.enabled
to true
, and can disable it in any Firefox version by setting this preference to false
.
Element.animate()
, KeyframeEffectReadOnly()
, and KeyframeEffect()
all accept an object of timing properties including this one.AnimationEffectReadOnly.timing
, KeyframeEffectReadOnly.timing
, and KeyframeEffect.timing
).
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffectTimingProperties/iterationStart