Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 3.17 KB

README.md

File metadata and controls

78 lines (55 loc) · 3.17 KB

InstallationUsageContributing

npm GitHub Repo stars GitHub Build Status GitHub Docs Status npm downloads License

Installation

The library is written in TypeScript and compiled to an UMD module to allow integration into different environments.

Browsers

You can grab the latest version from jsdelivr.

<script src="https://cdn.jsdelivr.net/npm/party-js@latest/bundle/party.min.js"></script>

The library instance is loaded into the global party object.

Node.JS

If you are using a package-managed environment, you can also install the latest version via npm.

npm install party-js
yarn add party-js

To use it, simply require or import it.

const party = require("party-js");
import party from "party-js";

Usage

The library essentially offers a fully customizeable particle-system implementation into HTML documents. Users of the library have the ability to create and fine-tune effects to their individual liking. The library offers a few simple effects right out-of-the-box, so you don't have to waste time re-creating simple effects.

document.querySelector(".button").addEventListener("click", function (e) {
    party.confetti(this, {
        count: party.variation.range(20, 40),
    });
});

If you want to learn more, check out the quick start guide!

How it works

In general the library consists of emitters and particles. Emitters are structures located at a specific position that emit particles, and particles themselves are small graphical elements that float around the screen. Both entities are highly customizeable.

The library core spawns, updates and renders entities inside an animation frame loop. Entities are despawned when they leave the lower bound of the document, or their lifetime expires.

Contributing

First of all, thank you so much for wanting to contribute to the project! ❤
Please refer to the contribution guidelines when opening issues or creating pull requests.