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 window.measurementReady = true; |
| 6 var N = 1000; |
| 7 var duration = 1000; |
| 8 var style = null; |
| 9 |
| 10 for (var i = 0; i < N; i++) { |
| 11 var target = document.createElement('target'); |
| 12 container.appendChild(target); |
| 13 } |
| 14 |
| 15 var nextAnim = 0; |
| 16 function updateStyle() { |
| 17 if (style) { |
| 18 style.remove(); |
| 19 } |
| 20 anim = 'anim' + nextAnim++; |
| 21 style = document.createElement('style'); |
| 22 style.textContent = '\ |
| 23 target {\ |
| 24 display: inline-block;\ |
| 25 width: 9px; height: 9px;\ |
| 26 background: orange;\ |
| 27 -webkit-animation: ' + anim + ' 1s infinite;\ |
| 28 }\n\ |
| 29 @-webkit-keyframes ' + anim + ' {\ |
| 30 0% { opacity: 0; }\ |
| 31 100% { opacity: 1; }\ |
| 32 }'; |
| 33 container.appendChild(style); |
| 34 } |
| 35 |
| 36 updateStyle(); |
| 37 setInterval(updateStyle, duration); |
| 38 </script> |
| 39 |
| 40 <style> |
| 41 body { |
| 42 margin: 0; |
| 43 overflow: hidden; |
| 44 } |
| 45 container { |
| 46 display: flex; |
| 47 flex-flow: row wrap; |
| 48 width: 550px; |
| 49 height: 800px; |
| 50 background: magenta; |
| 51 } |
| 52 </style> |
OLD | NEW |