-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
70 lines (62 loc) · 1.75 KB
/
demo.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Animatr Demo</title>
</head>
<body>
<h1>Animatr</h1>
<h2>Simple CSS3 Animation</h2>
<pre>
var anim = new Animatr('test', {
css: { background: 'red',
padding: '25px' }
});
</pre>
<div id="test">Test</div>
<h2>Animation with event listening and callbacks</h2>
<pre>
//Set a counter
var i=0;
var anim = new Animatr(document.querySelector('.test2'), {
css: { background: 'blue',
color: 'white' },
iterationCount: 12,
iterationCallback: function(e){ //Callback on completion of animation interation
i++;
this.innerHTML = 'Called ' + i + ' times';
},
startCallback: function(e){ //Callback on start of animation
this.innerHTML = 'Animation Start';
},
endCallback: function(e){ //Callback on end of animation
this.innerHTML = 'Animation End';
}
});
</pre>
<div class="test2">Test</div>
<script src="src/animatr.js"></script>
<script>
var anim = new Animatr('test', {
css: { background: 'red',
padding: '0 25px' }
});
//Set a counter
var i=0;
var anim = new Animatr(document.querySelector('.test2'), {
css: { background: 'blue',
color: 'white' },
iterationCount: 12,
iterationCallback: function(e){ //Callback on completion of animation interation
this.innerHTML = 'Iteration Called ' + ++i + ' times';
},
startCallback: function(e){ //Callback on start of animation
this.innerHTML = 'Animation Start';
},
endCallback: function(e){ //Callback on end of animation
this.innerHTML = 'Animation End: Iteration Called ' + i + ' times';
}
});
</script>
</body>
</html>