Skip to content

Instantly share code, notes, and snippets.

@spite
Created May 6, 2016 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spite/fe9ed4d06646c6c22f4a04757c8e5bb5 to your computer and use it in GitHub Desktop.
Save spite/fe9ed4d06646c6c22f4a04757c8e5bb5 to your computer and use it in GitHub Desktop.
function hashRenderParams() {
var hash;
// hash your render values
//e.g, camera parameters: camera.position.x + '|' + camera.position.y + '|' + camera.position.z
return hash;
}
var hash = '';
function render() {
requestAnimationFrame( render );
// update render params
// e.g. ease camera position
var h = hashRenderParams();
if( h !== hash ) {
// frame invalidated, redraw
}
hash = h;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment