animate-preserve3d-parent.html (1268B)
1 <!DOCTYPE HTML> 2 <html class="reftest-wait"> 3 <title>Testcase, bug 1176969</title> 4 <style> 5 6 body { padding: 50px } 7 8 #grandparent { perspective: 400px } 9 10 @keyframes spin { 11 0%, 85% { transform: rotateX(-45deg) rotateY(-45deg) rotateZ(-45deg); } 12 90%, 100% { transform: rotateX(-30deg) rotateY(-30deg) rotateZ(-30deg); } 13 } 14 15 #parent { 16 background: blue; 17 height: 200px; width: 200px; 18 border: 1px solid black; 19 transform-style: preserve-3d; 20 /* use a -99.9s delay to start at 99.9% and then move to 0% */ 21 animation: spin 100s -99.9s linear 2 paused; 22 } 23 24 #child { 25 transform: translateZ(15px); 26 height: 100px; width: 100px; margin: 50px; 27 background: yellow; 28 box-shadow: 3px 3px olive; 29 } 30 31 </style> 32 33 <div id="grandparent"> 34 <div id="parent"> 35 <div id="child"> 36 </div> 37 </div> 38 </div> 39 40 <script> 41 42 document.getElementById("parent").addEventListener("animationstart", StartListener); 43 44 function StartListener(event) { 45 var test = document.getElementById("parent"); 46 test.style.animationPlayState = 'running'; 47 test.addEventListener("animationiteration", IterationListener); 48 } 49 50 function IterationListener(event) { 51 setTimeout(RemoveReftestWait, 0); 52 } 53 54 function RemoveReftestWait() { 55 document.documentElement.classList.remove("reftest-wait"); 56 } 57 58 </script>