updatePlaybackRate method
The updatePlaybackRate()
method of the
Web Animations API's
Animation Interface sets the speed of an animation after first
synchronizing its playback position.
In some cases, an animation may run on a separate thread or process and will continue updating even while long-running JavaScript delays the main thread. In such a case, setting the Animation.playbackRate on the animation directly may cause the animation's playback position to jump since its playback position on the main thread may have drifted from the playback position where it is currently running.
updatePlaybackRate()
is an asynchronous method that sets the speed of an
animation after synchronizing with its current playback position, ensuring
that the
resulting change in speed does not produce a sharp jump. After calling
updatePlaybackRate()
the animation's Animation.playbackRate is not
immediately updated.
It will be updated once the animation's Animation.ready promise is
resolved.
Implementation
external void updatePlaybackRate(num playbackRate);