Reputation: 13
I am trying to countinually alternate between two cycles using progressbar.js. Nothing happens when I run this code, even though it works fine when I am not trying to repeat. Any suggestions?
$(document).ready(function() {
var timer = new ProgressBar.Circle('#progress', {
easing: 'linear',
strokeWidth: 3,
trailWidth: 1,
color: '#ff9900'
});
function loop() {
timer.set(0);
timer.setText('Work');
timer.animate(1, {
duration: 25000
}, function() {
timer.set(0);
timer.setText('Break');
timer.animate(1, {
duration: 5000
},loop);
});
loop();
}
});
Upvotes: 0
Views: 825
Reputation: 1050
function loop() {
timer.set(0);
timer.setText('Work');
timer.animate(1, {
duration: 25000
}, function() {
timer.set(0);
timer.setText('Break');
timer.animate(1, {
duration: 5000
},loop);
});
loop(); //remove
}
loop();//add
Upvotes: 1