Skip to content

Instantly share code, notes, and snippets.

@pilssalgi
Created March 13, 2017 09:01
Show Gist options
  • Save pilssalgi/ca021ec968ab77aa757a0ac4b7a6b6d1 to your computer and use it in GitHub Desktop.
Save pilssalgi/ca021ec968ab77aa757a0ac4b7a6b6d1 to your computer and use it in GitHub Desktop.
RFA controll fps
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