- Notifications
You must be signed in to change notification settings - Fork89
🎆 A simple fireworks library! Ready to use components available for React, Vue 3, Svelte, Angular, Preact, Solid, and Web Components.
License
crashmax-dev/fireworks-js
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A simple fireworks library! |fireworks.js.org
Warning
This readme refers to upcoming v2 version,read here for v1 documentation.
- 🔥 Zerodependencies
- ⚙️ Flexibleconfiguration
- 📦 Lightweight (~3.0kB gzipped)
- 📜 SupportsTypeScript type definition
![]() Edge | ![]() Firefox | ![]() Chrome | ![]() Safari | ![]() iOS Safari | ![]() Opera | ![]() Yandex |
|---|---|---|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
You can play withfireworks-js atfireworks.js.org orstackblitz.com
npm install fireworks-js
yarn add fireworks-js
pnpm add fireworks-js
| Package | Status | Description |
|---|---|---|
| fireworks-js | Vanilla JS | |
| @fireworks-js/react | React component | |
| @fireworks-js/preact | Preact component | |
| @fireworks-js/solid | Solid component | |
| @fireworks-js/vue | Vue 3 component | |
| @fireworks-js/svelte | Svelte component | |
| @fireworks-js/angular | Angular component | |
| @fireworks-js/web | Web components |
<!-- jsDelivr --><scriptsrc="https://cdn.jsdelivr.net/npm/fireworks-js@2.x/dist/index.umd.js"></script><!-- UNPKG --><scriptsrc="https://unpkg.com/fireworks-js@2.x/dist/index.umd.js"></script><!-- Usage --><script>constcontainer=document.querySelector('.fireworks')constfireworks=newFireworks.default(container)fireworks.start()</script>
import{Fireworks}from'fireworks-js'constcontainer=document.querySelector('.container')constfireworks=newFireworks(container,{/* options */})fireworks.start()
npm install @fireworks-js/react
npm install @fireworks-js/preact
npm install @fireworks-js/solid
npm install @fireworks-js/vue
npm install @fireworks-js/svelte
npm install @fireworks-js/angular
npm install @fireworks-js/web
Note
The options is optional, as are each of its properties.
| Property | Type | Default |
|---|---|---|
hue | object | hue |
rocketsPoint | object | rocketsPoint |
mouse | object | mouse |
boundaries | object | boundaries |
sound | object | sound |
delay | object | delay |
brightness | object | brightness |
decay | object | decay |
lineWidth | object | lineWidth |
lineStyle | string | round |
explosion | number | 5 |
opacity | number | 0.5 |
acceleration | number | 1.05 |
friction | number | 0.95 |
gravity | number | 1.5 |
particles | number | 50 |
traceLength | number | 3 |
flickering | number | 50 |
intensity | number | 30 |
traceSpeed | number | 10 |
intensity | number | 30 |
autoresize | boolean | true |
Thehue,delay,decay,brightness,lineWidth.explosion,lineWidth.trace,sound.volume androcketsPoint options accept an object:
| Property | Type |
|---|---|
min | number |
max | number |
Note
Theminandmaxproperties are used to randomly select values from the range.
Themouse options accept an object:
| Property | Type | Default |
|---|---|---|
click | boolean | false |
move | boolean | false |
max | number | 1 |
Note
Themaxproperty has no effect ifclickis false.
Thesound options accept an object:
| Property | Type | Default |
|---|---|---|
enabled | boolean | false |
files | string[] | files |
volume | object | volume |
constfireworks=newFireworks(container,{autoresize:true,opacity:0.5,acceleration:1.05,friction:0.97,gravity:1.5,particles:50,traceLength:3,traceSpeed:10,explosion:5,intensity:30,flickering:50,lineStyle:'round',hue:{min:0,max:360},delay:{min:30,max:60},rocketsPoint:{min:50,max:50},lineWidth:{explosion:{min:1,max:3},trace:{min:1,max:2}},brightness:{min:50,max:80},decay:{min:0.015,max:0.03},mouse:{click:false,move:false,max:1}})
Start fireworks.
Launching a specified number of fireworks.
Type:number
Default1
Stop fireworks.
Type:boolean
Default:false
Asynchronous stopping of the fireworks.
Type:boolean
Default:false
Start/stop fireworks.
Cleaning the canvas from fireworks.
Getting current fireworks options.
Force update fireworks options.
Type:options
Force update canvas size.
Type:sizes
Force update canvas boundaries.
Type:boundaries
About
🎆 A simple fireworks library! Ready to use components available for React, Vue 3, Svelte, Angular, Preact, Solid, and Web Components.
Topics
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.







