cross-browser requestAnimationFrame
This commit is contained in:
parent
fd8d4aca74
commit
7a351e5ae1
8
main.js
8
main.js
@ -27,8 +27,14 @@ function add(x, y) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var reqAnimationFrame = mozRequestAnimationFrame ||
|
||||||
|
webkitRequestAnimationFrame ||
|
||||||
|
msRequestAnimationFrame ||
|
||||||
|
oRequestAnimationFrame ||
|
||||||
|
requestAnimationFrame;
|
||||||
|
|
||||||
(function loop() {
|
(function loop() {
|
||||||
mozRequestAnimationFrame(function() {
|
reqAnimationFrame(function() {
|
||||||
c.clearRect(0, 0, $c.width, $c.height);
|
c.clearRect(0, 0, $c.width, $c.height);
|
||||||
|
|
||||||
for( var i = 0; i < balls.length; i++ ) {
|
for( var i = 0; i < balls.length; i++ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user