Skip to content

Proposal to add/adopt adaptive sync throttling method #62

@fuweichin

Description

@fuweichin

An alternate 'throttleAdaptiveSync' method based on requestAnimationFrame, used to throttle user input event in order to achive more fluent redraw for Canvas / WebGL applications.

Background
Consider the following case:

An interactive webpage contains a range <input> and a 2D <canvas>, when the range slider input event gets triggered, the canvas will be redrawed.

Problem

Since the range input may be triggered frequently (8ms ~ 12 ms interval on my computer), Sometimes it causes laggy if canvas redraw takes long time.

Alternative

  • Fixed-delay throttling can basically solve the problem, but that is not perfect for different computers, different screens or different canvas states (normal and fullscreen).
  • Dynamic-delay throttling can be very complex, as complex as TCP congestion control, such it can be heavy-weight, more overhead.

Solution
I worked out a simple method, as a reference implemention, to achive adaptive sync throttling. see online demo and source code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions