cross-browser requestAnimationFrame

This commit is contained in:
Mahdi Dibaiee 2015-01-08 15:24:48 +03:30
parent fd8d4aca74
commit 7a351e5ae1

View File

@ -27,8 +27,14 @@ function add(x, y) {
});
}
var reqAnimationFrame = mozRequestAnimationFrame ||
webkitRequestAnimationFrame ||
msRequestAnimationFrame ||
oRequestAnimationFrame ||
requestAnimationFrame;
(function loop() {
mozRequestAnimationFrame(function() {
reqAnimationFrame(function() {
c.clearRect(0, 0, $c.width, $c.height);
for( var i = 0; i < balls.length; i++ ) {