to sort transition.to

Hi All,

i want use 2 transition. When finish first transition than second transition should start.

for example:

[lua] transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2 } )
transition.to( myObj, { time=500, alpha=1,xScale=0.5, yScale = 0.5 } )
[/lua]

But transitions working simultane. 

is there any option to sort the transitions?

Yes there are a few ways. Transitions can call another function when they are completed, like so:

local function secondTransition() transition.to( myObj, { time=500, alpha=1,xScale=0.5, yScale = 0.5 } ) end transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2, onComplete = secondTransition } )

Or you could use timer.performWithDelay to delay the second transition by a certain amount of time:

local function secondTransition() transition.to( myObj, { time=500, alpha=1,xScale=0.5, yScale = 0.5 } ) end transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2} ) timer.performWithDelay(1000, secondTransition, 1)

And don’t forget the delay parameter for transitions :slight_smile:

[lua]transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2 } )

transition.to( myObj, { delay = 1000, time=500, alpha=1,xScale=0.5, yScale = 0.5 } )[/lua]

AlanPlantPot  and  jonjonsson,

Thank you very much  :) 

Yes there are a few ways. Transitions can call another function when they are completed, like so:

local function secondTransition() transition.to( myObj, { time=500, alpha=1,xScale=0.5, yScale = 0.5 } ) end transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2, onComplete = secondTransition } )

Or you could use timer.performWithDelay to delay the second transition by a certain amount of time:

local function secondTransition() transition.to( myObj, { time=500, alpha=1,xScale=0.5, yScale = 0.5 } ) end transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2} ) timer.performWithDelay(1000, secondTransition, 1)

And don’t forget the delay parameter for transitions :slight_smile:

[lua]transition.to( myObj, { time=1000, alpha=1,xScale=2, yScale = 2 } )

transition.to( myObj, { delay = 1000, time=500, alpha=1,xScale=0.5, yScale = 0.5 } )[/lua]

AlanPlantPot  and  jonjonsson,

Thank you very much  :)