Socket
Socket
Sign inDemoInstall

effect-snow

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    effect-snow

A scene of snow as background


Version published
Weekly downloads
9
Maintainers
1
Install size
15.9 kB
Created
Weekly downloads
 

Readme

Source

effect-snow

CodePen Demo

Snow falling

Global import

From package

npm install effect-snow
<script src="node_modules/effect-snow/dist/snow.min.js"></script>

or from CDN

<script src="https://unpkg.com/effect-snow"></script>

ESM import

import Snow from 'effect-snow';

Usage

<body>
  <button id="start">start</button>
  <button id="stop">stop</button>
</body>
let it = new Snow(document.querySelector('body'));

document.getElementById('start').addEventListener('click', () => it.start());
document.getElementById('stop').addEventListener('click', () => it.stop());

API Reference

Constructor

const snow = new Snow(node, options);
namedescription
node <Node>element to apply the effect to
options <object>see additional options

Methods

snow.start();
snow.stop();
namedescription
start()Start the snow if it is not started yet. This will clear any existing snow immediately.
stop()Stop the snow. This will still allow the remaining snow to finish the animation.

Additional options

namerangedefault
indentisity <number>[1, 5]3
span <number>-375
// create a snow scene that has the highest intensity and each
// snow spiral width is 400px.
let it = new Snow(element, { intensity: 5, span: 400 });

Credits

The physics of the snow fall is adapted from Aatish Bhatia's Snow Globe Experiment.

Keywords

FAQs

Last updated on 27 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc