forked from web-animations/web-animations-js-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweb-animations-test.html
More file actions
99 lines (74 loc) · 2.11 KB
/
web-animations-test.html
File metadata and controls
99 lines (74 loc) · 2.11 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
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
<!--
Copyright 2012 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- TODO: Rewrite to avoid templates. -->
<!DOCTYPE html>
<style>
.anim {
top: 0px;
left: 0px;
width: 100px;
height: 100px;
background-color: #FAA;
position: absolute;
}
.red {
background-color: red;
}
.green {
background-color: green;
}
.blue {
background-color: blue;
}
#a {
top: 100px;
}
#b {
top: 200px;
}
#c {
top: 300px;
}
</style>
<div class="anim">
</div>
<div>
<div id="a" class="anim"></div>
<div id="b" class="anim"></div>
</div>
<div>
<div id="c" class="anim"></div>
</div>
<div class="group">
<div class="anim top red"></div>
<div class="anim right green"></div>
<div class="anim down blue"></div>
</div>
<script src="web-animations.js"></script>
<script>
new Anim(document.querySelector(".anim"), {left: ["100px", "200px"]},
{startDelay: 2, duration: 4}, undefined, 1);
var up = new AnimTemplate({top: ["200px", "0px"]}, 1, "selector: .top");
var right = new AnimTemplate({"left": ["0px", "200px"]},
{startDelay: 0.5, duration: 1}, "selector: .right");
var down = new AnimTemplate({top: ["0px", "200px"]},
{startDelay: 1, duration: 1}, "selector: .down");
var group = new ParAnimGroupTemplate([up, right, down]);
group.animate(document.querySelector(".group"), 0);
var group = new SeqAnimGroupTemplate([
new AnimTemplate({left: ["100px", "150px"]}, 1, "target: a"),
new AnimTemplate({left: ["100px", "150px"]}, 1, "target: b"),
new AnimTemplate({left: ["100px", "150px"]}, 1, "target: c")
]);
group.animate([[]], 0); // TODO fix this so that 0 children can be passed here.
</script>