Skip to content

Need a requestAnimationFrame-style API for OffscreenCanvas #2051

@junov

Description

@junov

In order to produce high-frame rate and low-latency animations, without going into over-draw, we need an API to provide an animation heart beat for OffscreenCanvas.

Initial thoughts:

  • Only OffscreenCanvases that use the commit() flow have a direct link to a display, so perhaps OC.rAF should be tied to the use of commit().

  • OC.rAF should not be intrinsically tied to the processing model of the browsing context's event loop because we want workers to be able to pump out animation frames while the main thread is busy.

  • There is no global graphics update that commit needs to be synchronized with, so the processing model can be quite open-ended, implementation should only have to respect a small set of rules. E.g. does not cause over-draw, minimizes latency (does not accumulate multiframe backlogs), maximizes frame rate.

  • It should be possible to drive synchronized animations on multiple OffscreenCanvas objects as long as the OffscreenCanvas objects are in the same worker.

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