diff options
Diffstat (limited to 'content/snow.js')
| -rw-r--r-- | content/snow.js | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/content/snow.js b/content/snow.js deleted file mode 100644 index 562e9c0..0000000 --- a/content/snow.js +++ /dev/null | |||
| @@ -1,30 +0,0 @@ | |||
| 1 | (() => { | ||
| 2 | function createSnowFlake() { | ||
| 3 | setTimeout(() => createSnowFlake(), 50 / Math.log10(window.innerWidth / 1000 + 1)); | ||
| 4 | |||
| 5 | if (document.hidden) { | ||
| 6 | return; | ||
| 7 | } | ||
| 8 | |||
| 9 | const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
| 10 | const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); | ||
| 11 | const aniDuration = (Math.random() * 3 + 2) * 1000; | ||
| 12 | |||
| 13 | snowFlakeInner.setAttribute("href", "/icons.svg#asterisk"); | ||
| 14 | |||
| 15 | snowFlake.classList.add("o-icon", "o-icon--snow"); | ||
| 16 | snowFlake.setAttribute("aria-hidden", "true"); | ||
| 17 | |||
| 18 | snowFlake.style.fontSize = Math.random() * 0.5 + 0.7 + 'em'; | ||
| 19 | snowFlake.style.left = Math.random() * 100 + '%'; | ||
| 20 | snowFlake.style.animationDuration = aniDuration + 'ms'; | ||
| 21 | snowFlake.style.opacity = Math.random(); | ||
| 22 | |||
| 23 | setTimeout(() => snowFlake.remove(), aniDuration); | ||
| 24 | |||
| 25 | snowFlake.appendChild(snowFlakeInner); | ||
| 26 | document.body.appendChild(snowFlake); | ||
| 27 | } | ||
| 28 | |||
| 29 | createSnowFlake(); | ||
| 30 | })(); | ||
