Add #count to onFrame() event.

This commit is contained in:
Jürg Lehni 2011-05-15 18:08:41 +01:00
parent 4cee442a05
commit 36c9286ca9

View file

@ -154,8 +154,9 @@ var PaperScript = this.PaperScript = new function() {
// TODO: Move onFrame support to DocumentView // TODO: Move onFrame support to DocumentView
var onFrame = eval('onFrame'); var onFrame = eval('onFrame');
if (onFrame) { if (onFrame) {
var lastTime; var lastTime,
var totalTime = 0; totalTime = 0,
count = 0;
function frame(dontSwitch) { function frame(dontSwitch) {
if (!dontSwitch) if (!dontSwitch)
paper = scope; paper = scope;
@ -168,7 +169,8 @@ var PaperScript = this.PaperScript = new function() {
totalTime += delta; totalTime += delta;
onFrame({ onFrame({
delta: delta, delta: delta,
time: totalTime time: totalTime,
count: count++
}); });
// Automatically redraw document each frame. // Automatically redraw document each frame.
if (doc) if (doc)