Jump to content

dynamically adding a tweendata to a tween object


L2L2L
 Share

Recommended Posts

I am trying to add a tweendata dynamically to an tween object, while the tween object property isRunning set to true. I figure a solution for my problem out. But I feel I should be able to get this to work too. Have a look and please get back to me on what is missing.



 ()=>{
var child = new Phaser.TweenData(tween);
child.from({x: child.target.position.x, y:child.target.position.y}).to({x:-75,y:75}, 1000, Phaser.Easing.Circular.InOut,0,0,true);
tween.timeline.push(child);
child.parent.onComplete.addOnce(()=> (target, tween){
console.log('tween:',tween, 'target:',target);
//try calling child.start() to run it manually here, 
//...remove child from tween to stop repeat. if you know a better way via library 'Phaser' to do this, please share. 
});
}

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...