https://www.youtube.com/watch?v=Q_jaQNGWDr0
If video doesn’t play, click YouTube button after reloading.
Probably NOT what you meant, but it does use transition and is a lot more flexible than what you’ve got above:
local function vecScale( x, y, s ) return x \*s, y \* s end local function angle2Vec( angle ) local screenAngle = math.rad( -(angle+90) ) return -math.cos( screenAngle ), math.sin( screenAngle ) end local function rotateAbout( obj, x, y, params ) x = x or display.contentCenterX y = y or display.contentCenterY params = params or {} local pathRadius = params.pathRadius or 50 obj.\_pathRot = params.startA or 0 local endA = params.endA or (obj.\_pathRot + 360 ) local time = params.time or 1000 local myEasing = params.myEasing or easing.linear -- Start at right position local vx,vy = angle2Vec( obj.\_pathRot ) vx,vy = vecScale( vx, vy, pathRadius ) obj.x = x + vx obj.y = y + vy obj.onComplete = function( self ) Runtime:removeEventListener( "enterFrame", self ) end obj.enterFrame = function ( self ) local vx,vy = angle2Vec( self.\_pathRot ) vx,vy = vecScale( vx, vy, pathRadius ) self.x = x + vx self.y = y + vy end Runtime:addEventListener( "enterFrame", obj ) transition.to( obj, { \_pathRot = endA, time = time, transition = myEasing, onComplete = obj } ) end
Try these options:
local tmp = display.newCircle( 0, 0, 5 ) --rotateAbout( tmp ) --rotateAbout( tmp, nil, nil, { time = 5000, myEasing = easing.outElastic } ) rotateAbout( tmp, nil, nil, { time = 2000, startA = 270, endA = 90, myEasing = easing.outBounce } )
More easings here: http://docs.coronalabs.com/daily/api/library/easing/index.html