Created
March 13, 2017 09:01
-
-
Save pilssalgi/ca021ec968ab77aa757a0ac4b7a6b6d1 to your computer and use it in GitHub Desktop.
RFA controll fps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var interval = 1000/30; | |
var then = Date.now(); | |
var startTime = then; | |
var elapsed; | |
var frameCount = 0; | |
function animate(){ | |
now = Date.now(); | |
elapsed = now - then; | |
if (elapsed > interval) { | |
then = now - (elapsed % interval); | |
_this.drawVideo(); | |
} | |
_this.videoInfo.interval = requestAnimationFrame(animate); | |
} | |
animate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment