OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <meta name="viewport" content="width=device-width, user-scalable=no"> |
| 3 <container id="container"></container> |
| 4 <script> |
| 5 var N = 1000; |
| 6 var duration = 1000; |
| 7 var style = null; |
| 8 var keyframe = 1; |
| 9 var keyframeValues = [0, 1] |
| 10 |
| 11 for (var i = 0; i < N; i++) { |
| 12 container.appendChild(document.createElement('target')); |
| 13 } |
| 14 |
| 15 function startAllAnimations() { |
| 16 keyframe ^= 1; |
| 17 if (style) { |
| 18 style.remove(); |
| 19 } |
| 20 style = document.createElement('style'); |
| 21 style.textContent = 'target { opacity: ' + keyframeValues[keyframe] + '; }'; |
| 22 container.appendChild(style); |
| 23 } |
| 24 |
| 25 requestAnimationFrame(startAllAnimations); |
| 26 setInterval(startAllAnimations, duration); |
| 27 |
| 28 requestAnimationFrame(function() { |
| 29 window.measurementReady = true; |
| 30 }); |
| 31 </script> |
| 32 |
| 33 <style> |
| 34 body { |
| 35 margin: 0; |
| 36 overflow: hidden; |
| 37 } |
| 38 container { |
| 39 display: flex; |
| 40 flex-flow: row wrap; |
| 41 width: 550px; |
| 42 height: 800px; |
| 43 background: lightgoldenrodyellow; |
| 44 } |
| 45 target { |
| 46 display: inline-block; |
| 47 width: 9px; height: 9px; |
| 48 background: magenta; |
| 49 transition: opacity 1000ms linear; |
| 50 } |
| 51 </style> |
OLD | NEW |