diff options
author | Volpeon <git@volpeon.ink> | 2021-12-24 09:45:51 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-12-24 09:45:51 +0100 |
commit | 2580c5dcb9f1e5e6541f63f8c7e24e5dfc82f078 (patch) | |
tree | d66c67a55e4890b612f7013c6fb288d47b1a2b0a /content/script.js | |
parent | Added inverted selection colors where necessary (diff) | |
download | volpeon.ink-2580c5dcb9f1e5e6541f63f8c7e24e5dfc82f078.tar.gz volpeon.ink-2580c5dcb9f1e5e6541f63f8c7e24e5dfc82f078.tar.bz2 volpeon.ink-2580c5dcb9f1e5e6541f63f8c7e24e5dfc82f078.zip |
Add snow effect for Christmas time
Diffstat (limited to 'content/script.js')
-rw-r--r-- | content/script.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/script.js b/content/script.js new file mode 100644 index 0000000..5702edf --- /dev/null +++ b/content/script.js | |||
@@ -0,0 +1,22 @@ | |||
1 | function createSnowFlake() { | ||
2 | const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
3 | const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); | ||
4 | |||
5 | snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk"); | ||
6 | |||
7 | snowFlake.classList.add("o-icon"); | ||
8 | snowFlake.classList.add("o-icon--snow"); | ||
9 | snowFlake.ariaHidden = true; | ||
10 | |||
11 | snowFlake.style.width = Math.random() * 10 + 10 + 'px'; | ||
12 | snowFlake.style.left = Math.random() * window.innerWidth + 'px'; | ||
13 | snowFlake.style.animationDuration = Math.random() * 3 + 2 + 's'; | ||
14 | snowFlake.style.opacity = Math.random(); | ||
15 | |||
16 | snowFlake.appendChild(snowFlakeInner); | ||
17 | document.body.appendChild(snowFlake); | ||
18 | |||
19 | setTimeout(() => { snowFlake.remove(); }, 5000); | ||
20 | } | ||
21 | |||
22 | window.addEventListener("load", () => { setInterval(createSnowFlake, 100); }) | ||