Skip to content
This repository was archived by the owner on Jul 30, 2019. It is now read-only.
This repository was archived by the owner on Jul 30, 2019. It is now read-only.

Strengthen requestAnimationFrame() spec for VSYNC / refresh rate matching in HTML 5.2 #785

@ghost

Description

UPDATE: Change committed on #785. Please see #375 instead (rewritten/newer) for further standardization efforts on this.

PROBLEM

  • requestAnimationFrame() is not sufficiently rigidly enough defined.

The older W3C "Animation Timing" spec had a better definition (https://www.w3.org/TR/animation-timing/) Section 5 says "The expectation is that the user agent will run tasks from the animation task source at at a regular interval matching the display's refresh rate. Running tasks at a lower rate can result in animations not appearing smooth. Running tasks at a higher rate can cause extra computation to occur without a user-visible benefit."
-- However the newer W3C HTML 5.1 no longer correctly describes the desire to match requestAnimationFrame() exactly to the refresh rate.

DETAIL

WHY IT IS IMPORTANT

  • Games
  • High-refresh-rate monitors (120Hz+ monitors, often found in GSYNC / FreeSync gaming monitors)
  • Animations, motion tests, etc.
  • Virtual reality. Note that Oculus/Rift is 90Hz

EASY SOLUTIONS

  • Discourage hardcoding of numbers such as "60Hz" or arbitrary maximum framerates such as "105". This does a disservice to high-refresh-rate monitors and future HFR displays (including future 4K120Hz and 8K120Hz standards)
  • Strengthen specification to make synchronization to display refresh rate a "MUST" instead of a "RECOMMENDED"
  • Strengthen specification to make it return exact vsync time rather than now(). Chrome is the only one that does it correctly.
  • [This lineitem has been moved to VSYNC API: Support for VSYNC OFF / 120Hz+ / variable refresh displays / etc #375] Strengthen specification to reduce allowable jitter, to permit smoother animations, given the increasingly real-time nature of websites, games, VR, etc. Things should be able to be stutter/jank-free all the way to ~50%-75% CPU used up inside requestAnimationFrame()
  • [This lineitem has been moved to VSYNC API: Support for VSYNC OFF / 120Hz+ / variable refresh displays / etc #375] Add options of flexibility such as to maximize smoothness (when fluidity is priority) versus minimizing lag (when minimum latency is priority).

COMPLIANCE TESTING WEBSITES FOR requestAnimationFrame()

SUPERSEDES (IN PART): #422, #375, #159

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions