Changing Transition Parameter

Hello,

I wonder if we can change a transition parameter while it’s being processed. For e.g. a shape is moving from y = 0 to y = 300,

before being completed, can we change the y parameter as 350?

Thanks.

I would suggest capturing the current y , canceling the transition and creating a new one. You might want to store the timestamp to get the elapsed time:

local newY = 300 object.transStart = system.getTimer() object.transAction = transition.to( object, { time = 2000, y = newY } ) ... newY = 350 local getTimer = system.getTimer() if getTimer - object.transStart \< 2000 then transition.cancel( object.transAction ) local remainingTime = getTimer - object.transStart object.transStart = getTimer object.transAction = transition.to( object, { time = 2000 - remainingTime, y = newY } ) end

See if that works.

Yes, it works. Very small stop and acceleration occurs, but to see, need to look carefully.

Thanks.

I would suggest capturing the current y , canceling the transition and creating a new one. You might want to store the timestamp to get the elapsed time:

local newY = 300 object.transStart = system.getTimer() object.transAction = transition.to( object, { time = 2000, y = newY } ) ... newY = 350 local getTimer = system.getTimer() if getTimer - object.transStart \< 2000 then transition.cancel( object.transAction ) local remainingTime = getTimer - object.transStart object.transStart = getTimer object.transAction = transition.to( object, { time = 2000 - remainingTime, y = newY } ) end

See if that works.

Yes, it works. Very small stop and acceleration occurs, but to see, need to look carefully.

Thanks.