-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.coffee
64 lines (56 loc) · 1.27 KB
/
app.coffee
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Create PageComponent
pageScroller = new PageComponent
y: Align.bottom(-25)
x: Align.center
width: Screen.width / 4
height: 14
scrollVertical: false
clip: false
pageName = (index) ->
switch index
when 0 then return "Live"
when 1 then return "Normal"
when 2 then return "Boomerang"
when 3 then return "Superzoom"
when 4 then return "Rewind"
when 5 then return "Hands-free"
# Loop to create pages
for index in [0...6]
page = new TextLayer
size: pageScroller.size
text: pageName(index)
fontSize: 14
fontWeight: "600"
textAlign: "center"
textTransform: "uppercase"
color: "#FFF"
x: (pageScroller.width + 30) * index
parent: pageScroller.content
shadow1:
y: 0
x: 0
blur: 3
color: "hsla(0, 0%, 0%, 0.73)"
page.onClick ->
pageScroller.snapToPage(this)
tap.states =
normal:
width: 55
animationOptions:
curve: Bezier.ease
time: 0.2
live:
width: 200
x: Align.center
animationOptions:
curve: Bezier.ease
time: 0.2
tap.stateSwitch("normal")
pageScroller.snapToPage(pageScroller.content.children[1], false)
pageScroller.on "change:currentPage", ->
if pageScroller.currentPage is pageScroller.content.children[0]
tap.animate("live")
tap_overlay.opacity = 0
else
tap.animate("normal")
tap_overlay.opacity = 1