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

confettis

v0.3.4

Published

Confettis πŸŽ‰ for web!

Downloads

727

Readme

Confettis

NPM GitHub Issues GitHub Tag GitHub Commits GitHub License

πŸŽ‰ Confettis v0.3.4

Confettis is a small lib to add confettis to your website. Yep, confettis! πŸŽ‰

  • 😊 SSR Support
  • πŸŽ‰ Common confettis
  • πŸ‘½ Emoji coffetis
  • ⭐️ Star confettis
  • 🟑 Circle confettis (snow?)
  • ✨ Confettis with different sizes
  • πŸ—Ώ Static or moving confettis
  • πŸ˜„ Super easy to use!

Demo

confettis.ovni.dev

Resources

Installation

Browser:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/confettis.min.js"></script>

Deno:

import * as confetti from 'https://esm.sh/[email protected]'

Node:

$ npm i confettis
import * as confetti from 'confettis'

Usage

Basic usage

confetti.create()

Advanced usage

confetti.create({
    x: 0.5,
    y: 0.7,
    count: 500,
    ticks: -1,
    gravity: [ 0.7, 1.2 ],
    speed: [ 35, 45 ],
    scale: [ 0.7, 0.8 ],
    decay: 0.91,
    shapes: [ 'square', 'ellipse' ]
})

This is just an example, but you can do anything. I recommend you look at the examples I have put on the web! See more examples here!

Parameters

When creating a new confetti you can change the parameters to change the position, particle count, angle, gravity, etc.

| Option | Type | Default | Description | | :---: | :---: | :---: | --- | | canvas | string | confettis | Id of canvas where you are going to show the confetti. If you do not put anything, a canvas will be created with id "confettis". | | count | number | 100 | Number of confetti to launch. Remember that the more particles the web performance will be worse. The recommended is between 1 and 300 particles per second. | | x | number | 0.5 | The X position is horizontal, being 0 the left edge and 1 the right edge. | | y | number | 0.7 | The Y position is vertical, being 0 the upper edge and 1 the lower edge. | | z | number | MAX_SAFE_INTEGER | The Z position on the page (z-index). Determine whether it is shown above or below other web elements. The higher the number, it will be shown above all (recommended). Default is Number.MAX_SAFE_INTEGER (2147483647) to overcome the height of most popular UI libs. | | gravity | number or [number] | 1 | Gravity determine how quickly the confetti will fall. You can play with this parameter to make it fall faster or slower, and you can even make the confetti rise up. | | ticks | number or [number] | 300 | Time that confetti will take to disappear (opacity). The higher the number, it will take longer to disappear. Put it in -1 to deactivate it and make it always visible. | | speed | number or [number] | 45 | Speed with which the confetti will begin to move. | | scale | number or [number] | 0.8 | Scale factor for each confetti particle. Use decimals to make the confetti smaller. Example: [ 0.8, 1, 1.3 ] | | overflow | object | | Prarameter to allow confetti particle exceed the canvas without being deleted | | overflow.left | boolean | false | When set to true allows the left overflow | | overflow.right | boolean | false | When set to true allows the right overflow | | overflow.top | boolean | true | When set to true allows the top overflow | | overflow.bottom | boolean | false | When set to true allows the bottom overflow | | decay | number | 0.92 | Determine the speed with which the confetti will lose speed. Keep this number between 0 and 1 so that the confetti does not go to the speed of light. | | drift | number | 0 | Determine the side where the confetti will go. 0 indicates that it will fall down. A negative number indicates that it will go to the left, and a positive number indicates that it will go to the right. | | angle | number | 90 | The angle at which the confetti is going to be released. In degrees (0-360) | | spread | number | 70 | How far the confetti can come. In degrees (0-360) | | quiet | boolean | false | It allows to create static confetti. Perfect if you want square or ellipse confetti without moving when falling. | | colors | [string] | | Array with strings of the colors you want to show the confetti. The colors must be in Hex format (#ffffff). | | shapes | [string] | | An array of shapes for the confetti. | | emojis | [string] | | An array of emojis for the confetti. |

Accepted shapes

| Shape | Description | | :---: | --- | | square | Create common square confetti. | | ellipse | Create confetti in the form of ellipse. | | circle | Create confetti in the form of a circle. | | star | Create confetti in the form of star with five spikes. | | emoji | Create confetti with emojis. |

Contributors

All issue reports, feature requests, pull requests and github stars are welcomed and much appreciated.

Thanks

Special thanks to catdad for canvas-confetti. I have created this project as inspiration to obtain a cleaner and legible code in typescript, and add extra functions.