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 :)
- examples/basic.html [view source] : It shows a basic usage of rafHijacker.js .
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()
- to rename raf-throttler.js ?