summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/script.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/content/script.js b/content/script.js
index dd7729d..763734e 100644
--- a/content/script.js
+++ b/content/script.js
@@ -1,4 +1,10 @@
1function createSnowFlake() { 1function createSnowFlake() {
2 setTimeout(() => createSnowFlake(), 50 / Math.log10(window.innerWidth / 1000 + 1));
3
4 if (document.hidden) {
5 return;
6 }
7
2 const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 8 const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3 const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); 9 const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use");
4 10
@@ -11,13 +17,11 @@ function createSnowFlake() {
11 snowFlake.style.left = Math.random() * 100 + '%'; 17 snowFlake.style.left = Math.random() * 100 + '%';
12 snowFlake.style.animationDuration = (Math.random() * 3 + 2) * 1000 + 'ms'; 18 snowFlake.style.animationDuration = (Math.random() * 3 + 2) * 1000 + 'ms';
13 snowFlake.style.opacity = Math.random(); 19 snowFlake.style.opacity = Math.random();
14 20
15 snowFlake.addEventListener("animationend", () => snowFlake.remove()); 21 snowFlake.addEventListener("animationend", () => snowFlake.remove());
16 22
17 snowFlake.appendChild(snowFlakeInner); 23 snowFlake.appendChild(snowFlakeInner);
18 document.body.appendChild(snowFlake); 24 document.body.appendChild(snowFlake);
19
20 setTimeout(() => createSnowFlake(), 50 / Math.log10(window.innerWidth / 1000 + 1));
21} 25}
22 26
23createSnowFlake(); 27createSnowFlake();