mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 06:00:56 -05:00
Use the experimental Event.requestAnimationFrame() rather than setInterval().
This commit is contained in:
parent
8179d7bf7e
commit
4ec8847859
1 changed files with 4 additions and 2 deletions
|
@ -18,7 +18,7 @@
|
||||||
var offset = new Point(20 + 10 * i, 0);
|
var offset = new Point(20 + 10 * i, 0);
|
||||||
var path = new Path();
|
var path = new Path();
|
||||||
path.fillColor = i % 2 ? 'red' : 'black';
|
path.fillColor = i % 2 ? 'red' : 'black';
|
||||||
console.log(path.fillColor);
|
//console.log('color', path.fillColor);
|
||||||
path.closed = true;
|
path.closed = true;
|
||||||
|
|
||||||
var l = offset.length;
|
var l = offset.length;
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
placedSymbol.position = center;
|
placedSymbol.position = center;
|
||||||
layer.appendBottom(placedSymbol);
|
layer.appendBottom(placedSymbol);
|
||||||
}
|
}
|
||||||
setInterval(draw, 30);
|
// setInterval(draw, 30);
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
function draw() {
|
function draw() {
|
||||||
|
@ -44,7 +44,9 @@
|
||||||
item.rotate(angle);
|
item.rotate(angle);
|
||||||
}
|
}
|
||||||
document.redraw();
|
document.redraw();
|
||||||
|
Event.requestAnimationFrame(draw, document.canvas);
|
||||||
}
|
}
|
||||||
|
Event.requestAnimationFrame(draw, document.canvas);
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
Loading…
Reference in a new issue