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 } | |
23 | |
24 .anim { | |
25 left: 0px; | |
26 width: 100px; | |
27 height: 25px; | |
28 background-color: #FAA; | |
29 position: relative; | |
30 } | |
31 | |
32 .expected { | |
33 border-right: 1px solid black; | |
34 } | |
35 | |
36 #normal { | |
37 top: 50px; | |
38 } | |
39 | |
40 #reverse { | |
41 top: 150px; | |
42 } | |
43 | |
44 #alternate { | |
45 top: 250px; | |
46 } | |
47 | |
48 #alternate-reverse { | |
49 top: 350px; | |
50 } | |
51 | |
52 </style> | |
53 | |
54 <div>Right edge of each box should align with black line at end of test. Note | |
55 that the position of the last element in each group is approximate.</div> | |
56 | |
57 <div class="animContainer" id="normal"> | |
58 <div style="width: 600px;" class="expected"><div id="normal_a" class="anim"></
div></div> | |
59 <div style="width: 600px;" class="expected"><div id="normal_b" class="anim"></
div></div> | |
60 </div> | |
61 | |
62 <div class="animContainer" id="reverse"> | |
63 <div style="width: 200px;" class="expected"><div id="reverse_a" class="anim"><
/div></div> | |
64 <div style="width: 200px;" class="expected"><div id="reverse_b" class="anim"><
/div></div> | |
65 </div> | |
66 | |
67 <div class="animContainer" id="alternate"> | |
68 <div style="width: 200px;" class="expected"><div id="alternate_a" class="anim"
></div></div> | |
69 <div style="width: 200px;" class="expected"><div id="alternate_b" class="anim"
></div></div> | |
70 </div> | |
71 | |
72 <div class="animContainer" id="alternate-reverse"> | |
73 <div style="width: 600px;" class="expected"><div id="alternate-reverse_a" clas
s="anim"></div></div> | |
74 <div style="width: 600px;" class="expected"><div id="alternate-reverse_b" clas
s="anim"></div></div> | |
75 </div> | |
76 | |
77 <script src="../bootstrap.js"></script> | |
78 <script> | |
79 "use strict"; | |
80 | |
81 var directions = ["normal", "reverse", "alternate", "alternate-reverse"]; | |
82 | |
83 var animation = [{left: "100px"}, {left: "500px"}]; | |
84 | |
85 for (var i = 0; i < directions.length; i++) { | |
86 var direction = directions[i]; | |
87 var container = document.getElementById(direction); | |
88 | |
89 // Interaction of default start time with parent iterations. At the time of | |
90 // addition, the child picks up a start time of zero. The parent then updates | |
91 // its duration and its iteration time jumps, causing the child to start | |
92 // playing part way through the animation. | |
93 var intrinsicGroup = new AnimationGroup([], {iterations: 2.0, direction: direc
tion}); | |
94 document.timeline.play(intrinsicGroup); | |
95 var fixedGroup = new AnimationGroup([], {iterations: 2.0, direction: direction
, duration: 4.0 * 1000}); | |
96 document.timeline.play(fixedGroup); | |
97 | |
98 timing_test(function() { | |
99 at(0.75 * 1000, (function(container, direction, intrinsicGroup, fixedGroup
) { | |
100 return function() { | |
101 intrinsicGroup.append(new Animation(document.getElementById(direction
+ '_a'), animation, {duration: 1.0 * 1000, fill: 'forwards'})); | |
102 fixedGroup.append(new Animation(document.getElementById(direction + '_
b'), animation, {duration: 1.0 * 1000, fill: 'forwards'})); | |
103 }; | |
104 })(container, direction, intrinsicGroup, fixedGroup)); | |
105 }); | |
106 } | |
107 </script> | |
OLD | NEW |