polyfills/requestAnimationFrame

Methods

(static) animationFrameIsRunning() → {boolean}

Returns true if the animation loop for requestAnimationFrame requests is currently running, false if not.

Returns:
Type
boolean

(static) cancelAnimationFrame(requestID)

Polyfill for cancelAnimationFrame.

Parameters:
Name Type Description
requestID number

(static) requestAnimationFrame(callback) → {number}

Polyfill for requestAnimationFrame. Runs at frequency of 60 Hertz.

Example
const callback = (t) => console.log(t); // timestamp
viewstat.polyfills.requestAnimationFrame(callback);
viewstat.polyfills.startAnimationFrameRuntime(); // call this to initialize the animation loop
Parameters:
Name Type Description
callback function
Returns:
Type
number

(static) startAnimationFrameRuntime()

Starts the animation loop.

Description:
  • The polyfill for requestAnimationFrame will not work without having started the runtime.

(static) stopAnimationFrameRuntime()

Stops the animation loop.