jeromeetienne / raf-throttler.js

a micro library to throttle the rate of requestAnimationFrame

Home Page:http://jeromeetienne.github.io/raf-throttler.js/examples/basic.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

raf-throttler.js

raf-throttler.js is a micro library to throttle and instrument requestAnimationFrame. It has been written to help debugging, as part of three.js inspector chrome devtools extension. You can throttle the rate to see how your animation is reacting. Perfect debug tool if you wanna see what your game looks like at 20fps!

The code is simple, you likely could have coded that yourself. It is published so hopefully you dont have to :)

Show Don't Tell

Examples usage

First let's throttle requestAnimationFrame at 10 fps

var rafHijacker	= new RafHijacker()
rafHijacker.fps = 10

Now we gonna disable throttling

rafHijacker.fps = -1

And at the end, restore the original requestAnimationFrame function

rafHijacker.restore()

TODO

  • to rename raf-throttler.js ?

About

a micro library to throttle the rate of requestAnimationFrame

http://jeromeetienne.github.io/raf-throttler.js/examples/basic.html


Languages

Language:HTML 78.4%Language:JavaScript 16.1%Language:Makefile 5.5%