Coder Social home page Coder Social logo

raf's Introduction

raf

browser support

reqeustAnimationFrame 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

raf's People

Contributors

chrisdickinson avatar cmtegner avatar hughsk avatar ljharb avatar max-mapper avatar raynos avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.