| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Verify that animations properly start</title> |
| <style> |
| #container { |
| position: absolute; |
| left: 0; |
| top: 3em; |
| } |
| #squareLinear, #squareSteps, #squareNonAccelerated { |
| width: 100px; |
| height: 100px; |
| background: lightblue; |
| position: absolute; |
| } |
| /* Avoid animation-fill-mode, to make sure that the move is done by the animation code. */ |
| #squareLinear { |
| top: 0px; |
| animation: moveByTransform 10s linear; |
| } |
| #squareSteps { |
| top: 150px; |
| animation: moveByTransform 10s steps(1000); |
| } |
| #squareNonAccelerated { |
| top: 300px; |
| animation: moveByLeft 10s steps(100); |
| } |
| @keyframes moveByTransform |
| { |
| 100% { |
| transform: translate(5000px); |
| } |
| } |
| @keyframes moveByLeft |
| { |
| 0% { |
| left: 0px; |
| } |
| 100% { |
| left: 5000px; |
| } |
| } |
| #coveringRect { |
| background: blue; |
| position: absolute; |
| top: -10px; |
| left: 90px; |
| width: 5000px; |
| height: 500px; |
| } |
| </style> |
| <script> |
| function runTest() { |
| if (!window.testRunner) |
| return; |
| // We wait a bit after the squares are moved behind the blue rectangle. For discontinuous |
| // transforms we have 5000px / 100 steps = 5px/step. Hence this happens after 20 steps i.e. |
| // 20/100*10s = 200ms. |
| testRunner.waitUntilDone(); |
| setTimeout(() => { testRunner.notifyDone(); }, 300); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>This test passes if green squares are moved behind the blue rectangle.</p> |
| <div id="container"> |
| <div id="squareLinear"><tt>transform</tt> (linear)</div> |
| <div id="squareSteps"><tt>transform</tt> (steps)</div> |
| <div id="squareNonAccelerated"><tt>left</tt> (steps)</div> |
| <div id="coveringRect"></div> |
| </div> |
| </body> |
| </html> |