mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Add #count to onFrame() event.
This commit is contained in:
parent
4cee442a05
commit
36c9286ca9
1 changed files with 5 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue