Skip to content
/ raf Public
forked from chrisdickinson/raf

requestAnimationFrame polyfill library

License

Notifications You must be signed in to change notification settings

sempostma/raf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raf

browser support

requestAnimationFrame polyfill for browserify.

var raf = require('raf')
  , canvas = document.getElementById('opengl')

raf(canvas)
  .on('data', function(dt) {
    console.log('difference in time is '+dt+'ms')
  })

API

raf([optional element], [optional tick function]) -> event emitter

returns a event emitter that immediately starts emitting 'data' events representing animation frames for a given element (or for the entire window, if no element is passed).

if you pass a function as the first or second argument it will get called on every tick. this is a convenience method for the example above that binds to the data event, e.g. raf().on('data', tickFunction) is the same as raf(tickFunction) or raf(el, tickFunction)

ee.pause() / ee.resume()

pauses or resumes the events coming out of ee.

the dt on the next event after a resume will represent the difference between the last rendered frame and the newest frame.

raf.polyfill

the polyfilled requestAnimationFrame function.

license

MIT

About

requestAnimationFrame polyfill library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%