diff options
author | Volpeon <git@volpeon.ink> | 2021-12-25 07:35:00 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-12-25 07:35:00 +0100 |
commit | b059ff5d4f73158dbcd955567a63f825fcdef01a (patch) | |
tree | 6e0c0e0d35ca407f78fe80a5a93dc72a4983e381 | |
parent | Make snow click-through (diff) | |
download | volpeon.ink-b059ff5d4f73158dbcd955567a63f825fcdef01a.tar.gz volpeon.ink-b059ff5d4f73158dbcd955567a63f825fcdef01a.tar.bz2 volpeon.ink-b059ff5d4f73158dbcd955567a63f825fcdef01a.zip |
Reduced snowfall on smaller viewports
-rw-r--r-- | content/script.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/content/script.js b/content/script.js index 7143b25..df5a9c0 100644 --- a/content/script.js +++ b/content/script.js | |||
@@ -1,4 +1,14 @@ | |||
1 | let i = 0; | ||
2 | |||
1 | function createSnowFlake() { | 3 | function createSnowFlake() { |
4 | const threshold = -10 * Math.log10(window.innerWidth / 1000); | ||
5 | |||
6 | if (++i < threshold) { | ||
7 | return; | ||
8 | } | ||
9 | |||
10 | i = 0; | ||
11 | |||
2 | const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | 12 | const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); |
3 | const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); | 13 | const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); |
4 | 14 | ||