doubt transition.to

Hi

I’m using  “transition.to” to move an object from x=0 to x=300.

is there a way to identify or to trigger a event at x=150?

At present i’m using timer but not working perfectly as i’m moving too many objects.

~Sudheer 

Edit:

What I would recommend (your using Transition 1.0) would be to set up a runtime listener that tracks all of your objects. When an object reaches the desired position (150 in your case) execute a function of your choosing.

There is also other method, but is rather advanced.

You can make custom setter/getter for property and override x property with it. Transition.to will call this method then trying to set x so you could perform some action.

If you are not using any easing in your transition, you could just do a transition to 150, then have an oncomplete that triggers your event and sets up another transition from 150 to 300.

local function triggerHalfway(obj) print("reached halfway point, let's do some stuff") transition.to(obj, {x = 300, time = 500}) end transition.to(myObject, {x = 150, time = 500, onComplete = triggerHalfway})

Edit:

What I would recommend (your using Transition 1.0) would be to set up a runtime listener that tracks all of your objects. When an object reaches the desired position (150 in your case) execute a function of your choosing.

There is also other method, but is rather advanced.

You can make custom setter/getter for property and override x property with it. Transition.to will call this method then trying to set x so you could perform some action.

If you are not using any easing in your transition, you could just do a transition to 150, then have an oncomplete that triggers your event and sets up another transition from 150 to 300.

local function triggerHalfway(obj) print("reached halfway point, let's do some stuff") transition.to(obj, {x = 300, time = 500}) end transition.to(myObject, {x = 150, time = 500, onComplete = triggerHalfway})