Commit 5510bcfd authored by S Anand's avatar S Anand

BUG: regression error: re-enable looping

parent 5648fee9
......@@ -104,8 +104,11 @@ $.fn.doodle = function(options) {
}
if (index >= length) {
if (typeof options.loop != 'undefined')
timeout_id = setTimeout(function() { self.doodle(options) }, options.loop * 1000)
return self.last().trigger('end.g.doodle')
timeout_id = setTimeout(function() {
self.last().trigger('stop').trigger('start', [0])
}, options.loop * 1000)
self.last().trigger('end.g.doodle')
return false
}
path = paths[index]
end_pos = path[WIDTH] + paths[index - 1][END_POS]
......@@ -113,14 +116,15 @@ $.fn.doodle = function(options) {
// Set its stroke offset
path[PATH].attr('stroke-dashoffset', path[PATH_LENGTH] * (end_pos - pos) / path[WIDTH])
return true
}
function tick() {
draw()
request_id = global.requestAnimationFrame(tick)
if (draw())
request_id = global.requestAnimationFrame(tick)
}
if (typeof options.start === 'undefined' || options.start)
$(this).eq(0).trigger('start.g.doodle', [0])
self.last().trigger('start.g.doodle', [0])
return self
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment