-
Notifications
You must be signed in to change notification settings - Fork 23
/
sequencing.html
97 lines (84 loc) · 2.29 KB
/
sequencing.html
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>tram.js example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="../support/styles/example.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="../node_modules/jquery/dist/jquery.min.js"><\/script>')</script>
<script src="../dist/tram.js"></script>
</head>
<body>
<p>
Sequencing demo. Click or tap to change the sequence.
</p>
<div class="funbox">
<div class="abs test"></div>
</div>
<script>
var $funbox = $('.funbox');
var $test = $('.test');
// define transitions
tram($test)
.add('background 0.7s ease')
.add('width 500ms ease-out-back')
.add('height 500ms ease-out-back')
.add('transform 300ms ease-out-quint')
;
// start first sequence
funtime();
// sequences
function funtime() {
tram($test)
.start({ x: 0, y: 0, width: 100, height: 100 })
.then({ x: 50, width: 200 })
.then({ y: 100, height: 200 })
.then({ x: 0, width: 50 })
.then(funtime)
;
}
function happytime() {
tram($test)
.start({ x: 100, y: 100, width: 200, height: 200, background: '#FF374E' })
.then({ x: 20 })
.then({ rotate: 90 })
.then({ rotate: 0 })
.then(happytime)
;
}
function breaktime() {
tram($test)
.start({ rotate: 0, background: '' })
.then(funtime)
;
}
function slower() {
tram($test)
.add('width 1s')
.add('height 1s')
.add('transform 800ms')
;
}
function faster() {
tram($test)
.add('width 500ms')
.add('height 500ms')
.add('transform 300ms')
;
}
// click events
var touch = 'ontouchstart' in window;
var clicks = 0;
$funbox.on(touch ? 'touchstart' : 'mousedown', function () {
switch (++clicks) {
case 1: happytime(); break;
case 2: slower(); break;
case 3: breaktime(); break;
case 4: faster(); clicks = 0; break;
}
});
</script>
</body>
</html>