3.0.0 • Published 9 years ago

raf-stream v3.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

raf-stream

browser support Build Status

requestAnimationFrame event emitter 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

var raf = require('raf-stream')

var ee = raf(optional element, optional tick function)

Returns an 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.

license

MIT

3.0.0

9 years ago

2.0.0

10 years ago

1.0.0

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago