Description
In writing the last few tests for the asynchronous playback rate changes (#2059) I noticed an oddity:
const animation = div.animate(...);
animation.currentTime = 100 * 1000;
await animation.ready;
animation.playbackRate = 2;
// animation.currentTime =~ 200 * 1000;
However:
const animation = div.animate(...);
animation.currentTime = 100 * 1000;
animation.playbackRate = 2;
// animation.currentTime =~ 100 * 1000;
The reason is that in the first example the current time is calculated from the start time so changing the playback rate makes it jump. In the second example the current time is calculated from the hold time (the start time is unresolved at this point) so updating the playback rate does not effect the current time.
That inconsistency seems really undesirable. I suspect we want to make setting the playback rate do a compensatory seek after all. That means that doing anim.playbackRate = 2
and anim.updatePlaybackRate(2)
are quite close in behavior and authors may accidentally doing the former when they really want the latter but I can't think of anything better. We could just make playbackRate
read-only but that's likely to break content.