Multiple timeline events with once set to true, silently break the timeline and prevent all future events from firing.
class Example extends Phaser.Scene
{
create ()
{
const timeline = this.add.timeline();
for (let i=0; i<50; i++) {
timeline.add({
at: i * 20,
once: true, // comment out to get to fin
run: () => console.count('event #')
});
}
timeline.add({
from: 1000,
run: () => console.log('fin')
});
timeline.play();
}
}
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#2d2d2d',
parent: 'phaser-example',
scene: Example
};
const game = new Phaser.Game(config);
Version
Description
Multiple timeline events with once set to true, silently break the timeline and prevent all future events from firing.
Example Test Code
sandbox
Additional Information