-
Notifications
You must be signed in to change notification settings - Fork 5
/
app.js
67 lines (60 loc) · 1.23 KB
/
app.js
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
var block1 = new Layer({
width: 100,
height: 100,
x: 50,
y: 50,
style: { backgroundColor: utils.randomColor(0.8) }
});
var block2 = new Layer({
width: 100,
height: 100,
x: 50,
y: 200,
style: { backgroundColor: utils.randomColor(0.8) }
});
var block3 = new Layer({
width: 100,
height: 100,
x: 50,
y: 350,
style: { backgroundColor: utils.randomColor(0.8) }
});
var block4 = new Layer({
width: 100,
height: 100,
x: 50,
y: 500,
style: { backgroundColor: utils.randomColor(0.8) }
});
block1.on('click', function() {
block1.animate({
aid: 'Block 1 Animation',
properties: { x: (block1.x > 50 ? 50 : 300) },
curve: 'spring(200,20,0)'
})
});
block2.on('click', function() {
block2.animate({
aid: 'Block 2 Animation',
properties: { x: (block2.x > 50 ? 50 : 300) },
curve: 'ease-in-out',
time: 0.5
})
});
block3.on('click', function() {
block3.animate({
aid: 'Block 3 Animation',
properties: { x: (block3.x > 50 ? 50 : 300) },
curve: 'bezier-curve(.42, 1, .42, 1)',
time: 0.5,
delay: 0.1
})
});
block4.on('click', function() {
block4.animate({
aid: 'Block 4 Animation',
properties: { x: (block4.x > 50 ? 50 : 300) },
curve: 'spring',
curveOptions: { tension: 200, friction: 20, velocity: 0 }
})
});