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 left: 0px; |
| 21 width: 30px; |
| 22 height: 30px; |
| 23 background-color: lightsteelblue; |
| 24 position: absolute; |
| 25 } |
| 26 |
| 27 .expected { |
| 28 width: 30px; |
| 29 height: 30px; |
| 30 position: absolute; |
| 31 background-color: red; |
| 32 } |
| 33 </style> |
| 34 <div></div> |
| 35 <div style="height: 600px;"></div> |
| 36 <script src="../bootstrap.js"></script> |
| 37 <script> |
| 38 "use strict"; |
| 39 |
| 40 var transformValues = [ |
| 41 ['translate(0px)', 'translate(30px)', 'translate(20px, 40px)', |
| 42 'translateX(20px)', 'translateY(20px)'], |
| 43 ['scale(1, 1)', 'scale(1.5, 3)', 'scale(2)', 'scaleX(2)', 'scaleY(2)'], |
| 44 ['rotate(0deg)', 'rotate(50deg)'], |
| 45 ['skew(0deg)', 'skew(20deg)', 'skew(40deg, 20deg)'], |
| 46 ['skewX(0deg)', 'skewX(40deg)'], |
| 47 ['skewY(0deg)', 'skewY(40deg)'], |
| 48 ['matrix(1, 0, 0, 1, 0, 0)', 'matrix(-1, 1, -1, -1, 10, 10)'], |
| 49 ]; |
| 50 |
| 51 var separation_x = 100; |
| 52 var separation_y = 50; |
| 53 var max_x = 1000; |
| 54 |
| 55 var toplevel = document.querySelector("div"); |
| 56 var y = 50; |
| 57 |
| 58 var animations = []; |
| 59 |
| 60 for (var i = 0; i < transformValues.length; i++) { |
| 61 var x = 10; |
| 62 for (var j = 0; j < transformValues[i].length; j++) { |
| 63 for (var k = 0; k < transformValues[i].length; k++) { |
| 64 if (j == k) { |
| 65 continue; |
| 66 } |
| 67 toplevel.appendChild(document.createElement("div")); |
| 68 var div = toplevel.lastChild; |
| 69 div.className = "expected"; |
| 70 div.style.top = y + 'px'; |
| 71 div.style.left = x + 'px'; |
| 72 div.style[test_features.transformProperty] = transformValues[i][k]; |
| 73 toplevel.appendChild(document.createElement("div")); |
| 74 var div = toplevel.lastChild; |
| 75 div.className = "anim"; |
| 76 div.style.top = y + 'px'; |
| 77 div.style.left = x + 'px'; |
| 78 div.id = "i" + i + "_" + j + "_" + k |
| 79 animations.push(new Animation(div, [ |
| 80 {transform: transformValues[i][j]}, |
| 81 {transform: transformValues[i][k]}, |
| 82 ], {duration: 2, fill: 'forwards'})); |
| 83 x += separation_x; |
| 84 if (x > max_x) { |
| 85 x = 20; |
| 86 y += separation_y; |
| 87 } |
| 88 } |
| 89 } |
| 90 y += separation_y; |
| 91 } |
| 92 |
| 93 </script> |
| 94 <script> |
| 95 "use strict"; |
| 96 animations.forEach(function(anim) { document.timeline.play(anim); }); |
| 97 </script> |
OLD | NEW |