Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion canvid.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
selector: '.canvid-wrapper'
},
firstPlay = true,
lastWait = 0,
control = {
play: function() {
console.log('Cannot play before images are loaded');
Expand Down Expand Up @@ -97,7 +98,7 @@
}

function frame() {
if (!wait) {
if (lastWait > wait) {
drawFrame(curFrame);
curFrame = (+curFrame + (reverse ? -1 : 1));
if (curFrame < 0) curFrame += +opts.frames;
Expand All @@ -110,6 +111,7 @@
}
}
}
lastWait = wait;
wait = (wait + 1) % delay;
if (playing && opts.frames > 1) requestAnimationFrame(frame);
}
Expand Down