Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tween has chance to be played 2 times rapidly in a timeline. #276

Open
seafloyd16 opened this issue Oct 11, 2023 · 3 comments
Open

Tween has chance to be played 2 times rapidly in a timeline. #276

seafloyd16 opened this issue Oct 11, 2023 · 3 comments
Labels
question needing further explanations

Comments

@seafloyd16
Copy link

seafloyd16 commented Oct 11, 2023

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();
@xavierfoucrier
Copy link
Member

Hello @seafloyd16 👋

Thanks for opening an issue.

Unfortunately I haven't much time to check this in the next few days, may be this weekend..
I will let you know anyway and give the appropriate answer 😉

@xavierfoucrier xavierfoucrier self-assigned this Dec 29, 2023
@xavierfoucrier xavierfoucrier added the question needing further explanations label Dec 29, 2023
@xavierfoucrier
Copy link
Member

Hello @seafloyd16 👋

Sorry for the late reply.
I can reproduce on my side, but I am not sure about what you are trying to do, may be you can explain?

Thanks!

@xavierfoucrier
Copy link
Member

Ping @seafloyd16 🔔

@xavierfoucrier xavierfoucrier removed their assignment May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question needing further explanations
Projects
None yet
Development

No branches or pull requests

2 participants