Skip to content

Commit

Permalink
rename option
Browse files Browse the repository at this point in the history
  • Loading branch information
crashmax-dev committed Feb 25, 2022
1 parent 39c1ec5 commit 9ea68c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const fireworksConfig = {
trace: 3,
traceSpeed: 10,
explosion: 6,
renderSpeed: 60,
intensity: 30,
flickering: 50,
lineCap: 'round',
lineJoin: 'round',
Expand Down Expand Up @@ -252,7 +252,7 @@ folders.fireworks.add(fireworksConfig, 'flickering', 0, 100).step(1).onChange(()
fireworks.setOptions(fireworksConfig)
})

folders.fireworks.add(fireworksConfig, 'renderSpeed', 30, 100).onChange(() => {
folders.fireworks.add(fireworksConfig, 'intensity', 1, 60).onChange(() => {
fireworks.setOptions(fireworksConfig)
})

Expand Down
10 changes: 5 additions & 5 deletions src/fireworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface FireworksOptions {
lineCap?: CanvasLineCap
lineJoin?: CanvasLineJoin
traceSpeed?: number
renderSpeed?: number
intensity?: number
}

export interface BrightnessOptions extends MinMaxOptions {
Expand Down Expand Up @@ -98,7 +98,7 @@ export class Fireworks {
private brightness: Required<BrightnessOptions>
private lineWidth: LineWidthOptions
private traceSpeed: number
private renderSpeed: number
private intensity: number

private _tick = 0
private _timestamp = performance.now()
Expand Down Expand Up @@ -128,7 +128,7 @@ export class Fireworks {
flickering = 50,
trace = 3,
traceSpeed = 10,
renderSpeed = 60,
intensity = 30,
explosion = 5,
gravity = 1.5,
opacity = 0.5,
Expand Down Expand Up @@ -167,7 +167,7 @@ export class Fireworks {
this.lineCap = lineCap
this.lineJoin = lineJoin
this.traceSpeed = traceSpeed
this.renderSpeed = renderSpeed
this.intensity = intensity

this.hue = {
min: 0,
Expand Down Expand Up @@ -358,7 +358,7 @@ export class Fireworks {

const timeDiff = timestamp - this._timestamp
this._timestamp = timestamp
this._tick += timeDiff * this.renderSpeed / 1000
this._tick += timeDiff * (this.intensity * Math.PI) / 1000
}

private drawBoundaries() {
Expand Down

0 comments on commit 9ea68c0

Please sign in to comment.