Easy Snowfall Effect With Vanilla JavaScript – snow.js

Category: Animation , Javascript | January 10, 2018
Author: zmfe
Views Total: 495
Official Page: Go to website
Last Update: January 10, 2018
License: MIT

Preview:

Easy Snowfall Effect With Vanilla JavaScript – snow.js

Description:

Just another vanilla JavaScript snowfall plugin which simulates the snow falling effect on the web page. Easy to customize the snowflakes with JavaScript and Canvas.

How to use it:

Create a placeholder element on the html page.

<div id="snow"></div>

Make the placeholder element fullscreen.

#snow {
  position:relative;
  width:100%;
  height:100%;
}

Insert the JavaScript file ‘snow.js’ at the end of the document.

<script src="/dist/snow.js"></script>

Initialize the library and done.

ocument.addEventListener('DOMContentLoaded', function() {
  new Snow('#snow');
});

Set the number of snowflakes.

Snow('#snow',{
  number:30
});

Set the size of snowflakes.

Snow('#snow',{
  number:30,
  r: 2.5
});

Set the animation speed.

Snow('#snow',{
  number:30
  v: 1.8
});

Leave a Reply