Snowfall effect written in pure JavaScript. No additional libraries, no dependencies. Works in every modern browser.

Overview

pureSnow.js

Snow falling slowly on a winter night. Probably the most calming and peaceful snowfall effect written in pure JS/CSS. (No SCSS).

Inspired by: alphardex (SCSS Version) and YusukeNakaya (Vue implementation).

pureSnow.js was created for those who don't want to install any additional libraries and want to change some variables on the fly.
If you only need the effect I recommend downloading compiled version of alphardex's work.

Controlling snowfall density:

Default amount of snowflakes is set to 400. This might be challenging for an older GPU.
You can change that by declaring variable total eg:

<script>let total = 200;</script>

You can also do that by changing snowflakesCount inside the script.

No CSS files whatsoever:

It is also possible to get rid of style.css file. Just paste it's content to declaration of variable baseCss in pureSnow.js file eg:

let baseCss = `
    body {
        background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
        overflow-x: hidden;
        min-height: 100vh; 
        /* If you want to change the site height you can remove overflow-y */
        /* pureSnow will automatically detect height of body tag */
        overflow-y: hidden;
        color: white;
    }
    
    .snowflake {
        position: absolute;
        width: 10px;
        height: 10px;
        background: white;
        border-radius: 50%;
        filter: drop-shadow(0 0 10px white);
    }
`

Page height:

Keep in mind that increasing page height might impact performance. While increasing page height snowflake count should also be increased.

For example:

Page height:100vh ---> let total = 200

Page height:200vh ---> let total = 300


Demo: https://hyperstown.github.io/puresnowjs/

You might also like...

A platform designed specifically as an additional layer on top of Google Classroom for students to gain the best out of online evaluations

A platform designed specifically as an additional layer on top of Google Classroom for students to gain the best out of online evaluations

Peer-Learning-Platform A platform designed specifically as an additional layer on top of Google Classroom for students to gain the best out of online

Jun 12, 2022

Additional themes for Lovelace Mushroom Cards 🍄

Additional themes for Lovelace Mushroom Cards 🍄

🍄 Mushroom Themes Mushroom themes allow you to customize your Mushroom dashboard using Home Assistant themes. ⚠️ It's only a theme! You need to insta

Dec 24, 2022

A NodeJs service which allows you to create a movie based on it's title (additional movie details will be fetched) and fetch all created movies.

movies-api A NodeJs service which allows you to create a movie based on it's title (additional movie details will be fetched) and fetch all created mo

Mar 27, 2022

Used for creating a out-of-the-box template without additional configuration.

ou Used for creating a out-of-the-box template without additional configuration. Templates Vue3 Lite Template Used for some simple web app Vue3 + Vite

Jul 17, 2022

An obsidian plugin that give additional features to code blocks.

An obsidian plugin that give additional features to code blocks.

Obsidian Advanced Codeblock Add additioinal features to code blocks. Demo Feature Add line numbers to code block Add line highlight to code block Usag

Jan 3, 2023

A set of utilities and additional features for my creative coding class aiming to help students while introducing the algorithmic thinking.

A set of utilities and additional features for my creative coding class aiming to help students while introducing the algorithmic thinking.

p5.utils A set of utilities and additional features for my creative coding class aiming to help students while introducing the algorithmic thinking. T

Dec 25, 2022

Debut plugin that provides additional candles of specified tickers to strategy.

debut-plugin-candles A plugin for Debut platform that provides additional candles of specified tickers to strategy. Install @debut/community-core shou

Dec 15, 2022

The only Backend you'll ever need. Written in NodeJS, works with any stack

The only Backend you'll ever need. Written in NodeJS, works with any stack Conduit Platform Conduit is a NodeJS-based Self-Hosted backend, that aims t

Jan 3, 2023

A viewer for Arc System Works scripts and hitboxes written in Godot.

A viewer for Arc System Works scripts and hitboxes written in Godot.

ASWViewer A viewer for Arc System Works scripts and hitboxes written in Godot. Currently only supports Guilty Gear -Strive-. It also displays the mode

Sep 20, 2022
Comments
  • Frame-by-frame animation, frame drops

    Frame-by-frame animation, frame drops

    Unfortunately, the animation is practically stop-motion. I am attaching a screenshot of devtools with chrome. The green ones are successful frames at a maximum of ~25-27fps and the pink ones, unfortunately, are frame drops - ~20fps.

    Testet on: Chrome, chrome canary, opera, vivaldi, brave, edge Windows

    This behavior is practically the same in every browser

    issue

    troubleshooting 
    opened by tomik23 3
  • Can't scroll down the page

    Can't scroll down the page

    This prolly can be a silly question, But after putting this in my page I can't scroll down the page anymore. Please guide me as I am new into programming 😆

    opened by IndraTensei 1
  • This adds horizontal scrollbar in responsive mode

    This adds horizontal scrollbar in responsive mode

    Greetings,

    Whenever I add this, it adds a slight horizontal scroll to the website, and I cannot figure out why. I can see it on the demo aswell https://hyperstown.github.io/puresnowjs/

    Any idea as to why this happens?

    troubleshooting 
    opened by PibbzTV 6
Releases(v2.0.0)
  • v2.0.0(Dec 22, 2022)

    Version 2.0 is officially here!

    Changes

    • Added option to specify the number of snowflakes using the count attribute on the snow div element.
    • Added support for installation via npm.
    • Added option to specify custom CSS styles as a global const, BASE_CSS.
    • Followed more conventional naming scheme for functions, variables and project itself.
    • total variable will no longer work, please use count attribute or SNOWFLAKES_COUNT const that will work just like total before.
    • Function toggleSnow has been replaced with showSnow that takes boolean value as argument.
    • Small fixes and improvements in code readability.

    Happy winter holidays and happy coding!

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Dec 3, 2022)

  • v1.2.0(Dec 6, 2021)

  • v1.1.0(Dec 6, 2021)

  • v1.0.0(Dec 6, 2021)

Owner
null
Flexible, powerful and modern library for creating the running horizontal blocks effect, also known as ticker or the «marquee effect».

Cuberto Reeller Flexible, powerful and modern library for creating the running horizontal blocks effect, also known as ticker or the «marquee effect».

Cuberto 41 Jan 4, 2023
A simple color picker application written in pure JavaScript, for modern browsers.

Color Picker A simple color picker application written in pure JavaScript, for modern browsers. Has support for touch events. Touchy… touchy… Demo and

Taufik Nurrohman 207 Dec 14, 2022
Quick and easy spring animation. Works with other animation libraries (gsap, animejs, framer motion, motion one, @okikio/animate, etc...) or the Web Animation API (WAAPI).

spring-easing NPM | Github | Docs | Licence Quick and easy spring animations. Works with other animation libraries (gsap, animejs, @okikio/animate, mo

Okiki Ojo 34 Dec 14, 2022
Hacktoberfest is all about meeting up all brains. In this repository we are planning to come with many ideas and works. You all can share your ides/works here.

Hacktoberfest Submit your Work Hacktoberfest is all about meeting up all brains. In this repository we are planning to come with many ideas and works.

Chinmay Patil 3 Oct 5, 2022
Finally, a simple, lightweight (0.6kb), pure JavaScript image lazy loader that even works in IE* using the IntersectionObserver API

Simply Lazy A simple & lightweight (0.6kb), pure JavaScript image lazy loader that even works in IE* utilizing the built in IntersectionObserver API i

Max 5 Dec 26, 2022
👌A useful zero-dependencies, less than 434 Bytes (gzipped), pure JavaScript & CSS solution for drop an annoying pop-ups confirming the submission of form in your web apps.

Throw out pop-ups confirming the submission of form! A useful zero-dependencies, less than 434 Bytes (gzipped), pure JavaScript & CSS solution for dro

Vic Shóstak 35 Aug 24, 2022
A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

A Virtual Interactive Keyboard which replicates every key you press and a Text-Area in which everything is written and can be copied to the clipboard with a click of a button.

Devang Joshi 1 Mar 1, 2021
Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill).

@sanity/client Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a Promise polyfill). Requirements Sanity Clien

Sanity 23 Nov 29, 2022
Responsive no-jQuery pure JS/CSS Lightbox for images, no dependencies, 10kb unminified source code, with demo

img-lightbox Responsive no-jQuery pure JS/CSS Lightbox for images, no dependencies, 10kb unminified source code, with demo Demo codepen jsfiddle jsbin

englishextra 12 Jun 13, 2022
🐢 A collection of awesome browser-side JavaScript libraries, resources and shiny things.

Awesome JavaScript A collection of awesome browser-side JavaScript libraries, resources and shiny things. Awesome JavaScript Package Managers Componen

chencheng (云谦) 29.6k Dec 29, 2022