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 |
| 20 .container { |
| 21 -webkit-perspective: 200px; |
| 22 perspective: 200px; |
| 23 -webkit-perspective-origin: 400px 200px; |
| 24 perspective-origin: 400px 200px; |
| 25 position: absolute; |
| 26 top: 300px; |
| 27 } |
| 28 |
| 29 .anim { |
| 30 left: 0px; |
| 31 width: 50px; |
| 32 height: 50px; |
| 33 background-color: lightsteelblue; |
| 34 position: absolute; |
| 35 -webkit-transform-style: preserve-3d; |
| 36 transform-style: preserve-3d; |
| 37 font-size: 8px; |
| 38 } |
| 39 |
| 40 .expected { |
| 41 width: 50px; |
| 42 height: 50px; |
| 43 position: absolute; |
| 44 background-color: red; |
| 45 font-size: 8px; |
| 46 -webkit-transform-style: preserve-3d; |
| 47 transform-style: preserve-3d; |
| 48 } |
| 49 </style> |
| 50 <div class="container"></div> |
| 51 <div style="height: 700px"></div> |
| 52 |
| 53 <script> |
| 54 var expected_failures = { |
| 55 '/Autogenerated at .*/': { |
| 56 msie: true, |
| 57 message: "IE returns matrix3d rather then matrix." |
| 58 } |
| 59 }; |
| 60 </script> |
| 61 <script src="../bootstrap.js"></script> |
| 62 <script> |
| 63 "use strict"; |
| 64 |
| 65 var transformValues = [ |
| 66 ['translate3d(0px, 0px, 0px)', 'translate3d(20px, 40px, 60px)', |
| 67 'translateZ(20px)'], |
| 68 ['translateZ(50px) scale3d(1, 1, 1)', 'translateZ(50px) scale3d(1.5, 3, 5)', '
translateZ(50px) scaleZ(2)'], |
| 69 ['rotateX(0deg)', 'rotateX(50deg)'], |
| 70 ['rotateY(0deg)', 'rotateY(50deg)'], |
| 71 ['rotateZ(0deg)', 'rotateZ(50deg)'], |
| 72 ]; |
| 73 |
| 74 var separation_x = 70; |
| 75 var separation_y = 70; |
| 76 var max_x = 1000; |
| 77 |
| 78 var toplevel = document.querySelector("div"); |
| 79 |
| 80 var animations = []; |
| 81 |
| 82 var y = 50; |
| 83 for (var i = 0; i < transformValues.length; i++) { |
| 84 var x = 300; |
| 85 for (var j = 0; j < transformValues[i].length; j++) { |
| 86 for (var k = 0; k < transformValues[i].length; k++) { |
| 87 if (j == k) { |
| 88 continue; |
| 89 } |
| 90 toplevel.appendChild(document.createElement("div")); |
| 91 var div = toplevel.lastChild; |
| 92 div.className = "expected"; |
| 93 div.style.top = y + 'px'; |
| 94 div.style.left = x + 'px'; |
| 95 div.style[test_features.transformProperty] = transformValues[i][k]; |
| 96 toplevel.appendChild(document.createElement("div")); |
| 97 var div = toplevel.lastChild; |
| 98 div.className = "anim"; |
| 99 div.style.top = y + 'px'; |
| 100 div.style.left = x + 'px'; |
| 101 div.textContent = "perspective"; |
| 102 div.id = "i_" + i + "_" + j + "_" + k; |
| 103 animations.push(new Animation(div, [ |
| 104 {transform: transformValues[i][j]}, |
| 105 {transform: transformValues[i][k]}, |
| 106 ], {duration: 2, fill: 'forwards'})); |
| 107 |
| 108 x += separation_x; |
| 109 if (x > max_x) { |
| 110 x = 20; |
| 111 y += separation_y; |
| 112 } |
| 113 } |
| 114 } |
| 115 y += separation_y; |
| 116 } |
| 117 |
| 118 </script> |
| 119 <script> |
| 120 "use strict"; |
| 121 animations.forEach(function(anim) { document.timeline.play(anim); }); |
| 122 </script> |
OLD | NEW |