OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta name="viewport" content="width=device-width, user-scalable=no"> |
| 3 <script src="resources/web-animations-api-check.js"></script> |
| 4 <container id="container"></container> |
| 5 <script> |
| 6 var N = 1000; |
| 7 var duration = 1000; |
| 8 |
| 9 function startAnimation(element, delay) { |
| 10 target.animate([ |
| 11 {opacity: 0}, |
| 12 {opacity: 1}, |
| 13 ], { |
| 14 duration: duration, |
| 15 iterations: Infinity, |
| 16 delay: delay, |
| 17 }); |
| 18 } |
| 19 |
| 20 for (var i = 0; i < N; i++) { |
| 21 var target = document.createElement('target'); |
| 22 container.appendChild(target); |
| 23 startAnimation(target, -i * (duration / N)); |
| 24 } |
| 25 |
| 26 requestAnimationFrame(function() { |
| 27 window.measurementReady = true; |
| 28 }); |
| 29 </script> |
| 30 |
| 31 <style> |
| 32 target { |
| 33 display: inline-block; |
| 34 width: 9px; height: 9px; |
| 35 background: orange; |
| 36 } |
| 37 body { |
| 38 margin: 0; |
| 39 overflow: hidden; |
| 40 } |
| 41 container { |
| 42 display: flex; |
| 43 flex-flow: row wrap; |
| 44 width: 550px; |
| 45 height: 800px; |
| 46 background: magenta; |
| 47 } |
| 48 </style> |
OLD | NEW |