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 .anim { | |
20 fill: lightsteelblue; | |
21 background-color: lightsteelblue; | |
22 height: 50px; | |
23 position: absolute; | |
24 } | |
25 | |
26 .expectation { | |
27 background-color: red; | |
28 position: absolute; | |
29 left: 0px; | |
30 height: 50px; | |
31 } | |
32 | |
33 .container { | |
34 position: relative; | |
35 width: 2in; | |
36 height: 50px; | |
37 } | |
38 | |
39 #test { | |
40 font-size: 2rem; | |
41 } | |
42 | |
43 </style> | |
44 | |
45 Each cell in the table will start at the first value for the column (e.g. 5em, | |
46 5ex, 50px, etc.), then animate to the second value for the column (e.g. 1em, | |
47 1ex, etc.), then animate to the 'to' value for the row. | |
48 | |
49 <table id="test"></table> | |
50 | |
51 <script> | |
52 var expected_failures = [ | |
53 { | |
54 browser_configurations: [ | |
55 { firefox: true }, | |
56 { msie: true }, | |
57 ], | |
58 tests: ['Autogenerated'], | |
59 message: 'Floating point issues.', | |
60 } | |
61 ]; | |
62 </script> | |
63 <script src="../bootstrap.js"></script> | |
64 <script> | |
65 "use strict"; | |
66 | |
67 | |
68 // ex is font specific and there is no common webfont found on *all* browsers | |
69 // (including mobile). | |
70 var from = ["1em", "10px", "1rem", "5mm", "1cm", "1in", "10pt", "1pc"]; | |
71 var to = ["5em", "50px", "5rem", "25mm", "2cm", "2in", "50pt", "5pc"]; | |
72 | |
73 var table = "<tr><td>from -><br>to v</td>" | |
74 for (var i = 0; i < from.length; i++) { | |
75 table += "<td>" + to[i] + "<br>" + from[i] + "</td>"; | |
76 } | |
77 table += "</tr>" | |
78 | |
79 var anims = {} | |
80 | |
81 for (var j = 0; j < to.length; j++) { | |
82 var toVal = to[j]; | |
83 table += "<tr><td>" + toVal + "</td>"; | |
84 for (var i = 0; i < from.length; i++) { | |
85 var fromVal = from[i]; | |
86 var id = 'a' + toVal + fromVal; | |
87 table += | |
88 "<td><div class='container'><div class='expectation' style='width: " + | |
89 toVal + "'</div><div id="+id+" class='anim'></div></div></td>"; | |
90 anims['#' + id] = [{width: to[i]}, {width: fromVal}, {width: toVal}]; | |
91 } | |
92 table += "</tr>" | |
93 } | |
94 | |
95 document.querySelector("table").innerHTML = table; | |
96 </script> | |
97 <script> | |
98 "use strict"; | |
99 for (var id in anims) { | |
100 document.timeline.play( | |
101 new Animation(document.querySelector(id), anims[id], {duration: 2 * 1000,
fill: 'forwards'})); | |
102 } | |
103 </script> | |
OLD | NEW |