Skip to content

scene.tweens.killTweensOf(myArray, myObject) doesnt kill tweens on myArray objects #6016

@michalfialadev

Description

@michalfialadev

Ive got some container objects im running tweens on, and an array of container objects im running tweens on. Then always before i start running these tweens, i call killTweensOf on all of those objects, to ensure they are cleared (in case tweens are already running on them), like this:
myScene.tweens.killTweensOf([ this.screenOverlay, this.categoryButtons, this.closeBtn ]);
The above code does not clear the running tweens on categoryButtons, which is an array of buttons, which are tweened with a stagger. However, the way i run tweens on those buttons is that i simply put them into targets like this:
targets:this.categoryButtons

The following code does clear those tweens running on those buttons:
myScene.tweens.killTweensOf([ this.screenOverlay, ...this.categoryButtons, this.closeBtn ]);

But it conflicts with the way one would think it should work (spread or iteration to happen automatically on Phaser's side - just like in case when we define tweening [we do not have to use targets:[...this.categoryButtons] there).

EDIT: I just noticed that killTweensOf([]) is called on an array of objects, so prob. thats why Phaser does expect it to be already an array of individual objects, not an array of arrays of arrays... to process the objects recursively. Feel free to close the issue, if its a moot point.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions