npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-snowfetti

v1.2.4

Published

Generates random particles using html5 canvas API.

Downloads

245

Readme

react-snowfetti

NPM Version Build Status Coverage Status

Generates random particles using html5 canvas API.

react-snowfetti exposes an interface to create snow for the holidays or confetti when you're celebrating!

Inspired by this codepen.

snow

snow

confetti

confetti

interface

const palette = [
	'#55476a',
	'#ae3d63',
	'#db3853',
	'#f45c44',
	'#f8b646'
];

const snowfettiStyles = {
	backgroundColor: '#0a2933'
};

<Snowfetti
	profile={ [ 'confetti', 'steady', palette ] }
	amount={ 800 }
	width={ 600 }
	height={ 300 }
	styles={ snowfettiStyles }
/>

properties

profile (Array) - optional

Denotes the visual profile of the rendered particles on the canvas. The profile accepts three values:

  • type (String):
    • 'snow'
    • 'confetti'
  • velocity (String):
    • 'slow'
    • 'steady'
    • 'fast'
  • palette (Array): contains hex color strings

Defaults to type 'snow' and velocity 'slow'.

amount (Number) - optional

Denotes the amount of particles that will be rendered on the canvas.

Defaults to 800 particles.

width (Number) - optional

Denotes the canvas width.

Defaults to 600.

height (Number) - optional

Denotes the canvas height.

Defaults to 300.

styles (Object) - optional

Denotes the canvas css styles.

Defaults to backgroundColor: '#0a2933', position: 'absolute' with top: 0 and left: 0.

peer dependencies

react-snowfetti has a dependency on react version ^0.14.3.

This dependency must be fulfilled by the consumer of react-snowfetti.

usage

First install the package together with react in your project using npm:

npm i -S react-snowfetti react

Then import the package in your consumer application:

import React from 'react';
import Snowfetti from 'react-snowfetti';

export React.createClass({
	render () {
		return <Snowfetti />;
	}
});

todos

  • [ ] write tests
  • [x] add code coverage
  • [x] add CI
  • [x] add support for confetti color sets
  • [x] fade out confetti particles
  • [x] make particle flow direction be affected by mouse cursor
  • [x] add README.md badges