-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path08c-Quiz-Animations-Answers.coffee
194 lines (140 loc) · 2.73 KB
/
08c-Quiz-Animations-Answers.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
###
Quiz-Animations answers
###
######################################## 7.01-ClickColor
box = new Layer
width:100
height:100
box.center()
box.onMouseDown ->
@animate
backgroundColor:"red"
######################################## 7.02-Basic Button
btn = new Layer
width:100
height:100
btn.center()
btn.onMouseOver ->
@animate
scale:1.1
backgroundColor:"red"
options:
time:0.25
btn.onMouseOut ->
@animate
scale:1.0
backgroundColor:"skyblue"
options:
time:0.25
btn.onMouseDown ->
@animate
rotation:10
options:
time:0.25
btn.onMouseUp ->
@animate
rotation:0
options:
time:0.25
######################################## 7.03-MoveToClick
bg = new Layer
width:Screen.width
height:Screen.height
backgroundColor: "skyblue"
layer = new Layer
backgroundColor:"white"
width:100
height:100
bg.onMouseDown (event)->
layer.animate
midX:event.pageX
midY:event.pageY
######################################## 7.04-Reveal Other
layer1 = new Layer
width:100
height:100
layer2 = new Layer
y:layer1.height + 1
width:100
height:100
opacity:0
height:0
layer1.onMouseDown ->
layer2.animate
opacity:1
height:100
######################################## 7.05-Slide Transition
bg1 = new Layer
width: Screen.width
height: Screen.height
backgroundColor: "skyblue"
bg2 = new Layer
width: Screen.width
height: Screen.height
x:Screen.width
backgroundColor: "pink"
bg1.onMouseDown ->
bg1.animate
backgroundColor: "black"
bg2.animate
x:0
bg2.onMouseDown ->
bg1.animate
backgroundColor: "skyblue"
bg2.animate
x:Screen.width
######################################## 7.06-Click plop
back = new Layer
width:Screen.width
height:Screen.height
backgroundColor: "skyblue"
back.onMouseDown (event)->
new Layer
width:100
height:100
backgroundColor:"white"
midX:event.pageX
midY:event.pageY
######################################## 7.07-Click plop animated
back = new Layer
width:Screen.width
height:Screen.height
backgroundColor: "skyblue"
back.onMouseDown (event)->
newLayer = new Layer
width:100
height:100
backgroundColor:"white"
midX:event.pageX
midY:event.pageY
rotation: 45
opacity:0
width:100
height:100
scale:0
newLayer.animate
rotation: 0
opacity:1
scale:1
######################################## 7.08-Click plop interactive
back = new Layer
width:Screen.width
height:Screen.height
backgroundColor: "skyblue"
back.onMouseDown (event)->
newLayer = new Layer
backgroundColor:"white"
midX:event.pageX
midY:event.pageY
width:100
height:100
newLayer.onMouseOut ->
@animate
scale:0.5
options:
time:0.25
newLayer.onMouseOver ->
@animate
scale:1
options:
time:0.25