@basmilius/sparkle 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +317 -459
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1258 -949
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/src/aurora/index.ts +9 -3
- package/src/aurora/layer.ts +57 -29
- package/src/balloons/index.ts +9 -3
- package/src/balloons/layer.ts +50 -19
- package/src/bubbles/index.ts +9 -3
- package/src/bubbles/layer.ts +30 -17
- package/src/canvas.ts +92 -2
- package/src/color.ts +11 -2
- package/src/confetti/index.ts +15 -3
- package/src/confetti/layer.ts +8 -5
- package/src/confetti/particle.ts +12 -11
- package/src/confetti/shapes.ts +84 -97
- package/src/donuts/consts.ts +2 -2
- package/src/donuts/index.ts +9 -3
- package/src/donuts/layer.ts +43 -12
- package/src/effect.ts +107 -0
- package/src/fade.ts +87 -0
- package/src/fireflies/index.ts +9 -3
- package/src/fireflies/layer.ts +26 -9
- package/src/fireflies/particle.ts +2 -2
- package/src/firepit/index.ts +9 -3
- package/src/firepit/layer.ts +26 -7
- package/src/fireworks/create-explosion.ts +237 -0
- package/src/fireworks/explosion.ts +1 -1
- package/src/fireworks/index.ts +15 -3
- package/src/fireworks/layer.ts +55 -304
- package/src/fireworks/spark.ts +2 -2
- package/src/fireworks/types.ts +2 -2
- package/src/glitter/index.ts +9 -4
- package/src/glitter/layer.ts +15 -7
- package/src/glitter/types.ts +10 -0
- package/src/index.ts +3 -4
- package/src/lanterns/index.ts +9 -4
- package/src/lanterns/layer.ts +22 -10
- package/src/lanterns/types.ts +8 -0
- package/src/layer.ts +13 -11
- package/src/leaves/index.ts +9 -4
- package/src/leaves/layer.ts +21 -14
- package/src/leaves/types.ts +9 -0
- package/src/lightning/index.ts +9 -4
- package/src/lightning/layer.ts +4 -4
- package/src/lightning/system.ts +3 -3
- package/src/lightning/types.ts +10 -2
- package/src/matrix/index.ts +9 -4
- package/src/matrix/layer.ts +15 -7
- package/src/matrix/types.ts +9 -0
- package/src/orbits/index.ts +9 -4
- package/src/orbits/layer.ts +51 -21
- package/src/orbits/types.ts +12 -1
- package/src/particles/index.ts +9 -3
- package/src/particles/layer.ts +55 -12
- package/src/petals/index.ts +9 -3
- package/src/petals/layer.ts +29 -13
- package/src/plasma/index.ts +9 -3
- package/src/plasma/layer.ts +21 -6
- package/src/rain/index.ts +9 -3
- package/src/rain/layer.ts +30 -8
- package/src/sandstorm/index.ts +9 -3
- package/src/sandstorm/layer.ts +26 -9
- package/src/scene.ts +204 -0
- package/src/shooting-stars/system.ts +26 -24
- package/src/shooting-stars/types.ts +2 -1
- package/src/simulation-canvas.ts +45 -6
- package/src/snow/index.ts +9 -3
- package/src/snow/layer.ts +24 -11
- package/src/sparklers/index.ts +13 -3
- package/src/sparklers/layer.ts +61 -15
- package/src/stars/index.ts +9 -3
- package/src/stars/layer.ts +28 -22
- package/src/streamers/index.ts +9 -3
- package/src/streamers/layer.ts +18 -6
- package/src/streamers/types.ts +1 -1
- package/src/waves/index.ts +9 -3
- package/src/waves/layer.ts +42 -45
- package/src/waves/types.ts +1 -0
- package/src/wormhole/index.ts +9 -3
- package/src/wormhole/layer.ts +22 -6
- package/src/aurora/simulation.ts +0 -19
- package/src/balloons/simulation.ts +0 -19
- package/src/bubbles/simulation.ts +0 -20
- package/src/confetti/simulation.ts +0 -27
- package/src/donuts/simulation.ts +0 -25
- package/src/fireflies/simulation.ts +0 -18
- package/src/firepit/simulation.ts +0 -17
- package/src/fireworks/simulation.ts +0 -18
- package/src/glitter/simulation.ts +0 -19
- package/src/lanterns/simulation.ts +0 -17
- package/src/layered.ts +0 -185
- package/src/leaves/simulation.ts +0 -18
- package/src/lightning/simulation.ts +0 -17
- package/src/matrix/simulation.ts +0 -18
- package/src/orbits/simulation.ts +0 -19
- package/src/particles/simulation.ts +0 -26
- package/src/petals/simulation.ts +0 -18
- package/src/plasma/simulation.ts +0 -17
- package/src/rain/simulation.ts +0 -21
- package/src/sandstorm/simulation.ts +0 -18
- package/src/snow/simulation.ts +0 -17
- package/src/sparklers/simulation.ts +0 -30
- package/src/stars/simulation.ts +0 -22
- package/src/streamers/simulation.ts +0 -16
- package/src/waves/simulation.ts +0 -18
- package/src/wormhole/simulation.ts +0 -17
package/src/orbits/simulation.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { OrbitLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface OrbitSimulationConfig {
|
|
5
|
-
readonly centers?: number;
|
|
6
|
-
readonly orbitersPerCenter?: number;
|
|
7
|
-
readonly speed?: number;
|
|
8
|
-
readonly colors?: string[];
|
|
9
|
-
readonly trailLength?: number;
|
|
10
|
-
readonly showCenters?: boolean;
|
|
11
|
-
readonly scale?: number;
|
|
12
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class OrbitSimulation extends SimulationCanvas {
|
|
16
|
-
constructor(canvas: HTMLCanvasElement, config: OrbitSimulationConfig = {}) {
|
|
17
|
-
super(canvas, new OrbitLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { ParticleLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface ParticleSimulationConfig {
|
|
5
|
-
readonly count?: number;
|
|
6
|
-
readonly color?: string;
|
|
7
|
-
readonly lineColor?: string;
|
|
8
|
-
readonly size?: [number, number];
|
|
9
|
-
readonly speed?: [number, number];
|
|
10
|
-
readonly connectionDistance?: number;
|
|
11
|
-
readonly lineWidth?: number;
|
|
12
|
-
readonly mouseMode?: import('./types').ParticleMouseMode;
|
|
13
|
-
readonly mouseRadius?: number;
|
|
14
|
-
readonly mouseStrength?: number;
|
|
15
|
-
readonly particleForces?: boolean;
|
|
16
|
-
readonly glow?: boolean;
|
|
17
|
-
readonly background?: string | null;
|
|
18
|
-
readonly scale?: number;
|
|
19
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class ParticleSimulation extends SimulationCanvas {
|
|
23
|
-
constructor(canvas: HTMLCanvasElement, config: ParticleSimulationConfig = {}) {
|
|
24
|
-
super(canvas, new ParticleLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
25
|
-
}
|
|
26
|
-
}
|
package/src/petals/simulation.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { PetalLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface PetalSimulationConfig {
|
|
5
|
-
readonly count?: number;
|
|
6
|
-
readonly colors?: string[];
|
|
7
|
-
readonly size?: number;
|
|
8
|
-
readonly speed?: number;
|
|
9
|
-
readonly wind?: number;
|
|
10
|
-
readonly scale?: number;
|
|
11
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class PetalSimulation extends SimulationCanvas {
|
|
15
|
-
constructor(canvas: HTMLCanvasElement, config: PetalSimulationConfig = {}) {
|
|
16
|
-
super(canvas, new PetalLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/plasma/simulation.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { PlasmaLayer } from './layer';
|
|
3
|
-
import type { PlasmaColor } from './types';
|
|
4
|
-
|
|
5
|
-
export interface PlasmaSimulationConfig {
|
|
6
|
-
readonly speed?: number;
|
|
7
|
-
readonly scale?: number;
|
|
8
|
-
readonly resolution?: number;
|
|
9
|
-
readonly palette?: PlasmaColor[];
|
|
10
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class PlasmaSimulation extends SimulationCanvas {
|
|
14
|
-
constructor(canvas: HTMLCanvasElement, config: PlasmaSimulationConfig = {}) {
|
|
15
|
-
super(canvas, new PlasmaLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
16
|
-
}
|
|
17
|
-
}
|
package/src/rain/simulation.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { RainLayer } from './layer';
|
|
3
|
-
import type { RainVariant } from './types';
|
|
4
|
-
|
|
5
|
-
export interface RainSimulationConfig {
|
|
6
|
-
readonly variant?: RainVariant;
|
|
7
|
-
readonly drops?: number;
|
|
8
|
-
readonly wind?: number;
|
|
9
|
-
readonly speed?: number;
|
|
10
|
-
readonly splashes?: boolean;
|
|
11
|
-
readonly color?: string;
|
|
12
|
-
readonly groundLevel?: number;
|
|
13
|
-
readonly scale?: number;
|
|
14
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class RainSimulation extends SimulationCanvas {
|
|
18
|
-
constructor(canvas: HTMLCanvasElement, config: RainSimulationConfig = {}) {
|
|
19
|
-
super(canvas, new RainLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { SandstormLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface SandstormSimulationConfig {
|
|
5
|
-
readonly count?: number;
|
|
6
|
-
readonly wind?: number;
|
|
7
|
-
readonly turbulence?: number;
|
|
8
|
-
readonly color?: string;
|
|
9
|
-
readonly hazeOpacity?: number;
|
|
10
|
-
readonly scale?: number;
|
|
11
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class SandstormSimulation extends SimulationCanvas {
|
|
15
|
-
constructor(canvas: HTMLCanvasElement, config: SandstormSimulationConfig = {}) {
|
|
16
|
-
super(canvas, new SandstormLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/snow/simulation.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { SnowLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface SnowSimulationConfig {
|
|
5
|
-
readonly fillStyle?: string;
|
|
6
|
-
readonly particles?: number;
|
|
7
|
-
readonly scale?: number;
|
|
8
|
-
readonly size?: number;
|
|
9
|
-
readonly speed?: number;
|
|
10
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class SnowSimulation extends SimulationCanvas {
|
|
14
|
-
constructor(canvas: HTMLCanvasElement, config: SnowSimulationConfig = {}) {
|
|
15
|
-
super(canvas, new SnowLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { SparklerLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface SparklerSimulationConfig {
|
|
5
|
-
readonly emitRate?: number;
|
|
6
|
-
readonly maxSparks?: number;
|
|
7
|
-
readonly colors?: string[];
|
|
8
|
-
readonly speed?: [number, number];
|
|
9
|
-
readonly friction?: number;
|
|
10
|
-
readonly gravity?: number;
|
|
11
|
-
readonly decay?: [number, number];
|
|
12
|
-
readonly trailLength?: number;
|
|
13
|
-
readonly hoverMode?: boolean;
|
|
14
|
-
readonly scale?: number;
|
|
15
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class SparklerSimulation extends SimulationCanvas {
|
|
19
|
-
readonly #layer: SparklerLayer;
|
|
20
|
-
|
|
21
|
-
constructor(canvas: HTMLCanvasElement, config: SparklerSimulationConfig = {}) {
|
|
22
|
-
const layer = new SparklerLayer(config);
|
|
23
|
-
super(canvas, layer, 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
24
|
-
this.#layer = layer;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
setPosition(x: number, y: number): void {
|
|
28
|
-
this.#layer.setPosition(x, y);
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/stars/simulation.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { StarLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface StarSimulationConfig {
|
|
5
|
-
readonly mode?: import('./types').StarMode;
|
|
6
|
-
readonly starCount?: number;
|
|
7
|
-
readonly shootingInterval?: [number, number];
|
|
8
|
-
readonly shootingSpeed?: number;
|
|
9
|
-
readonly twinkleSpeed?: number;
|
|
10
|
-
readonly color?: string;
|
|
11
|
-
readonly shootingColor?: string;
|
|
12
|
-
readonly trailLength?: number;
|
|
13
|
-
readonly scale?: number;
|
|
14
|
-
readonly verticalFade?: [number, number];
|
|
15
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class StarSimulation extends SimulationCanvas {
|
|
19
|
-
constructor(canvas: HTMLCanvasElement, config: StarSimulationConfig = {}) {
|
|
20
|
-
super(canvas, new StarLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { StreamerLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface StreamerSimulationConfig {
|
|
5
|
-
readonly count?: number;
|
|
6
|
-
readonly colors?: string[];
|
|
7
|
-
readonly speed?: number;
|
|
8
|
-
readonly scale?: number;
|
|
9
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class StreamerSimulation extends SimulationCanvas {
|
|
13
|
-
constructor(canvas: HTMLCanvasElement, config: StreamerSimulationConfig = {}) {
|
|
14
|
-
super(canvas, new StreamerLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/waves/simulation.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { WaveLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface WaveSimulationConfig {
|
|
5
|
-
readonly layers?: number;
|
|
6
|
-
readonly speed?: number;
|
|
7
|
-
readonly colors?: string[];
|
|
8
|
-
readonly foamColor?: string;
|
|
9
|
-
readonly foamAmount?: number;
|
|
10
|
-
readonly scale?: number;
|
|
11
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class WaveSimulation extends SimulationCanvas {
|
|
15
|
-
constructor(canvas: HTMLCanvasElement, config: WaveSimulationConfig = {}) {
|
|
16
|
-
super(canvas, new WaveLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { SimulationCanvas } from '../simulation-canvas';
|
|
2
|
-
import { WormholeLayer } from './layer';
|
|
3
|
-
|
|
4
|
-
export interface WormholeSimulationConfig {
|
|
5
|
-
readonly count?: number;
|
|
6
|
-
readonly speed?: number;
|
|
7
|
-
readonly color?: string;
|
|
8
|
-
readonly direction?: import('./types').WormholeDirection;
|
|
9
|
-
readonly scale?: number;
|
|
10
|
-
readonly canvasOptions?: CanvasRenderingContext2DSettings;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class WormholeSimulation extends SimulationCanvas {
|
|
14
|
-
constructor(canvas: HTMLCanvasElement, config: WormholeSimulationConfig = {}) {
|
|
15
|
-
super(canvas, new WormholeLayer(config), 60, config.canvasOptions ?? {colorSpace: 'display-p3'});
|
|
16
|
-
}
|
|
17
|
-
}
|