-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.coffee
More file actions
49 lines (37 loc) · 1.1 KB
/
example.coffee
File metadata and controls
49 lines (37 loc) · 1.1 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
41
42
43
44
45
46
47
48
49
# Create setting (with built-in components)
# ----------------------------------------------------------
# Create ScrollComponent
myScrollComponent = new ScrollComponent
frame: Screen.frame
scrollHorizontal: false
# Create container
myContainer = new Layer
parent: myScrollComponent.content
width: Screen.width
height: Screen.height*2
backgroundColor: null
# Create layer
myLayer = new Layer
parent: myContainer
point: Align.center
# Create controller and add scene, tween and pin
# ----------------------------------------------------------
# Create controller
myController = new ScrollController
source: myScrollComponent
# Add scene
myScene = myController.addScene
triggerLayer: myLayer
duration: 200
guide: true
# Add tweeen
myTween = myScene.addTween
to: {rotation: -90, scale: 0.2, backgroundColor: "#00AAFF"}
options: {time: 0.25, curve: "Spring"}
# Add pin
myPin = myScene.addPin()
# Listen for events with callback
# ----------------------------------------------------------
# Listen for event with callback
myScene.onProgress (event, instance) ->
myTextLayer.text = "#{event.progress}"