Transition 2

Features demonstrated:

A sequence of transitions.

Code:

1
2
3
4
5
6
7
8
9
10
11
12
local square = display.newRect( 0, 0, 100, 100 )
square:setFillColor( 255,255,255 )
 
local w,h = display.contentWidth, display.contentHeight
 
-- move square to bottom right corner; subtract half side-length b/c 
-- the local origin is at the square’s center; fade out square
transition.to( square, { time=1500, alpha=0, x=(w-50), y=(h-50) } )
 
-- fade square back in after 2.5 seconds
transition.to( square, { time=500, delay=2500, alpha=1.0 } )