fireworks-js

0

Описание

🎆 A simple fireworks library! Ready to use components available for React, Vue 3, Svelte, Angular, Preact, Solid, and Web Components.

Языки

  • TypeScript84,7%
  • CSS5%
  • Svelte4,1%
  • Vue2,8%
  • HTML2,7%
  • JavaScript0,7%
README.md

A simple fireworks library! | fireworks.js.org

GitHub Workflow Status GitHub npm npm npm bundle size


Table of Contents

Warning
This readme refers to upcoming v2 version, read here for v1 documentation.

Features

Browsers support

IE / Edge
Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Opera
Opera
Yandex
Yandex

Demo

You can play with

fireworks-js
at fireworks.js.org or codesandbox.io

Installation

PackageStatusDescription
fireworks-jsVanilla JS
@fireworks-js/reactReact component
@fireworks-js/preactPreact component
@fireworks-js/solidSolid component
@fireworks-js/vueVue 3 component
@fireworks-js/svelteSvelte component
@fireworks-js/angularAngular component
@fireworks-js/webWeb components

CDN

Usage

fireworks-js

Edit @fireworks-js/react

@fireworks-js/react

Edit @fireworks-js/react

@fireworks-js/preact

@fireworks-js/solid

@fireworks-js/vue

@fireworks-js/svelte

@fireworks-js/angular

@fireworks-js/web

Documentation

Options

Note
The options is optional, as are each of its properties.

PropertyTypeDefault
hue
objecthue
rocketsPoint
objectrocketsPoint
mouse
objectmouse
boundaries
objectboundaries
sound
objectsound
delay
objectdelay
brightness
objectbrightness
decay
objectdecay
lineWidth
objectlineWidth
lineStyle
stringround
explosion
number5
opacity
number0.5
acceleration
number1.05
friction
number0.95
gravity
number1.5
particles
number50
traceLength
number3
flickering
number50
intensity
number30
traceSpeed
number10
intensity
number30
autoresize
booleantrue

The

hue
,
delay
,
decay
,
brightness
,
lineWidth.explosion
,
lineWidth.trace
,
sound.volume
and
rocketsPoint
options accept an object:

PropertyType
min
number
max
number

Note
The

min
and
max
properties are used to randomly select values from the range.

The

mouse
options accept an object:

PropertyTypeDefault
click
booleanfalse
move
booleanfalse
max
number1

Note
The

max
property has no effect if
click
is false.

The

sound
options accept an object:

PropertyTypeDefault
enabled
booleanfalse
files
string[]files
volume
objectvolume

API

.start()

Start fireworks.

.launch(count)

Launching a specified number of fireworks.
Type:

number

Default
1

.stop(dispose)

Stop fireworks.
Type:

boolean

Default:
false

.waitStop(dispose)

Asynchronous stopping of the fireworks.
Type:

boolean

Default:
false

.pause()

Start/stop fireworks.

.clear()

Cleaning the canvas from fireworks.

.currentOptions

Getting current fireworks options.

.updateOptions(options)

Force update fireworks options.
Type:

.updateSize(sizes)

Force update canvas size.
Type:

.updateBoundaries(boundaries)

Force update canvas boundaries.
Type:

Community

Star History

Star History Chart

Author

License