User:DodoMan/snowflake.js: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
m Justarandomamerican moved page User:Rafdodo/snowflake.js to User:DodoMan/snowflake.js: Automatically moved page while renaming the user "Rafdodo" to "DodoMan" |
mNo edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
// Loading the CSS for snowflakes |
// Loading the CSS for snowflakes |
||
importStylesheet("User: |
importStylesheet("User:DodoMan/snowflake.css"); |
||
console.log("%c[Snowflake]%c The `snowflake` user script has been loaded successfully. Enjoy the snowflakes!", "color: aqua", ""); |
console.log("%c[Snowflake]%c The `snowflake` user script has been loaded successfully. Enjoy the snowflakes!", "color: aqua", ""); |
||
Latest revision as of 05:15, 10 April 2024
// Loading the CSS for snowflakes
importStylesheet("User:DodoMan/snowflake.css");
console.log("%c[Snowflake]%c The `snowflake` user script has been loaded successfully. Enjoy the snowflakes!", "color: aqua", "");
function createSnowflake() {
const snowflake = document.createElement('div');
snowflake.classList.add('snowflake');
snowflake.textContent = '❄';
snowflake.style.left = Math.random() * 100 + 'vw';
snowflake.style.opacity = Math.random();
snowflake.style.fontSize = Math.random() * 20 + 10 + 'px';
snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
document.body.appendChild(snowflake);
// Remove snowflake after it falls
setTimeout(() => {
snowflake.remove();
}, 10000);
}
setInterval(createSnowflake, 100);