Winter Snow Animation In Pure JavaScript – snowflakeJS

Category: Animation , Javascript | August 23, 2019
Author: AICDEV
Views Total: 59
Official Page: Go to website
Last Update: August 23, 2019
License: Apache-2.0

Preview:

Winter Snow Animation In Pure JavaScript – snowflakeJS

Description:

snowflakeJS is a standalone JavaScript library to create an animated snow falling effect that uses an SVG image for the snowflakes.

How to use it:

Install and download the snowflakeJS.

# NPM
$ npm install @aicdev/snowflakejs --save

Import the snowflakeJS as an ES module.

import {SnowflakeJs} from "@aicdev/snowflakejs";

Or include the umd version in the document.

<script src="snowflake.min.js"></script>

Create a new SnowflakeJs instance pass the following parameters:

  • frames: FPS
  • count: the number of snowflakes
  • lifetime: lifetime in ms
  • maxSpeed: max speed
  • maxSize: max size
const snowflake = new SnowflakeJs(frames=25, count=50, lifetime=5000, maxSpeed=4, maxSize=15);

Start the snow falling effect.

snowflake.init();

You Might Be Interested In:


Leave a Reply