From ca9e70ade0c33d52d4013dc0cec368f59984ac5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 14 Mar 2011 22:35:31 +0100 Subject: [PATCH] Request next animation frame at beginning of callback. --- src/util/PaperScript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/util/PaperScript.js b/src/util/PaperScript.js index 90bd964a..727da8fc 100644 --- a/src/util/PaperScript.js +++ b/src/util/PaperScript.js @@ -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); }