Created
April 1, 2014 13:59
-
-
Save sushat4692/9914517 to your computer and use it in GitHub Desktop.
requestAnimationFrame
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
// requestAnimationFrameを優先に、存在しなければsetTimeoutを取得する | |
var requestAnimationFrame = window.requestAnimationFrame | |
|| window.webkitRequestAnimationFrame | |
|| window.mozRequestAnimationFrame | |
|| window.setTimeout; | |
window.requestAnimationFrame = requestAnimationFrame; | |
function func() { | |
// 実行させたい何か | |
} | |
requestAnimationFrame( func, interval ); // intervalはsetTimeoutの時だけ利用されます |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment