Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

crashmax-dev/fireworks-js

A simple fireworks library! |fireworks.js.org

GitHub Workflow StatusGitHubnpmnpmnpm 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 withfireworks-js atfireworks.js.org orstackblitz.com

Installation

npm install fireworks-js
yarn add fireworks-js
pnpm add fireworks-js
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

<!-- 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>

Usage

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

Documentation

Options

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

PropertyTypeDefault
hueobjecthue
rocketsPointobjectrocketsPoint
mouseobjectmouse
boundariesobjectboundaries
soundobjectsound
delayobjectdelay
brightnessobjectbrightness
decayobjectdecay
lineWidthobjectlineWidth
lineStylestringround
explosionnumber5
opacitynumber0.5
accelerationnumber1.05
frictionnumber0.95
gravitynumber1.5
particlesnumber50
traceLengthnumber3
flickeringnumber50
intensitynumber30
traceSpeednumber10
intensitynumber30
autoresizebooleantrue

Thehue,delay,decay,brightness,lineWidth.explosion,lineWidth.trace,sound.volume androcketsPoint options accept an object:

PropertyType
minnumber
maxnumber

Note
Themin andmax properties are used to randomly select values from the range.

Themouse options accept an object:

PropertyTypeDefault
clickbooleanfalse
movebooleanfalse
maxnumber1

Note
Themax property has no effect ifclick is false.

Thesound options accept an object:

PropertyTypeDefault
enabledbooleanfalse
filesstring[]files
volumeobjectvolume
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}})

API

.start()

Start fireworks.

.launch(count)

Launching a specified number of fireworks.
Type:number
Default1

.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:options

.updateSize(sizes)

Force update canvas size.
Type:sizes

.updateBoundaries(boundaries)

Force update canvas boundaries.
Type:boundaries

Community

Star History

Star History Chart

Author

License

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

Stars

Watchers

Forks

Packages

 
 
 

[8]ページ先頭

©2009-2025 Movatter.jp