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 looping chain fire onStart only once #6768

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

Tweens in a looping chain fire onStart only once #6768

samme opened this issue Mar 14, 2024 · 0 comments

Comments

@samme
Copy link
Contributor

samme commented Mar 14, 2024

Version

  • Phaser Version: 3.80.1

Description

In a looping chain, tweens fire onStart only once.

Example Test Code

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

const onComplete = function (tween, targets) {
  console.count(`onComplete ${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, onStart, onComplete },
    { targets: { name: 'B', value: 0 }, value: 1, onStart, onComplete },
    { targets: { name: 'C', value: 0 }, value: 1, onStart, onComplete },
  ],
});
🔗 onActive Chain 🔗
onStart A: 1
onComplete A: 1
onStart B: 1
onComplete B: 1
onStart C: 1
onComplete C: 1
🔗 onLoop Chain 🔗
onComplete A: 2
onComplete B: 2
onComplete C: 2

Each tween fires 1 onStart instead of 2.

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