modifed snowflake count
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user