summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/script.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/content/script.js b/content/script.js
index df5a9c0..b972200 100644
--- a/content/script.js
+++ b/content/script.js
@@ -12,21 +12,22 @@ function createSnowFlake() {
12 const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 12 const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg");
13 const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); 13 const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use");
14 14
15 const aniDuration = (Math.random() * 3 + 2) * 1000;
16
15 snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk"); 17 snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk");
16 18
17 snowFlake.classList.add("o-icon"); 19 snowFlake.classList.add("o-icon", "o-icon--snow");
18 snowFlake.classList.add("o-icon--snow"); 20 snowFlake.setAttribute("aria-hidden", "true");
19 snowFlake.ariaHidden = true;
20 21
21 snowFlake.style.width = Math.random() * 10 + 10 + 'px'; 22 snowFlake.style.fontSize = Math.random() * 0.5 + 0.7 + 'em';
22 snowFlake.style.left = Math.random() * window.innerWidth + 'px'; 23 snowFlake.style.left = Math.random() * window.innerWidth + 'px';
23 snowFlake.style.animationDuration = Math.random() * 3 + 2 + 's'; 24 snowFlake.style.animationDuration = aniDuration + 'ms';
24 snowFlake.style.opacity = Math.random(); 25 snowFlake.style.opacity = Math.random();
25 26
26 snowFlake.appendChild(snowFlakeInner); 27 snowFlake.appendChild(snowFlakeInner);
27 document.body.appendChild(snowFlake); 28 document.body.appendChild(snowFlake);
28 29
29 setTimeout(() => { snowFlake.remove(); }, 5000); 30 setTimeout(() => { snowFlake.remove(); }, aniDuration);
30} 31}
31 32
32setInterval(createSnowFlake, 100); 33setInterval(createSnowFlake, 100);