-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.lua
More file actions
40 lines (33 loc) · 1.46 KB
/
main.lua
File metadata and controls
40 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- ************************************************************************************************************************************************************************
---
--- Name : main.lua
--- Purpose : Demo for transaction library.
--- Created: 30 April 2014
--- Author: Paul Robson (paul@robsons.org.uk)
--- License: MIT
---
--- ************************************************************************************************************************************************************************
local transitions = require("system.transitions")
--
-- Function creates a "scene" (a displayGroup) which is slightly different so I've something to work with
--
function createScene(n)
local grp = display.newGroup()
local square = display.newRect(160,n*100+100,130+n*70,200)
square:setFillColor(0,0,(n+1)/4)
square.strokeWidth = n*4
local text = display.newText("Scene # "..n,160,n*100+100,native.systemFont,32)
text:setFillColor( n,1-n,0 )
grp:insert(square)
grp:insert(text)
return grp
end
scene1 = createScene(1) -- create two scenes
scene2 = createScene(2)
local recipient = {} -- create an object to receive the message
function recipient:transitionCompleted()
scene1.isVisible = false -- hide the from scene. The system doesn't (deliberate)
print("Done !")
end
tt = "flip" -- name a transition
transitions:execute(tt,recipient,scene1,scene2,1000) -- and do it.