New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

snowf

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snowf

Javascript snowflakes generator -- Let it snow on your page! ❄

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
180
increased by10.43%
Maintainers
1
Weekly downloads
 
Created
Source

snowf

Version Downloads License

Javascript snowflakes generator -- Let it snow on your page! ❄

  • All modern browsers are supported (Tested in Chrome, Firefox, Opera, Safari, IE9+ and Edge).

Install

npm:
npm install snowf --save

Usage

Include snowf with script tag:

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

Or use modules:

// ES6
import snowf from 'snowf';

// Commonjs
var snowf = require('snowf');

Simply init snowf like this:

snowf.init({
	size: 5,
	amount: 50
});

Default Options

ArgumentTypeDefault ValueDescription
domHTMLDomElement, Stringdocument.bodyThe element that snowfall canvas append to.
amountNumber50Number of snowflakes displayed at a time.
sizeNumber5Size of snowflakes.
speedNumber1.5Vertical speed of snowflakes. The larger, the snowflakes drop faster.
windNumber0Horizontal wind power. Wind will blow right if this is a positive number, and a negative number makes wind blow left.
colorString'#fff'Color of snowflakes. This option accepts HEX or RGB color code, such as "#fff", "#ffffff", "rgb(255,255,255)".
opacityNumber0.8The max opacity of snowflakes. The plugin will generate snowflakes with different opacity from 0 to this number.
swingNumber1Swing offset of snowflakes. If you don't want them to swing, set this option as 0.
imageStringnullSet this option to replace the snowflake with your image.
zIndexNumbernullPosition of the canvas layer. Set the layer front or back by changing this value.

More Examples

var snow = snowf.init();

// Adjust width and height of window:
window.onresize = function() {
  snow.resize();
};

// Reset the Snowf object and regenerate snowflakes:
snow.reset();

// reset the Snowf object with new options:
snow.setOptions({
	amount: 80
});

// Change the wind power ( This will not reset the Snowf object ):
// Arguments: (wind, time)
snow.wind(1);
snow.wind(2, 2000);

// Change the vertical speed ( This will not reset the Snowf object )
snow.speed(2);

Others

react-snowf (use snowf with React)
vue-snowf (use snowf with Vue)

Licence

snowf is open source and released under the MIT Licence.

Copyright (c) 2017 Fuxy526

Keywords

FAQs

Package last updated on 22 Feb 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc