pixi-tween
pixi-tween copied to clipboard
Chained tweens are always added to manager
I was wondering why the tween count in the manager was rising and noticed that when I was chaining non-expiring tweens, they were added to the manager every time on tween end.
https://github.com/Nazariglez/pixi-tween/blob/master/src/Tween.js#L169
So maybe it should be checked here if the tween has a manager already.
Going to start using this lib... is this something I should look out for? Would it be a quick case of adding a check in the addTween function of TweenManager to see if the tween already exists in the array?
Hi guys! Sorry I forgot to answer this.
Each tween created is added to the manager as a unique entity, this way allow store differents tweens in vars and contact them later.
Other way will be store a json object with the tween data and use only one instance of tween, chaining this "configs". But I don't see this clear, I think is easiest now.
Finally came up against this issue - so I put a guard around adding to the manager. It now only does so if the tween wasn't already assigned to one - https://github.com/themoonrat/pixi-tween/commit/19400e7c17759821cf40480772d129c3231aea79#diff-6802f9302b04d546cb9ec4a1106ca6c0R189