OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <style> |
| 3 div { |
| 4 position: relative; |
| 5 height: 100px; |
| 6 width: 100px; |
| 7 background: green; |
| 8 } |
| 9 </style> |
| 10 <body> |
| 11 <p> |
| 12 Each section below has two boxes, the top runs as if no style change, the bottom |
| 13 runs with on-the-fly style/source/target changes. |
| 14 </p> |
| 15 <hr> |
| 16 |
| 17 Layer attach/detach test (style.display block -> inline -> block) |
| 18 <br> |
| 19 <div id="test1_ref">REFERENCE</div> |
| 20 <div id="test1_reattach">STYLE CHANGE</div> |
| 21 <hr> |
| 22 |
| 23 Layer attach/detach test (style.display block -> none -> block), source, target. |
| 24 <br> |
| 25 <div id="test2_ref">REFERENCE</div> |
| 26 <div id="test2_reattach">STYLE CHANGE</div> |
| 27 <div id="test2_target">TARGET CHANGE</div> |
| 28 <hr> |
| 29 |
| 30 <script> |
| 31 var opacityKeyframes = [ |
| 32 {opacity: 0}, |
| 33 {opacity: 1} |
| 34 ]; |
| 35 |
| 36 var player1_ref = test1_ref.animate(opacityKeyframes, { |
| 37 duration: 5000, |
| 38 delay: 100, |
| 39 }); |
| 40 var player1_reattach = test1_reattach.animate(opacityKeyframes, { |
| 41 duration: 5000, |
| 42 delay: 100, |
| 43 }); |
| 44 |
| 45 test1_reattach.style.display = 'inline' |
| 46 test1_reattach.style.display = 'block' |
| 47 |
| 48 var leftKeyframes = [ |
| 49 {left: '100px'}, |
| 50 {left: '600px'} |
| 51 ]; |
| 52 var translateKeyframes = [ |
| 53 {transform: 'translateX(100px)'}, |
| 54 {transform: 'translateX(600px)'} |
| 55 ]; |
| 56 var reverseTranslateKeyframes = [ |
| 57 {transform: 'translateX(600px)'}, |
| 58 {transform: 'translateX(100px)'} |
| 59 ]; |
| 60 |
| 61 var player2_ref = test2_ref.animate(leftKeyframes, { |
| 62 duration: 5000, |
| 63 delay: 100, |
| 64 }); |
| 65 var player2_reattach = test2_reattach.animate(translateKeyframes, { |
| 66 duration: 5000, |
| 67 delay: 100, |
| 68 }); |
| 69 |
| 70 test2_reattach.style.display = 'none' |
| 71 test2_reattach.style.display = 'block' |
| 72 |
| 73 setTimeout(function() { |
| 74 test1_reattach.style.display = 'inline' |
| 75 test2_reattach.style.display = 'none' |
| 76 }, 500); |
| 77 |
| 78 setTimeout(function() { |
| 79 test1_reattach.style.display = 'block' |
| 80 test2_reattach.style.display = 'block' |
| 81 }, 2000); |
| 82 |
| 83 setTimeout(function() { |
| 84 var animation = new Animation(test2_reattach, reverseTranslateKeyframes, |
| 85 5000); |
| 86 player2_reattach.source = animation; |
| 87 }, 3000); |
| 88 |
| 89 setTimeout(function() { |
| 90 var animation = new Animation(test2_target, reverseTranslateKeyframes, |
| 91 5000); |
| 92 player2_reattach.source = animation; |
| 93 }, 4000); |
| 94 |
| 95 </script> |
| 96 |
| 97 </body> |
| 98 </html> |
OLD | NEW |