|
1 | 1 | import { Pane } from 'tweakpane' |
2 | 2 | import * as EssentialsPlugin from '@tweakpane/plugin-essentials' |
3 | 3 | import { Fireworks } from '../fireworks' |
4 | | -import type { FireworksOptions } from '../fireworks' |
| 4 | +import { fireworksContainer, fireworksOptions, backgroundConfig, mainContainer } from './config' |
5 | 5 | import type { FpsGraphBladeApi } from '@tweakpane/plugin-essentials/dist/types/fps-graph/api/fps-graph' |
6 | 6 |
|
7 | | -const container = document.querySelector<HTMLDivElement>('.container')! |
8 | | -const fireworksContainer = document.querySelector<HTMLDivElement>('.fireworks-container')! |
9 | | -const fireworksOptions: FireworksOptions = { |
10 | | - hue: { |
11 | | - min: 0, |
12 | | - max: 345 |
13 | | - }, |
14 | | - delay: { |
15 | | - min: 30, |
16 | | - max: 60 |
17 | | - }, |
18 | | - rocketsPoint: { |
19 | | - min: 50, |
20 | | - max: 50 |
21 | | - }, |
22 | | - opacity: 0.5, // fillStyle |
23 | | - acceleration: 1.02, |
24 | | - friction: 0.97, |
25 | | - gravity: 1.5, |
26 | | - particles: 90, |
27 | | - trace: 3, |
28 | | - traceSpeed: 10, |
29 | | - explosion: 6, |
30 | | - intensity: 30, |
31 | | - flickering: 50, |
32 | | - lineStyle: 'round', |
33 | | - lineWidth: { |
34 | | - explosion: { |
35 | | - min: 1, |
36 | | - max: 4 |
37 | | - }, |
38 | | - trace: { |
39 | | - min: 0.1, |
40 | | - max: 1 |
41 | | - } |
42 | | - }, |
43 | | - autoresize: true, |
44 | | - brightness: { |
45 | | - min: 50, |
46 | | - max: 80, |
47 | | - decay: { |
48 | | - min: 0.015, |
49 | | - max: 0.03 |
50 | | - } |
51 | | - }, |
52 | | - boundaries: { |
53 | | - x: 50, |
54 | | - y: 50, |
55 | | - width: fireworksContainer.clientWidth, |
56 | | - height: fireworksContainer.clientHeight, |
57 | | - visible: false |
58 | | - }, |
59 | | - sound: { |
60 | | - enabled: false, |
61 | | - files: [ |
62 | | - location.href + 'sounds/explosion0.mp3', |
63 | | - location.href + 'sounds/explosion1.mp3', |
64 | | - location.href + 'sounds/explosion2.mp3' |
65 | | - ], |
66 | | - volume: { |
67 | | - min: 2, |
68 | | - max: 4 |
69 | | - } |
70 | | - }, |
71 | | - mouse: { |
72 | | - click: true, |
73 | | - move: false, |
74 | | - max: 10 |
75 | | - } |
76 | | -} |
77 | | - |
78 | | -const backgroundConfig = { |
79 | | - color: '#000000', |
80 | | - image: '', |
81 | | - size: 'cover', |
82 | | - position: '50% 50%', |
83 | | - repeat: 'no-repeat', |
84 | | - container: false, |
85 | | - fps: false |
86 | | -} |
87 | | - |
88 | 7 | const fireworks = new Fireworks(fireworksContainer, fireworksOptions) |
89 | 8 | fireworks.start() |
90 | 9 |
|
@@ -246,7 +165,9 @@ const background = tweakpane.addFolder({ |
246 | 165 | background |
247 | 166 | .addInput(backgroundConfig, 'container') |
248 | 167 | .on('change', ({ value }) => { |
249 | | - container.style.display = value ? 'none' : 'block' |
| 168 | + mainContainer.style.display = value ? |
| 169 | + 'none' : |
| 170 | + 'block' |
250 | 171 | }) |
251 | 172 |
|
252 | 173 | background |
|
0 commit comments