Advertisement
lvs

Circular Transition

lvs
Sep 29th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.59 KB | None | 0 0
  1. local function sine(t, tMax, start, delta)
  2.     return math.sin(math.pi * 2 * t/tMax) * delta
  3. end
  4.  
  5. local function  cosine(t, tMax, start, delta)
  6.     return math.cos(math.pi * 2 * t/tMax) * delta
  7. end
  8.  
  9. display.setStatusBar(display.statusBarHidden)
  10. local square = display.newRect( 0, 0, 50, 50 )
  11. local _W, _H = display.contentWidth, display.contentHeight
  12.  
  13. square.x = _W * 0.5
  14. square.y = _H * 0.5
  15.  
  16. transition.to(square, {time = 1000, y = -100, delta = true, transition = sine, iterations = 10})
  17. transition.to(square, {time = 1000, x = -100, delta = true, transition = cosine, iterations = 10})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement