Request next animation frame at beginning of callback.

This commit is contained in:
Jürg Lehni 2011-03-14 22:35:31 +01:00
parent 2fcca38a9c
commit ca9e70ade0

View file

@ -148,10 +148,11 @@ var PaperScript = new function() {
var onFrameLoop = eval('onFrameLoop');
if (onFrameLoop) {
function loop() {
// Request next frame already
Event.requestAnimationFrame(loop, doc && doc.canvas);
onFrameLoop();
// Automatically redraw document each frame.
doc && doc.redraw();
Event.requestAnimationFrame(loop, doc && doc.canvas);
}
Event.requestAnimationFrame(loop, doc && doc.canvas);
}