AnimationEffect: updateTiming() method

Baseline 2022

Newly available

Since September 2022, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

The updateTiming() method of the AnimationEffect interface updates the specified timing properties for an animation effect.

Syntax

js
updateTiming(timing)

Parameters

timing Optional

An object containing zero or more of the properties from the return value of AnimationEffect.getTiming(), representing the timing properties to update.

Return value

None (undefined).

Exceptions

TypeError

Thrown if invalid values are provided for any of the timing properties.

Examples

Side effects

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

Specifications

Specification
Web Animations
# dom-animationeffect-updatetiming

Browser compatibility

BCD tables only load in the browser

See also