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

Tweens in a chain fire onActive twice per chain iteration #6773

Open
samme opened this issue Mar 21, 2024 · 0 comments
Open

Tweens in a chain fire onActive twice per chain iteration #6773

samme opened this issue Mar 21, 2024 · 0 comments

Comments

@samme
Copy link
Contributor

samme commented Mar 21, 2024

Version

  • Phaser Version: v3.80.1

Description

I thought tweens in a chain would fire onActive once per chain iteration, but instead they do it twice, or (in the loop iteration) all but the first tween do it twice.

Example Test Code

const onActive = function (tween, targets) {
    console.count(`onActive ${targets[0].name}`);
};

this.tweens.chain({
    loop: 1,
    onActive: function () { console.log('🔗 onActive Chain 🔗') },
    onLoop: function () { console.log('🔗 onLoop Chain 🔗') },
    tweens: [
        { targets: { name: 'A', value: 0 }, value: 1, onActive },
        { targets: { name: 'B', value: 0 }, value: 1, onActive },
        { targets: { name: 'C', value: 0 }, value: 1, onActive },
    ]
});
onActive A: 1
onActive B: 1
onActive C: 1
onActive A: 2
🔗 onActive Chain 🔗
onActive B: 2
onActive C: 2
onActive A: 3
onActive B: 3
onActive C: 3
🔗 onLoop Chain 🔗
onActive B: 4
onActive C: 4

I expected A, B, and C would each have a final count of 2. Instead A has 3 and B and C have 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants