From b059ff5d4f73158dbcd955567a63f825fcdef01a Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sat, 25 Dec 2021 07:35:00 +0100 Subject: Reduced snowfall on smaller viewports --- content/script.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'content') 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 @@ +let i = 0; + function createSnowFlake() { + const threshold = -10 * Math.log10(window.innerWidth / 1000); + + if (++i < threshold) { + return; + } + + i = 0; + const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); -- cgit v1.2.3-70-g09d2