beautiful-backgrounds 1.1.0 → 2.1.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/README.md +108 -76
- package/build/bb.es.js +44 -2990
- package/build/bb.es.js.map +1 -1
- package/build/bb.js +45 -3
- package/build/bb.js.map +1 -1
- package/build/index.d.ts +475 -8
- package/package.json +67 -52
- package/build/src/BeautifulBackground.d.ts +0 -25
- package/build/src/Particle.d.ts +0 -53
- package/build/src/Symbol.d.ts +0 -7
- package/build/src/components/ambientRibbon.d.ts +0 -25
- package/build/src/components/concentricPulse.d.ts +0 -19
- package/build/src/components/digitalRain.d.ts +0 -28
- package/build/src/components/hexagonWave.d.ts +0 -29
- package/build/src/components/liquidLines.d.ts +0 -24
- package/build/src/components/neonRails.d.ts +0 -31
- package/build/src/components/startTrail.d.ts +0 -33
- package/build/src/stories/AmbientRibbon.stories.d.ts +0 -16
- package/build/src/stories/ConcentricPulse.stories.d.ts +0 -15
- package/build/src/stories/DigitalRain.stories.d.ts +0 -13
- package/build/src/stories/HexagonWave.stories.d.ts +0 -19
- package/build/src/stories/LiquidLines.stories.d.ts +0 -17
- package/build/src/stories/NeonRails.stories.d.ts +0 -20
- package/build/src/stories/StartTrail.stories.d.ts +0 -20
- package/build/src/utils/color.d.ts +0 -2
- package/build/src/utils/function.d.ts +0 -1
- package/build/src/utils/lit.d.ts +0 -2
- package/build/src/utils/number.d.ts +0 -2
- package/build/src/utils/object.d.ts +0 -3
- package/build/vite.svg +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,475 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
2
|
+
export declare abstract class BeautifulBackground extends LitElement {
|
|
3
|
+
bgColors: string[];
|
|
4
|
+
bgAngle: number;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
canvas: HTMLCanvasElement;
|
|
7
|
+
ctx: CanvasRenderingContext2D;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
animationFrameId: number | null;
|
|
11
|
+
trailOpacity: number;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the trail fades all the way out, instead of leaving its
|
|
14
|
+
* faintest traces for good. The background then shows from CSS, behind
|
|
15
|
+
* the canvas. `clean-trail="false"` turns it off.
|
|
16
|
+
*/
|
|
17
|
+
cleanTrail: boolean;
|
|
18
|
+
private fadeMasks;
|
|
19
|
+
private fadeTurn;
|
|
20
|
+
protected debouncedResize: () => void;
|
|
21
|
+
constructor();
|
|
22
|
+
protected handleVisibilityChange: () => void;
|
|
23
|
+
protected firstUpdated(): void;
|
|
24
|
+
disconnectedCallback(): void;
|
|
25
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
26
|
+
/** Paints the background, or clears the canvas over it for a clean trail. */
|
|
27
|
+
protected drawBackground(ctx: CanvasRenderingContext2D): void;
|
|
28
|
+
/**
|
|
29
|
+
* Paints the background translucently, so the previous frames fade out
|
|
30
|
+
* into a trail.
|
|
31
|
+
*/
|
|
32
|
+
protected fadeTrail(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Fades the previous frames by `trailOpacity`. The canvas keeps 8 bits per
|
|
35
|
+
* channel, so a fade that faint would round the faintest traces back to
|
|
36
|
+
* themselves, and they would stay for good. Instead, each frame fades a
|
|
37
|
+
* scattered share of the pixels by CLEAN_FADE, which averages out the same.
|
|
38
|
+
*/
|
|
39
|
+
private fadeTrailCleanly;
|
|
40
|
+
/** The background gradient at `bgAngle`, as CSS counts the angle. */
|
|
41
|
+
private cssBackground;
|
|
42
|
+
/** A gradient at `bgAngle` that spans the canvas from edge to edge. */
|
|
43
|
+
private backgroundGradient;
|
|
44
|
+
protected resizeCanvas(): void;
|
|
45
|
+
protected initialize(): void;
|
|
46
|
+
protected startAnimation(): void;
|
|
47
|
+
protected stopAnimation(): void;
|
|
48
|
+
static styles: CSSResultGroup;
|
|
49
|
+
protected abstract loop(deltaTime: number): void;
|
|
50
|
+
render(): void;
|
|
51
|
+
}
|
|
52
|
+
export declare class BbAmbientRibbon extends BeautifulBackground {
|
|
53
|
+
ribbonCount: number;
|
|
54
|
+
ribbonWidth: number;
|
|
55
|
+
ribbonRotation: number;
|
|
56
|
+
ribbonHueStart: number;
|
|
57
|
+
ribbonHueEnd: number;
|
|
58
|
+
ribbonSaturationStart: number;
|
|
59
|
+
ribbonSaturationEnd: number;
|
|
60
|
+
ribbonLightnessStart: number;
|
|
61
|
+
ribbonLightnessEnd: number;
|
|
62
|
+
ribbonAmplitude: number;
|
|
63
|
+
ribbonSpeedMin: number;
|
|
64
|
+
ribbonSpeedMax: number;
|
|
65
|
+
ribbonLineWidth: number;
|
|
66
|
+
ribbonLineOpacity: number;
|
|
67
|
+
private ribbons;
|
|
68
|
+
protected initialize(): void;
|
|
69
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
70
|
+
protected loop(): void;
|
|
71
|
+
/** One line of a ribbon: a bezier curve from edge to edge. */
|
|
72
|
+
private drawLine;
|
|
73
|
+
/** The color of a line, from the oldest (progress 0) to the newest. */
|
|
74
|
+
private lineColor;
|
|
75
|
+
}
|
|
76
|
+
declare global {
|
|
77
|
+
interface HTMLElementTagNameMap {
|
|
78
|
+
"bb-ambient-ribbon": BbAmbientRibbon;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export declare class BbContourFlow extends BeautifulBackground {
|
|
82
|
+
particleAmount: number;
|
|
83
|
+
/** The average life of a particle, in seconds. */
|
|
84
|
+
particleLife: number;
|
|
85
|
+
/** How far the light swells and ebbs, from 0 (not at all) to 1. */
|
|
86
|
+
pulseStrength: number;
|
|
87
|
+
/** Waves of light per second. */
|
|
88
|
+
pulseSpeed: number;
|
|
89
|
+
lineOpacity: number;
|
|
90
|
+
flowSpeed: number;
|
|
91
|
+
terrainSize: number;
|
|
92
|
+
lineColors: string[];
|
|
93
|
+
trailOpacity: number;
|
|
94
|
+
private cols;
|
|
95
|
+
private rows;
|
|
96
|
+
private terrain;
|
|
97
|
+
/** The way downhill at each cell, as x, y pairs. */
|
|
98
|
+
private flow;
|
|
99
|
+
private lowest;
|
|
100
|
+
private highest;
|
|
101
|
+
private shades;
|
|
102
|
+
private time;
|
|
103
|
+
private particles;
|
|
104
|
+
/** The size and settings the terrain and particles were made for. */
|
|
105
|
+
private builtFor;
|
|
106
|
+
protected initialize(): void;
|
|
107
|
+
protected loop(deltaTime: number): void;
|
|
108
|
+
private settings;
|
|
109
|
+
private colors;
|
|
110
|
+
/** Finds the way downhill at each cell, and the lowest and highest ground. */
|
|
111
|
+
private survey;
|
|
112
|
+
/** The index of the shade for the height of the ground under the particle. */
|
|
113
|
+
private shadeIndex;
|
|
114
|
+
private spawn;
|
|
115
|
+
/** The light at the height of a shade, in waves that run downhill. */
|
|
116
|
+
private pulse;
|
|
117
|
+
/** Turns the particle with the flow and moves it a step along its path. */
|
|
118
|
+
private move;
|
|
119
|
+
private stroke;
|
|
120
|
+
}
|
|
121
|
+
declare global {
|
|
122
|
+
interface HTMLElementTagNameMap {
|
|
123
|
+
"bb-contour-flow": BbContourFlow;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
declare class Symbol {
|
|
127
|
+
protected x: number;
|
|
128
|
+
protected y: number;
|
|
129
|
+
constructor(x: number, y: number);
|
|
130
|
+
update(height: number, randomness: number, fontSize: number, deltaTime: number, speed: number): void;
|
|
131
|
+
draw(ctx: CanvasRenderingContext2D, text: string, color: string, fontSize: number, speed: number): void;
|
|
132
|
+
}
|
|
133
|
+
export declare class BbDigitalRain extends BeautifulBackground {
|
|
134
|
+
speed: number;
|
|
135
|
+
characters: string;
|
|
136
|
+
randomness: number;
|
|
137
|
+
fontSize: number;
|
|
138
|
+
fontColorHueStart: number;
|
|
139
|
+
fontColorHueEnd: number;
|
|
140
|
+
fontColorSaturationStart: number;
|
|
141
|
+
fontColorSaturationEnd: number;
|
|
142
|
+
fontColorLightnessStart: number;
|
|
143
|
+
fontColorLightnessEnd: number;
|
|
144
|
+
fontColors: string[];
|
|
145
|
+
columns: number;
|
|
146
|
+
symbols: Symbol[];
|
|
147
|
+
constructor();
|
|
148
|
+
protected initialize(): void;
|
|
149
|
+
private createSymbols;
|
|
150
|
+
private updateSymbols;
|
|
151
|
+
protected loop(deltaTime: number): void;
|
|
152
|
+
private randomCharacter;
|
|
153
|
+
private symbolColor;
|
|
154
|
+
protected createSymbol(index: number): Symbol;
|
|
155
|
+
}
|
|
156
|
+
declare global {
|
|
157
|
+
interface HTMLElementTagNameMap {
|
|
158
|
+
"bb-digital-rain": BbDigitalRain;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export declare class BbGradientSlats extends BeautifulBackground {
|
|
162
|
+
washColors: string[];
|
|
163
|
+
/** How many slats lie across the background, at least 2. */
|
|
164
|
+
slatAmount: number;
|
|
165
|
+
/** How far the slats lean, in degrees clockwise: 0 stands upright. */
|
|
166
|
+
slatAngle: number;
|
|
167
|
+
/** How fast the wash wanders: 2 is twice as fast, 0 stands still. */
|
|
168
|
+
speed: number;
|
|
169
|
+
trailOpacity: number;
|
|
170
|
+
cleanTrail: boolean;
|
|
171
|
+
/** How far the wash has wandered, in seconds at speed 1. */
|
|
172
|
+
private time;
|
|
173
|
+
protected loop(deltaTime: number): void;
|
|
174
|
+
private drawWash;
|
|
175
|
+
private drawSlats;
|
|
176
|
+
}
|
|
177
|
+
declare global {
|
|
178
|
+
interface HTMLElementTagNameMap {
|
|
179
|
+
"bb-gradient-slats": BbGradientSlats;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export declare class BbHexagonWave extends BeautifulBackground {
|
|
183
|
+
hexSize: number;
|
|
184
|
+
waveAmplitude: number;
|
|
185
|
+
waveSpeed: number;
|
|
186
|
+
waveXFactor: number;
|
|
187
|
+
waveYFactor: number;
|
|
188
|
+
shadeAmplitude: number;
|
|
189
|
+
shadeLightnessBoost: number;
|
|
190
|
+
baseLightness: number;
|
|
191
|
+
lightnessRange: number;
|
|
192
|
+
hexHueStart: number;
|
|
193
|
+
hexHueEnd: number;
|
|
194
|
+
hexSaturation: number;
|
|
195
|
+
hexScale: number;
|
|
196
|
+
hexColors: string[];
|
|
197
|
+
private grid;
|
|
198
|
+
private time;
|
|
199
|
+
protected updated(changedProperties: PropertyValues): void;
|
|
200
|
+
protected initialize(): void;
|
|
201
|
+
protected loop(deltaTime: number): void;
|
|
202
|
+
private drawCell;
|
|
203
|
+
private cellFill;
|
|
204
|
+
private drawHex;
|
|
205
|
+
}
|
|
206
|
+
declare global {
|
|
207
|
+
interface HTMLElementTagNameMap {
|
|
208
|
+
"bb-hexagon-wave": BbHexagonWave;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
export declare class BbLightShafts extends BeautifulBackground {
|
|
212
|
+
shaftColors: string[];
|
|
213
|
+
/** How many shafts there are, however wide the background is. */
|
|
214
|
+
shaftAmount: number;
|
|
215
|
+
/** How fast the shafts drift: 2 is twice as fast, 0 stands still. */
|
|
216
|
+
speed: number;
|
|
217
|
+
trailOpacity: number;
|
|
218
|
+
cleanTrail: boolean;
|
|
219
|
+
private shafts;
|
|
220
|
+
/** The size, amount and colors the shafts were made for. */
|
|
221
|
+
private builtFor;
|
|
222
|
+
protected initialize(): void;
|
|
223
|
+
protected loop(deltaTime: number): void;
|
|
224
|
+
private settings;
|
|
225
|
+
/** A new shaft in `color`, somewhere on the canvas, at a random depth. */
|
|
226
|
+
private shaft;
|
|
227
|
+
}
|
|
228
|
+
declare global {
|
|
229
|
+
interface HTMLElementTagNameMap {
|
|
230
|
+
"bb-light-shafts": BbLightShafts;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
export declare class BbLiquidLines extends BeautifulBackground {
|
|
234
|
+
lineCount: number;
|
|
235
|
+
lineAmplitude: number;
|
|
236
|
+
lineFrequency: number;
|
|
237
|
+
speed: number;
|
|
238
|
+
lineSpacing: number;
|
|
239
|
+
lineWidth: number;
|
|
240
|
+
lineHueStart: number;
|
|
241
|
+
lineHueEnd: number;
|
|
242
|
+
lineSaturation: number;
|
|
243
|
+
lineOffsetStep: number;
|
|
244
|
+
wiggleAmplitude: number;
|
|
245
|
+
wiggleSpeed: number;
|
|
246
|
+
lineColors: string[];
|
|
247
|
+
private time;
|
|
248
|
+
protected loop(deltaTime: number): void;
|
|
249
|
+
private drawLine;
|
|
250
|
+
/** The line's color, with a lightness that varies for a "depth" effect. */
|
|
251
|
+
private lineColor;
|
|
252
|
+
}
|
|
253
|
+
declare global {
|
|
254
|
+
interface HTMLElementTagNameMap {
|
|
255
|
+
"bb-liquid-lines": BbLiquidLines;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
declare class Particle {
|
|
259
|
+
private size;
|
|
260
|
+
private speed;
|
|
261
|
+
private color;
|
|
262
|
+
private radius;
|
|
263
|
+
private angle;
|
|
264
|
+
private lifespan;
|
|
265
|
+
private force;
|
|
266
|
+
private x;
|
|
267
|
+
private y;
|
|
268
|
+
private px;
|
|
269
|
+
private py;
|
|
270
|
+
private initialized;
|
|
271
|
+
private born;
|
|
272
|
+
private fadeInDuration;
|
|
273
|
+
private fadeOutDuration;
|
|
274
|
+
constructor(options: ParticleOptions);
|
|
275
|
+
circularMove(centerX: number, centerY: number, deltaTime: number): void;
|
|
276
|
+
draw(ctx: CanvasRenderingContext2D): void;
|
|
277
|
+
isDead(): boolean;
|
|
278
|
+
private gridSides;
|
|
279
|
+
private gridSize;
|
|
280
|
+
private gridAngle;
|
|
281
|
+
private railFromX;
|
|
282
|
+
private railFromY;
|
|
283
|
+
private railToX;
|
|
284
|
+
private railToY;
|
|
285
|
+
private railProgress;
|
|
286
|
+
railMove(centerX: number, centerY: number, deltaTime: number): void;
|
|
287
|
+
/** Snaps the particle onto the nearest grid node and picks a first rail. */
|
|
288
|
+
private enterRail;
|
|
289
|
+
private pickNextRailTarget;
|
|
290
|
+
/** Snaps in the grid's own frame around (ox, oy), then rotates back. */
|
|
291
|
+
private snapToGrid;
|
|
292
|
+
private nearestNode;
|
|
293
|
+
private updatePosition;
|
|
294
|
+
private calculateOpacity;
|
|
295
|
+
}
|
|
296
|
+
interface ParticleOptions {
|
|
297
|
+
size: number;
|
|
298
|
+
speed: number;
|
|
299
|
+
color: string;
|
|
300
|
+
radius?: number;
|
|
301
|
+
angle: number;
|
|
302
|
+
lifespan: number;
|
|
303
|
+
force?: number;
|
|
304
|
+
gridSides: number;
|
|
305
|
+
gridSize: number;
|
|
306
|
+
gridAngle: number;
|
|
307
|
+
x?: number;
|
|
308
|
+
y?: number;
|
|
309
|
+
}
|
|
310
|
+
/** Where a new particle starts and how it is pushed. */
|
|
311
|
+
type ParticlePlacement = Pick<ParticleOptions, "angle" | "radius" | "force" | "x" | "y">;
|
|
312
|
+
/**
|
|
313
|
+
* A background of particles that fade in, move and fade out again, with a
|
|
314
|
+
* new particle taking the place of every one that dies. Subclasses decide
|
|
315
|
+
* where a particle starts and how it moves.
|
|
316
|
+
*/
|
|
317
|
+
declare abstract class ParticleBackground extends BeautifulBackground {
|
|
318
|
+
particleSizeMin: number;
|
|
319
|
+
particleSizeMax: number;
|
|
320
|
+
particleSpeedMin: number;
|
|
321
|
+
particleSpeedMax: number;
|
|
322
|
+
particleColorHueStart: number;
|
|
323
|
+
particleColorHueEnd: number;
|
|
324
|
+
particleColorSaturationStart: number;
|
|
325
|
+
particleColorSaturationEnd: number;
|
|
326
|
+
particleColorLightnessStart: number;
|
|
327
|
+
particleColorLightnessEnd: number;
|
|
328
|
+
particleLifespanMin: number;
|
|
329
|
+
particleLifespanMax: number;
|
|
330
|
+
particleAmount: number;
|
|
331
|
+
gridSides: number;
|
|
332
|
+
gridSize: number;
|
|
333
|
+
gridAngle: number;
|
|
334
|
+
particleColors: string[];
|
|
335
|
+
private particles;
|
|
336
|
+
protected initialize(): void;
|
|
337
|
+
protected loop(deltaTime: number): void;
|
|
338
|
+
protected createParticle(): Particle;
|
|
339
|
+
/** Moves one particle by one frame. */
|
|
340
|
+
protected abstract move(particle: Particle, deltaTime: number): void;
|
|
341
|
+
/** Where a new particle starts. */
|
|
342
|
+
protected abstract placement(): ParticlePlacement;
|
|
343
|
+
private replenish;
|
|
344
|
+
private particleColor;
|
|
345
|
+
}
|
|
346
|
+
export declare class BbNeonRails extends ParticleBackground {
|
|
347
|
+
trailOpacity: number;
|
|
348
|
+
protected move(particle: Particle, deltaTime: number): void;
|
|
349
|
+
/** Anywhere on the canvas, heading away from the center. */
|
|
350
|
+
protected placement(): ParticlePlacement;
|
|
351
|
+
}
|
|
352
|
+
declare global {
|
|
353
|
+
interface HTMLElementTagNameMap {
|
|
354
|
+
"bb-neon-rails": BbNeonRails;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
export declare class BbSilkWaves extends BeautifulBackground {
|
|
358
|
+
silkColor: string;
|
|
359
|
+
/** How high the nearest waves rise, as a share of the height. */
|
|
360
|
+
swell: number;
|
|
361
|
+
/** How brightly the crests shine above the troughs: 1 is glassy, 0 matte. */
|
|
362
|
+
sheen: number;
|
|
363
|
+
/**
|
|
364
|
+
* How far the silk reaches into the distance: at 2 its waves lie twice
|
|
365
|
+
* as far away and half as large as at 1.
|
|
366
|
+
*/
|
|
367
|
+
reach: number;
|
|
368
|
+
/** How fast the waves roll: 2 is twice as fast, 0 stands still. */
|
|
369
|
+
speed: number;
|
|
370
|
+
trailOpacity: number;
|
|
371
|
+
cleanTrail: boolean;
|
|
372
|
+
private time;
|
|
373
|
+
protected loop(deltaTime: number): void;
|
|
374
|
+
private drawSea;
|
|
375
|
+
/**
|
|
376
|
+
* The silk's curve at `n2` squared screen depth from its far edge, from
|
|
377
|
+
* the left edge of the canvas to the right.
|
|
378
|
+
*/
|
|
379
|
+
private curve;
|
|
380
|
+
/**
|
|
381
|
+
* Paints the sea's row over everything farther than it: its curve across
|
|
382
|
+
* the canvas, and everything below it down to the front.
|
|
383
|
+
*/
|
|
384
|
+
private paintRow;
|
|
385
|
+
}
|
|
386
|
+
declare global {
|
|
387
|
+
interface HTMLElementTagNameMap {
|
|
388
|
+
"bb-silk-waves": BbSilkWaves;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
export declare class BbSmokeRing extends BeautifulBackground {
|
|
392
|
+
ringColors: string[];
|
|
393
|
+
/** The ring's radius, as a share of the shorter side. */
|
|
394
|
+
ringSize: number;
|
|
395
|
+
/** How far the ring's waves swell, as a share of its radius. */
|
|
396
|
+
ringWobble: number;
|
|
397
|
+
/** How fast everything moves: 2 is twice as fast, 0 stands still. */
|
|
398
|
+
speed: number;
|
|
399
|
+
trailOpacity: number;
|
|
400
|
+
cleanTrail: boolean;
|
|
401
|
+
private time;
|
|
402
|
+
private columns;
|
|
403
|
+
private rows;
|
|
404
|
+
/** The light of each pixel of the buffer, as red, green and blue from 0 to 1. */
|
|
405
|
+
private smoke;
|
|
406
|
+
/** The next frame's smoke, worked out from this one's. */
|
|
407
|
+
private next;
|
|
408
|
+
/**
|
|
409
|
+
* The smoke as it shows: each pixel's light mixed with its four
|
|
410
|
+
* neighbours'. The smoke pushes itself by these colors too, so that
|
|
411
|
+
* neighbouring pixels push alike and its edges grow smooth instead of
|
|
412
|
+
* jagged.
|
|
413
|
+
*/
|
|
414
|
+
private soft;
|
|
415
|
+
private image;
|
|
416
|
+
private buffer;
|
|
417
|
+
/** The size the buffer was made for. */
|
|
418
|
+
private builtFor;
|
|
419
|
+
protected initialize(): void;
|
|
420
|
+
protected loop(deltaTime: number): void;
|
|
421
|
+
private size;
|
|
422
|
+
/**
|
|
423
|
+
* Moves the smoke on by `frames` frames at 60 fps: each pixel takes most
|
|
424
|
+
* of its smoke from a little nearer the middle and a little off to the
|
|
425
|
+
* side, and the rest from where its own colors push it.
|
|
426
|
+
*/
|
|
427
|
+
private drift;
|
|
428
|
+
/**
|
|
429
|
+
* Adds `share` of the smoke at (x, y), between pixels, to the next frame's
|
|
430
|
+
* pixel `i`. Outside the buffer, it takes the nearest edge.
|
|
431
|
+
*/
|
|
432
|
+
private takeSmoke;
|
|
433
|
+
/** Adds the light the ring gives off in `frames` frames at 60 fps. */
|
|
434
|
+
private shine;
|
|
435
|
+
/** The ring's color now, from 0 to 1, on its way from one color to the next. */
|
|
436
|
+
private ringColor;
|
|
437
|
+
/** Mixes each pixel's light with its four neighbours' into `soft`. */
|
|
438
|
+
private soften;
|
|
439
|
+
/** Paints the soft smoke onto the background, adding its light. */
|
|
440
|
+
private show;
|
|
441
|
+
}
|
|
442
|
+
declare global {
|
|
443
|
+
interface HTMLElementTagNameMap {
|
|
444
|
+
"bb-smoke-ring": BbSmokeRing;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
export declare class BbStarTrail extends ParticleBackground {
|
|
448
|
+
particleForce: number;
|
|
449
|
+
particleRadiusMin: number;
|
|
450
|
+
particleRadiusMax: number;
|
|
451
|
+
particleSizeMin: number;
|
|
452
|
+
particleSizeMax: number;
|
|
453
|
+
particleSpeedMin: number;
|
|
454
|
+
particleSpeedMax: number;
|
|
455
|
+
particleColorHueStart: number;
|
|
456
|
+
particleColorHueEnd: number;
|
|
457
|
+
particleColorLightnessEnd: number;
|
|
458
|
+
particleLifespanMin: number;
|
|
459
|
+
particleLifespanMax: number;
|
|
460
|
+
particleAmount: number;
|
|
461
|
+
gridSides: number;
|
|
462
|
+
gridSize: number;
|
|
463
|
+
gridAngle: number;
|
|
464
|
+
protected initialize(): void;
|
|
465
|
+
protected move(particle: Particle, deltaTime: number): void;
|
|
466
|
+
/** On an orbit around the center, spread evenly over the disc. */
|
|
467
|
+
protected placement(): ParticlePlacement;
|
|
468
|
+
}
|
|
469
|
+
declare global {
|
|
470
|
+
interface HTMLElementTagNameMap {
|
|
471
|
+
"bb-star-trail": BbStarTrail;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
export {};
|
|
475
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beautiful-backgrounds",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "A collection of customizable web components for creating dynamic, animated backgrounds, featuring a variety of effects including a star field and a digital rain. ",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ambient",
|
|
7
|
+
"animated-background",
|
|
8
|
+
"animation",
|
|
9
|
+
"background",
|
|
10
|
+
"background-effects",
|
|
11
|
+
"beautiful-backgrounds",
|
|
12
|
+
"canvas",
|
|
13
|
+
"canvas-animation",
|
|
14
|
+
"custom-elements",
|
|
15
|
+
"dynamic-background",
|
|
16
|
+
"html5-canvas",
|
|
17
|
+
"interactive-background",
|
|
18
|
+
"star-field",
|
|
19
|
+
"typescript",
|
|
20
|
+
"visual-effects",
|
|
21
|
+
"web-components"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Niekes",
|
|
5
25
|
"repository": {
|
|
6
26
|
"type": "git",
|
|
7
27
|
"url": "git+https://github.com/Niekes/beautiful-backgrounds.git"
|
|
8
28
|
},
|
|
29
|
+
"files": [
|
|
30
|
+
"build",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
9
35
|
"main": "./build/bb.js",
|
|
10
36
|
"module": "./build/bb.es.js",
|
|
11
37
|
"types": "./build/index.d.ts",
|
|
@@ -19,64 +45,53 @@
|
|
|
19
45
|
"publishConfig": {
|
|
20
46
|
"access": "public"
|
|
21
47
|
},
|
|
22
|
-
"files": [
|
|
23
|
-
"build",
|
|
24
|
-
"README.md",
|
|
25
|
-
"LICENSE"
|
|
26
|
-
],
|
|
27
48
|
"scripts": {
|
|
28
|
-
"clean": "rm -rf build",
|
|
49
|
+
"clean": "rm -rf build coverage",
|
|
29
50
|
"typecheck": "tsc --noEmit",
|
|
30
|
-
"
|
|
31
|
-
"build": "npm run clean && tsc && vite build",
|
|
32
|
-
"build:types": "tsc --emitDeclarationOnly --declaration --outDir build",
|
|
33
|
-
"preview": "vite preview",
|
|
51
|
+
"build": "npm run clean && npm run typecheck && vp pack",
|
|
34
52
|
"pretest": "npm run typecheck",
|
|
35
|
-
"test": "
|
|
53
|
+
"test": "vp test run",
|
|
54
|
+
"test:watch": "vp test",
|
|
55
|
+
"coverage": "vp test run --coverage",
|
|
56
|
+
"fmt": "vp fmt",
|
|
57
|
+
"lint:code": "vp lint && vp fmt --check",
|
|
58
|
+
"lint:fallow": "fallow dead-code --ci --format ${FALLOW_FORMAT:-human} && fallow health --ci --coverage-gaps --min-score 100 --format ${FALLOW_FORMAT:-human} && fallow dupes --ci --format ${FALLOW_FORMAT:-human}",
|
|
59
|
+
"lint": "npm run lint:code && npm run lint:fallow",
|
|
60
|
+
"verify": "npm run lint && npm run typecheck && npm run coverage",
|
|
61
|
+
"hooks:install": "fallow hooks install --target git && fallow hooks install --target agent --agent claude",
|
|
36
62
|
"storybook": "storybook dev -p 6006",
|
|
37
63
|
"build-storybook": "storybook build",
|
|
38
|
-
"
|
|
64
|
+
"gifs": "npm run build-storybook && node scripts/record-gifs.mjs",
|
|
65
|
+
"prepack": "npm run build",
|
|
66
|
+
"badges": "node scripts/badges.mjs"
|
|
39
67
|
},
|
|
40
68
|
"dependencies": {},
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"lit": "^3.0.0"
|
|
43
|
-
},
|
|
44
69
|
"devDependencies": {
|
|
45
|
-
"@storybook/addon-a11y": "^10.6.
|
|
46
|
-
"@storybook/addon-docs": "^10.6.
|
|
47
|
-
"@storybook/addon-vitest": "^10.6.
|
|
48
|
-
"@storybook/web-components-vite": "^10.6.
|
|
49
|
-
"@types/
|
|
50
|
-
"@
|
|
51
|
-
"@vitest/coverage-v8": "
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"typescript": "~7.0.2",
|
|
55
|
-
"vite": "^8.3.5",
|
|
56
|
-
"vitest": "^5.0.5",
|
|
70
|
+
"@storybook/addon-a11y": "^10.6.8",
|
|
71
|
+
"@storybook/addon-docs": "^10.6.8",
|
|
72
|
+
"@storybook/addon-vitest": "^10.6.8",
|
|
73
|
+
"@storybook/web-components-vite": "^10.6.8",
|
|
74
|
+
"@types/node": "^26.6.6",
|
|
75
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
76
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
77
|
+
"fallow": "3.46.0",
|
|
78
|
+
"gifenc": "^1.0.3",
|
|
57
79
|
"lit": "^3.3.3",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
80
|
+
"playwright": "^1.65.1",
|
|
81
|
+
"storybook": "^10.6.8",
|
|
82
|
+
"typescript": "~7.0.2",
|
|
83
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
84
|
+
"vite-plus": "1.7.0",
|
|
85
|
+
"vitest": "5.1.0"
|
|
60
86
|
},
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
"custom-elements",
|
|
72
|
-
"dynamic-background",
|
|
73
|
-
"visual-effects",
|
|
74
|
-
"interactive-background",
|
|
75
|
-
"canvas-animation",
|
|
76
|
-
"beautiful-backgrounds",
|
|
77
|
-
"html5-canvas"
|
|
78
|
-
],
|
|
79
|
-
"author": "Niekes",
|
|
80
|
-
"license": "MIT",
|
|
81
|
-
"description": "A collection of customizable web components for creating dynamic, animated backgrounds, featuring a variety of effects including a star field and a digital rain. "
|
|
87
|
+
"peerDependencies": {
|
|
88
|
+
"lit": "^3.0.0"
|
|
89
|
+
},
|
|
90
|
+
"overrides": {
|
|
91
|
+
"storybook": {
|
|
92
|
+
"vite-plus": "$vite-plus"
|
|
93
|
+
},
|
|
94
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@8.3.8000",
|
|
95
|
+
"vitest": "5.1.0"
|
|
96
|
+
}
|
|
82
97
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { LitElement } from "lit";
|
|
2
|
-
export declare abstract class BeautifulBackground extends LitElement {
|
|
3
|
-
bgColors: string[];
|
|
4
|
-
bgAngle: number;
|
|
5
|
-
backgroundColor: string;
|
|
6
|
-
canvas: HTMLCanvasElement;
|
|
7
|
-
ctx: CanvasRenderingContext2D;
|
|
8
|
-
width: number;
|
|
9
|
-
height: number;
|
|
10
|
-
animationFrameId: number | null;
|
|
11
|
-
trailOpacity: number;
|
|
12
|
-
protected debouncedResize: () => void;
|
|
13
|
-
constructor();
|
|
14
|
-
protected handleVisibilityChange: () => void;
|
|
15
|
-
protected firstUpdated(): void;
|
|
16
|
-
disconnectedCallback(): void;
|
|
17
|
-
protected drawBackground(ctx: CanvasRenderingContext2D): void;
|
|
18
|
-
protected resizeCanvas(): void;
|
|
19
|
-
protected initialize(): void;
|
|
20
|
-
protected startAnimation(): void;
|
|
21
|
-
protected stopAnimation(): void;
|
|
22
|
-
static styles: import("lit").CSSResult;
|
|
23
|
-
protected abstract loop(deltaTime: number): void;
|
|
24
|
-
render(): void;
|
|
25
|
-
}
|