-- building from StarCrunch's voodoo, replacing "curve"/etal.. function CubicBezierTransition(obj,x1,y1,x2,y2,x3,y3,x4,y4,time,tran) local t = 0 local function cubicBezier(a,b,c,d,t) local s = 1-t local ss = s\*s local tt = t\*t return ss\*s\*a + 3\*ss\*t\*b + 3\*s\*tt\*c + tt\*t\*d end local proxy = setmetatable({},{ \_\_index = function() return t end, \_\_newindex = function(\_,\_,v) t = v; obj.x, obj.y = cubicBezier(x1,x2,x3,x4,t), cubicBezier(y1,y2,y3,y4,t) end }) return transition.to(proxy, {t=1, time=time, transition=tran}) end local obj1 = display.newRect(0,0,10,10) obj1:setFillColor(1,0,0) local obj2 = display.newRect(0,0,10,10) obj2:setFillColor(0,1,0) local obj3 = display.newRect(0,0,10,10) obj3:setFillColor(0,0,1) local obj4 = display.newRect(0,0,10,10) obj4:setFillColor(1,0,1) -- nb: bezier coords assume 320x480 screen, a lazy/loose "Z" -- linear CubicBezierTransition(obj1, 10,100, 300,200, 10,300, 300,400, 5000, easing.linear) -- eased CubicBezierTransition(obj2, 10,100, 300,200, 10,300, 300,400, 5000, easing.inCubic) -- double-speed there and back again linearly -- (just for contrast against custom ease below) CubicBezierTransition(obj3, 10,100, 300,200, 10,300, 300,400, 5000, easing.continuousLoop) function easingSinLoop(t,tmax,start,delta) return start+math.sin(t/tmax\*math.pi)\*delta end -- custom-eased, double-speed there and back again smoothed CubicBezierTransition(obj4, 10,100, 300,200, 10,300, 300,400, 5000, easingSinLoop)