Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.
/ raf-loop Public archive
forked from mattdesl/raf-loop

a minimal requestAnimationFrame render loop

License

Notifications You must be signed in to change notification settings

Synchronized-TV/raf-loop

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raf-loop

stable

A minimal requestAnimationFrame render loop for node and the browser, using high-performance timing where possible.

var loop = require('raf-loop')

var engine = loop(function(dt) {
    // delta time in milliseconds 
}).start()

Usage

NPM

engine = loop([fn])

Creates a new loop with an optional function to receive tick events. The function will be called with delta time as the first parameter, in milliseconds.

engine.start()

Starts the render loop and returns this engine, for chaining.

engine.stop()

Stops the render loop and cancels the currently requested animation frame.

engine.on('tick', fn)

Attaches another function to the render loop.

License

MIT, see LICENSE.md for details.

About

a minimal requestAnimationFrame render loop

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%