diff --git a/src/util/PaperScript.js b/src/util/PaperScript.js index 121d0bd5..9b74a6a8 100644 --- a/src/util/PaperScript.js +++ b/src/util/PaperScript.js @@ -154,15 +154,18 @@ var PaperScript = this.PaperScript = new function() { DomEvent.requestAnimationFrame(frame, doc && doc.canvas); onFrame(); // Automatically redraw document each frame. - doc && doc.redraw(); - } - DomEvent.requestAnimationFrame(frame, doc && doc.canvas); + if (doc) + doc.redraw(); + }; + // Call the onFrame handler and redraw the document: + frame(); + } else { + // Automatically redraw document at the end. + if (doc) + doc.redraw(); } } catch (e) { } - // Automatically redraw document at the end. - if (doc) - doc.redraw(); return res; } }