The updateTiming()
method of the AnimationEffect
interface updates the specified timing properties for an animation effect.
The updateTiming()
method of the AnimationEffect
interface updates the specified timing properties for an animation effect.
js
updateTiming(timing)
timing
Optional
An object containing zero or more of the properties from the return value of AnimationEffect.getTiming()
, representing the timing properties to update.
None (undefined
).
TypeError
Thrown if invalid values are provided for any of the timing properties.
updateTiming()
may cause any associated Animation
to start or stop playing, if for example the effect of a running animation is shortened such that its end time is before Animation.currentTime
or the effect of a finished animation is lengthened such that its end time is after Animation.currentTime
.
js
const animation = document.body.animate([], { duration: 1000 }); animation.finish(); console.log(animation.playState); // finished animation.effect.updateTiming({ duration: 2000 }); console.log(animation.playState); // running
Specification |
---|
Web Animations # dom-animationeffect-updatetiming |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
updateTiming |
75 | 79 | 63 | No | 62 | 13.1 | 75 | 75 | 63 | 54 | 13.4 | 11.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AnimationEffect/updateTiming