0
votes

Simple question but I can't figure it out.

In a function I have this:

 transition.to( object, { time=300, alpha=1, tag= "moveObject", x=500, y=50, onComplete= end } )

I have a function that I want to use to update the transition when it's still "alive".

Function updateObject(tagname)
--update the transition.to x with +50

End

How can I update the transition in the function ?

1

1 Answers

0
votes

You should cancel the transition and create a new one. To cancel it you have to save it. Example:

local toX = 500
local yourTrans = transition.to( object, {x=toX, ... })

...

function updateObject(tagname)
    --update the transition.to x with +50
    transition.cancel(yourTrans)
    toX = toX + 50
    yourTrans = transition.to( object, {x=toX, ... })
end