OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2012 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 | |
17 <!DOCTYPE html><meta charset="UTF-8"> | |
18 <style> | |
19 .animContainer { | |
20 position: absolute; | |
21 left: 0px; | |
22 height: 100px; | |
23 } | |
24 | |
25 .anim { | |
26 left: 0px; | |
27 width: 100px; | |
28 height: 25px; | |
29 background-color: #FAA; | |
30 position: relative; | |
31 } | |
32 | |
33 .expected { | |
34 border-right: 1px solid black; | |
35 } | |
36 | |
37 .a { | |
38 top: 0px | |
39 } | |
40 | |
41 .b { | |
42 top: 0px; | |
43 } | |
44 | |
45 .c { | |
46 top: 0px; | |
47 } | |
48 | |
49 .d { | |
50 top: 0px; | |
51 } | |
52 | |
53 #ca { | |
54 top: 50px; | |
55 } | |
56 | |
57 #cb { | |
58 top: 200px; | |
59 } | |
60 | |
61 #cc { | |
62 top: 350px; | |
63 } | |
64 | |
65 | |
66 #cd { | |
67 top: 500px; | |
68 } | |
69 </style> | |
70 | |
71 <div>Right edge of each box should align with black line at end of test.</div> | |
72 | |
73 <div class="animContainer" id="ca"> | |
74 <div style="width: 100px;" class="expected"><div class="anim a" id="a"></div> | |
75 </div> | |
76 <div style="width: 100px;" class="expected"><div class="anim b" id="b"></div> | |
77 </div> | |
78 <div style="width: 300px;" class="expected"><div class="anim c" id="c"></div> | |
79 </div> | |
80 <div style="width: 300px;" class="expected"><div class="anim d" id="d"></div> | |
81 </div> | |
82 </div> | |
83 | |
84 <div class="animContainer" id="cb"> | |
85 <div style="width: 100px;" class="expected"><div class="anim a" id="e"></div> | |
86 </div> | |
87 <div style="width: 200px;" class="expected"><div class="anim b" id="f"></div> | |
88 </div> | |
89 <div style="width: 100px;" class="expected"><div class="anim c" id="g"></div> | |
90 </div> | |
91 <div style="width: 200px;" class="expected"><div class="anim d" id="h"></div> | |
92 </div> | |
93 </div> | |
94 | |
95 <div class="animContainer" id="cc"> | |
96 <div style="width: 100px;" class="expected"><div class="anim a" id="i"></div> | |
97 </div> | |
98 <div style="width: 100px;" class="expected"><div class="anim b" id="j"></div> | |
99 </div> | |
100 <div style="width: 300px;" class="expected"><div class="anim c" id="k"></div> | |
101 </div> | |
102 <div style="width: 300px;" class="expected"><div class="anim d" id="l"></div> | |
103 </div> | |
104 </div> | |
105 | |
106 <div class="animContainer" id="cd"> | |
107 <div style="width: 100px;" class="expected"><div class="anim a" id="m"></div> | |
108 </div> | |
109 <div style="width: 200px;" class="expected"><div class="anim b" id="n"></div> | |
110 </div> | |
111 <div style="width: 100px;" class="expected"><div class="anim c" id="o"></div> | |
112 </div> | |
113 <div style="width: 200px;" class="expected"><div class="anim d" id="p"></div> | |
114 </div> | |
115 </div> | |
116 | |
117 <div style="height: 700px"></div> | |
118 | |
119 <script src="../bootstrap.js"></script> | |
120 <script> | |
121 "use strict"; | |
122 | |
123 var fills = ["none", "backwards", "forwards", "both"]; | |
124 var categories = [".a", ".b", ".c", ".d"] | |
125 | |
126 var directions = ["normal", "reverse", "alternate", "alternate-reverse"] | |
127 var groups = []; | |
128 | |
129 for (var i = 0; i < directions.length; i++) { | |
130 var dir = directions[i]; | |
131 groups.push(new AnimationGroup([], { | |
132 delay: 1 * 1000, | |
133 duration: 8 * 1000, | |
134 iterations: 3, | |
135 playbackRate: 2, | |
136 direction: dir, | |
137 fill: 'forwards', | |
138 })); | |
139 } | |
140 | |
141 function sampleFunc(timeFraction, target, animation) { | |
142 target.innerHTML = Math.floor(timeFraction * 1000) / 1000 + " : " + animation.
currentIteration; | |
143 } | |
144 | |
145 for (var i = 0; i < fills.length; i++) { | |
146 var divs = document.querySelectorAll(categories[i]); | |
147 for (var j = 0; j < divs.length; j++) { | |
148 groups[j].append(new Animation(divs[j], [{left: "100px"}, {left: "200px"}],
{ | |
149 delay: 1 * 1000, | |
150 duration: 1 * 1000, | |
151 iterations: 2, | |
152 fill: fills[i], | |
153 playbackRate: 0.8 | |
154 })); | |
155 groups[j].append(new Animation(divs[j], sampleFunc, { | |
156 delay: 1 * 1000, | |
157 duration: 1 * 1000, | |
158 iterations: 2, | |
159 fill: fills[i], | |
160 playbackRate: 0.8 | |
161 })); | |
162 } | |
163 } | |
164 for (var j = 0; j < divs.length; j++) { | |
165 document.timeline.play(groups[j]); | |
166 } | |
167 </script> | |
OLD | NEW |