-
-
Notifications
You must be signed in to change notification settings - Fork 885
Open
Labels
questionneeding further explanationsneeding further explanations
Description
mojs version 1.7.1 (CDN)
In the code below, create a new timeline and append 5 tweens to it.
And then play the timeline that repeats infinite times.
The tweens add 1 to 'counter' and set it to 0 at the end.
"counter" must be 0 or 1.
If counter reaches higher than 1, tween throws an error.
If the timeline is played properly, there should be no errors.
But it is there.
var counter = 0; // <-- This must be 0 or 1
var tm = new mojs.Timeline
(
{
repeat: 0,
onComplete: function()
{
tm.reset();
tm.play();
}
}
);
function newTween()
{
const t = new mojs.Tween
(
{
duration: 500,
easing: 'linear.none',
repeat: 0,
onStart: function()
{
counter ++;
console.log(counter);
if(counter > 1)
throw 'BAD!!'; // <-- This must not happen
},
onComplete: function()
{
counter = 0;
}
}
);
return t;
}
for(var i = 0; i < 5; i++)
{
tm.append(newTween());
}
tm.play();
Metadata
Metadata
Assignees
Labels
questionneeding further explanationsneeding further explanations