phaser4-rex-plugins
Version:
14 lines (11 loc) • 387 B
JavaScript
var AutoRemoveTween = function (gameObject, config) {
var scene = gameObject.scene;
config.targets = gameObject;
var tween = scene.tweens.add(config);
gameObject.once('destroy', tween.remove, tween);
tween.once('complete', function () {
gameObject.off('destroy', tween.remove, tween);
})
return tween;
}
export default AutoRemoveTween;