简体   繁体   中英

Updating transition.to in Corona SDK

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM