From 993f12bf5bd68aafc7fdbf18f96b1708ec885756 Mon Sep 17 00:00:00 2001 From: CodeDevMLH Date: Mon, 25 Nov 2024 00:39:32 +0100 Subject: [PATCH] modifed snowflake count --- snowflakes.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/snowflakes.js b/snowflakes.js index dadd9a3..492dec4 100644 --- a/snowflakes.js +++ b/snowflakes.js @@ -1,5 +1,5 @@ const randomSnowflakes = false; // enable random Snowflakes -const snowflakeCount = 50; // count of random extra snowflakes +const snowflakeCount = 20; // count of random extra snowflakes let msgPrinted = false; // flag to prevent multiple console messages @@ -55,15 +55,15 @@ function addRandomSnowflakes(count) { // pick a random snowflake symbol snowflake.textContent = snowflakeSymbols[Math.floor(Math.random() * snowflakeSymbols.length)]; - // set random horizontal position, size and animation delay + // set random horizontal position, animation delay and size(uncomment lines to enable) const randomLeft = Math.random() * 100; // position (0% to 100%) - //const randomSize = Math.random() * 1.5 + 0.5; // size (0.5em to 2em) + //const randomSize = Math.random() * 1.5 + 0.5; // size (0.5em to 2em) //uncomment to enable random size const randomAnimationDelay = Math.random() * 8; // delay (0s to 8s) const randomAnimationDelay2 = Math.random() * 5; // delay (0s to 5s) // apply styles snowflake.style.left = `${randomLeft}%`; - //snowflake.style.fontSize = `${randomSize}em`; + //snowflake.style.fontSize = `${randomSize}em`; //uncomment to enable random size snowflake.style.animationDelay = `${randomAnimationDelay}s, ${randomAnimationDelay2}s`; // add the snowflake to the container @@ -72,7 +72,7 @@ function addRandomSnowflakes(count) { console.log('Random snowflakes added'); } -// initialize snowflakes +// initialize snowflakes and add random snowflakes after the DOM is loaded document.addEventListener('DOMContentLoaded', () => { toggleSnowflakes(); if (randomSnowflakes) {