transition.to() , but in a circular path

Hi , 

Corona is a fantastic sdk. Just love the ease f of use.

Wanted to know if there is a way to achieve the following in easier way

Refer attachment, 

I want to move a circle to a destination in a circular path using transition.to. Once way is to put the transition.to in a loop and feed the locus/equation of a circle. I am not an expert in bezier either. is there a better and a easier way to achieve this ? i want transition.to since i want the movement over a time (of course :slight_smile: )

Appreciate any help!

You can achieve this with three transitions:

--startX/startY = starting position --R = the radius of the circular movement --t = time to travel this half circle transition.to( object, {time=t, y=startY-2\*R, transition=easing.inOutSine } ) transition.to( object, {time=t\*.5, x=startX-R, transition=easing.outSine, onComplete=function() transition.to( object,{ time=t\*.5, x=startX, transition=easing.inSine } ) end } )  

PS, if you don’t have a new version of Corona which includes Transitions 2.0 you won’t have the sine easing functions… you can use inOutQuad, inQuad and outQuad instead with very similar results…

Works like Charm! Thanks gtt :slight_smile:

That’s a good solution, but it can make it simpler on one line if you change the object’s center point reference

local radius = 100

local term = 2000

rec1 = display.newRect (100,100,10,10)

rec1.xReference = radius

transition.to (rec1, {time =term, rotation = 360})  

just wanted to chime in to thank gtt for the code.  I came across a need for this today. The transitions 2.0 were a much needed and appreciated update… along with all the other great graphic 2.0 stuff.

thanks again.

You can achieve this with three transitions:

--startX/startY = starting position --R = the radius of the circular movement --t = time to travel this half circle transition.to( object, {time=t, y=startY-2\*R, transition=easing.inOutSine } ) transition.to( object, {time=t\*.5, x=startX-R, transition=easing.outSine, onComplete=function() transition.to( object,{ time=t\*.5, x=startX, transition=easing.inSine } ) end } )  

PS, if you don’t have a new version of Corona which includes Transitions 2.0 you won’t have the sine easing functions… you can use inOutQuad, inQuad and outQuad instead with very similar results…

Works like Charm! Thanks gtt :slight_smile:

That’s a good solution, but it can make it simpler on one line if you change the object’s center point reference

local radius = 100

local term = 2000

rec1 = display.newRect (100,100,10,10)

rec1.xReference = radius

transition.to (rec1, {time =term, rotation = 360})  

just wanted to chime in to thank gtt for the code.  I came across a need for this today. The transitions 2.0 were a much needed and appreciated update… along with all the other great graphic 2.0 stuff.

thanks again.