I am currently working on a lens which has the functionality of an object which tweens from one side of the screen to the other on tap, then returns on the second tap etc. I am setting start positions and end positions by running a global counter which flips between 0 and 1 to set this by using %2 (I also get 0 to 3 on the same counter using %4 for some other functionality).
I would like to dynamically add a tween to a scene object from the touch handler using something along the lines of:
var startPos = something;
var endPos = something else;
global.scene.rootObject(the object to move).addTween(new TWEEN.Tween(startPos).to(endPos..... etc.);
But I can't seem to work out how to dynamically target the object to add the tween. I have tween manager added in the objects, and the object I want to move has the tween.js script attached as a component. Is there a way to achieve this or some workaround?
Please sign in to leave a comment.