Skip to content

[web-animations-1] Setting playbackRate should probably do a compensatory seek after all #2266

Closed
@birtles

Description

@birtles

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions