| OLD | NEW |
| (Empty) |
| 1 <!-- | |
| 2 Copyright 2014 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 .container { | |
| 20 -webkit-perspective: 1000px; | |
| 21 perspective: 1000px; | |
| 22 position: absolute; | |
| 23 left: 0; | |
| 24 top: 0; | |
| 25 } | |
| 26 .box { | |
| 27 width: 96px; | |
| 28 height: 96px; | |
| 29 border: solid 2px; | |
| 30 display: inline-block; | |
| 31 margin: 50px; | |
| 32 -webkit-transform-style: preserve-3d; | |
| 33 transform-style: preserve-3d; | |
| 34 -webkit-transform: rotate(45deg) rotateY(30deg); | |
| 35 transform: rotate(45deg) rotateY(30deg); | |
| 36 } | |
| 37 .test { border-color: green; } | |
| 38 .expectation { color: red; } | |
| 39 </style> | |
| 40 <div id="expectationContainer" class="container"></div> | |
| 41 <div id="testContainer" class="container"></div> | |
| 42 <div style="height: 700px"></div> | |
| 43 | |
| 44 <script src="../bootstrap.js"></script> | |
| 45 <script> | |
| 46 'use strict'; | |
| 47 | |
| 48 var testCases = [ | |
| 49 'center', | |
| 50 'left', | |
| 51 'right', | |
| 52 'top', | |
| 53 'bottom', | |
| 54 '25px', | |
| 55 'left top', | |
| 56 '10% 50px', | |
| 57 '10% 50px 100px', | |
| 58 'right bottom 100px', | |
| 59 'right calc(120% - 100px)', | |
| 60 'right calc(120% - 100px) -200px', | |
| 61 ]; | |
| 62 | |
| 63 function createBox(type) { | |
| 64 var element = document.createElement('div'); | |
| 65 element.classList.add('box', type); | |
| 66 return element; | |
| 67 } | |
| 68 | |
| 69 testCases.forEach(function(testCase) { | |
| 70 var expectation = createBox('expectation') | |
| 71 expectation.style.transformOrigin = expectation.style.webkitTransformOrigin =
testCase; | |
| 72 expectation.textContent = testCase; | |
| 73 expectationContainer.appendChild(expectation); | |
| 74 | |
| 75 var test = createBox('test') | |
| 76 test.animate({transformOrigin: testCase}, {duration: 2 * 1000, fill: 'forwards
'}); | |
| 77 test.textContent = testCase; | |
| 78 testContainer.appendChild(test); | |
| 79 }); | |
| 80 </script> | |
| OLD | NEW |