@diabolic/borealis 1.0.1 → 1.0.2
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/LICENSE +21 -21
- package/README.md +510 -519
- package/dist/borealis.d.ts +238 -238
- package/dist/borealis.esm.js +1236 -1236
- package/dist/borealis.js +1236 -1236
- package/dist/borealis.min.js +1 -1
- package/dist/borealis.min.js.map +1 -1
- package/package.json +60 -60
package/dist/borealis.d.ts
CHANGED
|
@@ -1,238 +1,238 @@
|
|
|
1
|
-
declare module '@diabolic/borealis' {
|
|
2
|
-
export interface EffectOptions {
|
|
3
|
-
/** Effect type: 'none', 'wave', or 'twinkle' */
|
|
4
|
-
type?: 'none' | 'wave' | 'twinkle';
|
|
5
|
-
/** Use aurora colors for effect */
|
|
6
|
-
aurora?: boolean;
|
|
7
|
-
/** Center dead zone size (0-100) */
|
|
8
|
-
deadzone?: number;
|
|
9
|
-
|
|
10
|
-
// Wave-specific options
|
|
11
|
-
/** Diagonal line speed */
|
|
12
|
-
speed?: number;
|
|
13
|
-
/** Width of the wave band */
|
|
14
|
-
width?: number;
|
|
15
|
-
/** Chance of a cell sparkling (0-1) */
|
|
16
|
-
chance?: number;
|
|
17
|
-
/** Max brightness */
|
|
18
|
-
intensity?: number;
|
|
19
|
-
/** Min delay between sweeps (ms) */
|
|
20
|
-
delayMin?: number;
|
|
21
|
-
/** Max delay between sweeps (ms) */
|
|
22
|
-
delayMax?: number;
|
|
23
|
-
/** Add sparkles that get boosted by wave */
|
|
24
|
-
combineSparkle?: boolean;
|
|
25
|
-
/** Sparkle base opacity when wave not passing (0-100) */
|
|
26
|
-
sparkleBaseOpacity?: number;
|
|
27
|
-
|
|
28
|
-
// Twinkle-specific options
|
|
29
|
-
/** 'sparkle' (random) or 'wave' (flowing waves) */
|
|
30
|
-
mode?: 'sparkle' | 'wave';
|
|
31
|
-
/** Combine sparkle with wave (sparkles boosted by wave) */
|
|
32
|
-
combined?: boolean;
|
|
33
|
-
/** Base opacity when wave is not passing (0-100) */
|
|
34
|
-
baseOpacity?: number;
|
|
35
|
-
/** Twinkle animation speed (10-100) */
|
|
36
|
-
twinkleSpeed?: number;
|
|
37
|
-
/** Pattern size (10-100) */
|
|
38
|
-
size?: number;
|
|
39
|
-
/** Star density (0-100) */
|
|
40
|
-
density?: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface BorealisOptions {
|
|
44
|
-
/** Container element (default: document.body) */
|
|
45
|
-
/** Container element (default: document.body) */
|
|
46
|
-
container?: HTMLElement;
|
|
47
|
-
/** Canvas width in pixels (null = auto from container/window) */
|
|
48
|
-
width?: number | null;
|
|
49
|
-
/** Canvas height in pixels (null = auto from container/window) */
|
|
50
|
-
height?: number | null;
|
|
51
|
-
/** If true, uses fixed positioning to cover viewport (default: true) */
|
|
52
|
-
fullscreen?: boolean;
|
|
53
|
-
|
|
54
|
-
// Grid settings
|
|
55
|
-
/** Grid density (10-100) */
|
|
56
|
-
density?: number;
|
|
57
|
-
/** Dot size (0-10, 0=smallest) */
|
|
58
|
-
dotSize?: number;
|
|
59
|
-
/** Solid pattern without gaps/circles */
|
|
60
|
-
solidPattern?: boolean;
|
|
61
|
-
/** Cell size at max density */
|
|
62
|
-
densityMinCell?: number;
|
|
63
|
-
/** Cell size at min density */
|
|
64
|
-
densityMaxCell?: number;
|
|
65
|
-
/** Gap at max density */
|
|
66
|
-
densityMinGap?: number;
|
|
67
|
-
/** Gap at min density */
|
|
68
|
-
densityMaxGap?: number;
|
|
69
|
-
|
|
70
|
-
// Pattern settings
|
|
71
|
-
/** Noise scale (smaller = larger patterns) */
|
|
72
|
-
patternScale?: number;
|
|
73
|
-
/** Use aurora colors for pattern */
|
|
74
|
-
patternAurora?: boolean;
|
|
75
|
-
/** Domain warp frequency multiplier */
|
|
76
|
-
warpScale?: number;
|
|
77
|
-
/** Domain warp intensity */
|
|
78
|
-
warpAmount?: number;
|
|
79
|
-
/** Animation speed multiplier */
|
|
80
|
-
animationSpeed?: number;
|
|
81
|
-
/** Ridge sharpness (higher = sharper lines) */
|
|
82
|
-
ridgePower?: number;
|
|
83
|
-
/** Minimum opacity (0-1) */
|
|
84
|
-
minOpacity?: number;
|
|
85
|
-
/** Maximum opacity (0-1) */
|
|
86
|
-
maxOpacity?: number;
|
|
87
|
-
/** Wave oscillation frequency */
|
|
88
|
-
waveFrequency?: number;
|
|
89
|
-
/** Wave intensity (0-1) */
|
|
90
|
-
waveAmplitude?: number;
|
|
91
|
-
|
|
92
|
-
// Effect settings
|
|
93
|
-
/** Effect configuration */
|
|
94
|
-
effect?: EffectOptions;
|
|
95
|
-
|
|
96
|
-
// Aurora colors
|
|
97
|
-
/** First aurora color [r, g, b] */
|
|
98
|
-
auroraColor1?: [number, number, number];
|
|
99
|
-
/** Second aurora color [r, g, b] */
|
|
100
|
-
auroraColor2?: [number, number, number];
|
|
101
|
-
/** Color variation scale */
|
|
102
|
-
colorScale?: number;
|
|
103
|
-
|
|
104
|
-
// Collapse settings
|
|
105
|
-
/** Collapse animation speed */
|
|
106
|
-
collapseSpeed?: number;
|
|
107
|
-
/** Width of the collapse transition */
|
|
108
|
-
collapseWaveWidth?: number;
|
|
109
|
-
|
|
110
|
-
// Animation
|
|
111
|
-
/** Start animation automatically */
|
|
112
|
-
autoStart?: boolean;
|
|
113
|
-
|
|
114
|
-
// Callbacks
|
|
115
|
-
/** Called when show animation completes */
|
|
116
|
-
onShow?: () => void;
|
|
117
|
-
/** Called when hide animation completes */
|
|
118
|
-
onHide?: () => void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export default class Borealis {
|
|
122
|
-
/** Default options for Borealis */
|
|
123
|
-
static readonly defaultOptions: BorealisOptions;
|
|
124
|
-
|
|
125
|
-
/** Current options */
|
|
126
|
-
options: BorealisOptions;
|
|
127
|
-
|
|
128
|
-
/** Canvas element */
|
|
129
|
-
canvas: HTMLCanvasElement | null;
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Create a new Borealis instance
|
|
133
|
-
* @param options - Configuration options
|
|
134
|
-
*/
|
|
135
|
-
constructor(options?: BorealisOptions);
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Start the animation
|
|
139
|
-
* @returns this instance for chaining
|
|
140
|
-
*/
|
|
141
|
-
start(): this;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Stop the animation
|
|
145
|
-
* @returns this instance for chaining
|
|
146
|
-
*/
|
|
147
|
-
stop(): this;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Manually trigger a resize (useful when container size changes)
|
|
151
|
-
* @param width - Optional new width
|
|
152
|
-
* @param height - Optional new height
|
|
153
|
-
* @returns this instance for chaining
|
|
154
|
-
*/
|
|
155
|
-
resize(width?: number, height?: number): this;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Force a single frame redraw (useful when animation is stopped)
|
|
159
|
-
* @returns this instance for chaining
|
|
160
|
-
*/
|
|
161
|
-
redraw(): this;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Show the pattern (expand from center)
|
|
165
|
-
* @param callback - Called when animation completes
|
|
166
|
-
* @returns this instance for chaining
|
|
167
|
-
*/
|
|
168
|
-
show(callback?: () => void): this;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Hide the pattern (collapse to center)
|
|
172
|
-
* @param callback - Called when animation completes
|
|
173
|
-
* @returns this instance for chaining
|
|
174
|
-
*/
|
|
175
|
-
hide(callback?: () => void): this;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Toggle between show and hide
|
|
179
|
-
* @param callback - Called when animation completes
|
|
180
|
-
* @returns this instance for chaining
|
|
181
|
-
*/
|
|
182
|
-
toggle(callback?: () => void): this;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Check if currently visible (not collapsed)
|
|
186
|
-
*/
|
|
187
|
-
isVisible(): boolean;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Check if currently hidden (fully collapsed)
|
|
191
|
-
*/
|
|
192
|
-
isHidden(): boolean;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Set a single option
|
|
196
|
-
* @param key - Option key
|
|
197
|
-
* @param value - Option value
|
|
198
|
-
* @returns this instance for chaining
|
|
199
|
-
*/
|
|
200
|
-
setOption<K extends keyof BorealisOptions>(key: K, value: BorealisOptions[K]): this;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Set effect type and options
|
|
204
|
-
* @param type - Effect type: 'none', 'wave', or 'twinkle'
|
|
205
|
-
* @param effectOptions - Effect-specific options
|
|
206
|
-
* @returns this instance for chaining
|
|
207
|
-
*/
|
|
208
|
-
setEffect(type: 'none' | 'wave' | 'twinkle' | null, effectOptions?: Omit<EffectOptions, 'type'>): this;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Get current effect configuration
|
|
212
|
-
*/
|
|
213
|
-
getEffect(): EffectOptions;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Set multiple options at once
|
|
217
|
-
* @param options - Options object
|
|
218
|
-
* @returns this instance for chaining
|
|
219
|
-
*/
|
|
220
|
-
setOptions(options: Partial<BorealisOptions>): this;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Get current options
|
|
224
|
-
*/
|
|
225
|
-
getOptions(): BorealisOptions;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Get a specific option value
|
|
229
|
-
* @param key - Option key
|
|
230
|
-
*/
|
|
231
|
-
getOption<K extends keyof BorealisOptions>(key: K): BorealisOptions[K];
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Destroy the instance and clean up
|
|
235
|
-
*/
|
|
236
|
-
destroy(): void;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
1
|
+
declare module '@diabolic/borealis' {
|
|
2
|
+
export interface EffectOptions {
|
|
3
|
+
/** Effect type: 'none', 'wave', or 'twinkle' */
|
|
4
|
+
type?: 'none' | 'wave' | 'twinkle';
|
|
5
|
+
/** Use aurora colors for effect */
|
|
6
|
+
aurora?: boolean;
|
|
7
|
+
/** Center dead zone size (0-100) */
|
|
8
|
+
deadzone?: number;
|
|
9
|
+
|
|
10
|
+
// Wave-specific options
|
|
11
|
+
/** Diagonal line speed */
|
|
12
|
+
speed?: number;
|
|
13
|
+
/** Width of the wave band */
|
|
14
|
+
width?: number;
|
|
15
|
+
/** Chance of a cell sparkling (0-1) */
|
|
16
|
+
chance?: number;
|
|
17
|
+
/** Max brightness */
|
|
18
|
+
intensity?: number;
|
|
19
|
+
/** Min delay between sweeps (ms) */
|
|
20
|
+
delayMin?: number;
|
|
21
|
+
/** Max delay between sweeps (ms) */
|
|
22
|
+
delayMax?: number;
|
|
23
|
+
/** Add sparkles that get boosted by wave */
|
|
24
|
+
combineSparkle?: boolean;
|
|
25
|
+
/** Sparkle base opacity when wave not passing (0-100) */
|
|
26
|
+
sparkleBaseOpacity?: number;
|
|
27
|
+
|
|
28
|
+
// Twinkle-specific options
|
|
29
|
+
/** 'sparkle' (random) or 'wave' (flowing waves) */
|
|
30
|
+
mode?: 'sparkle' | 'wave';
|
|
31
|
+
/** Combine sparkle with wave (sparkles boosted by wave) */
|
|
32
|
+
combined?: boolean;
|
|
33
|
+
/** Base opacity when wave is not passing (0-100) */
|
|
34
|
+
baseOpacity?: number;
|
|
35
|
+
/** Twinkle animation speed (10-100) */
|
|
36
|
+
twinkleSpeed?: number;
|
|
37
|
+
/** Pattern size (10-100) */
|
|
38
|
+
size?: number;
|
|
39
|
+
/** Star density (0-100) */
|
|
40
|
+
density?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface BorealisOptions {
|
|
44
|
+
/** Container element (default: document.body) */
|
|
45
|
+
/** Container element (default: document.body) */
|
|
46
|
+
container?: HTMLElement;
|
|
47
|
+
/** Canvas width in pixels (null = auto from container/window) */
|
|
48
|
+
width?: number | null;
|
|
49
|
+
/** Canvas height in pixels (null = auto from container/window) */
|
|
50
|
+
height?: number | null;
|
|
51
|
+
/** If true, uses fixed positioning to cover viewport (default: true) */
|
|
52
|
+
fullscreen?: boolean;
|
|
53
|
+
|
|
54
|
+
// Grid settings
|
|
55
|
+
/** Grid density (10-100) */
|
|
56
|
+
density?: number;
|
|
57
|
+
/** Dot size (0-10, 0=smallest) */
|
|
58
|
+
dotSize?: number;
|
|
59
|
+
/** Solid pattern without gaps/circles */
|
|
60
|
+
solidPattern?: boolean;
|
|
61
|
+
/** Cell size at max density */
|
|
62
|
+
densityMinCell?: number;
|
|
63
|
+
/** Cell size at min density */
|
|
64
|
+
densityMaxCell?: number;
|
|
65
|
+
/** Gap at max density */
|
|
66
|
+
densityMinGap?: number;
|
|
67
|
+
/** Gap at min density */
|
|
68
|
+
densityMaxGap?: number;
|
|
69
|
+
|
|
70
|
+
// Pattern settings
|
|
71
|
+
/** Noise scale (smaller = larger patterns) */
|
|
72
|
+
patternScale?: number;
|
|
73
|
+
/** Use aurora colors for pattern */
|
|
74
|
+
patternAurora?: boolean;
|
|
75
|
+
/** Domain warp frequency multiplier */
|
|
76
|
+
warpScale?: number;
|
|
77
|
+
/** Domain warp intensity */
|
|
78
|
+
warpAmount?: number;
|
|
79
|
+
/** Animation speed multiplier */
|
|
80
|
+
animationSpeed?: number;
|
|
81
|
+
/** Ridge sharpness (higher = sharper lines) */
|
|
82
|
+
ridgePower?: number;
|
|
83
|
+
/** Minimum opacity (0-1) */
|
|
84
|
+
minOpacity?: number;
|
|
85
|
+
/** Maximum opacity (0-1) */
|
|
86
|
+
maxOpacity?: number;
|
|
87
|
+
/** Wave oscillation frequency */
|
|
88
|
+
waveFrequency?: number;
|
|
89
|
+
/** Wave intensity (0-1) */
|
|
90
|
+
waveAmplitude?: number;
|
|
91
|
+
|
|
92
|
+
// Effect settings
|
|
93
|
+
/** Effect configuration */
|
|
94
|
+
effect?: EffectOptions;
|
|
95
|
+
|
|
96
|
+
// Aurora colors
|
|
97
|
+
/** First aurora color [r, g, b] */
|
|
98
|
+
auroraColor1?: [number, number, number];
|
|
99
|
+
/** Second aurora color [r, g, b] */
|
|
100
|
+
auroraColor2?: [number, number, number];
|
|
101
|
+
/** Color variation scale */
|
|
102
|
+
colorScale?: number;
|
|
103
|
+
|
|
104
|
+
// Collapse settings
|
|
105
|
+
/** Collapse animation speed */
|
|
106
|
+
collapseSpeed?: number;
|
|
107
|
+
/** Width of the collapse transition */
|
|
108
|
+
collapseWaveWidth?: number;
|
|
109
|
+
|
|
110
|
+
// Animation
|
|
111
|
+
/** Start animation automatically */
|
|
112
|
+
autoStart?: boolean;
|
|
113
|
+
|
|
114
|
+
// Callbacks
|
|
115
|
+
/** Called when show animation completes */
|
|
116
|
+
onShow?: () => void;
|
|
117
|
+
/** Called when hide animation completes */
|
|
118
|
+
onHide?: () => void;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export default class Borealis {
|
|
122
|
+
/** Default options for Borealis */
|
|
123
|
+
static readonly defaultOptions: BorealisOptions;
|
|
124
|
+
|
|
125
|
+
/** Current options */
|
|
126
|
+
options: BorealisOptions;
|
|
127
|
+
|
|
128
|
+
/** Canvas element */
|
|
129
|
+
canvas: HTMLCanvasElement | null;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Create a new Borealis instance
|
|
133
|
+
* @param options - Configuration options
|
|
134
|
+
*/
|
|
135
|
+
constructor(options?: BorealisOptions);
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Start the animation
|
|
139
|
+
* @returns this instance for chaining
|
|
140
|
+
*/
|
|
141
|
+
start(): this;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Stop the animation
|
|
145
|
+
* @returns this instance for chaining
|
|
146
|
+
*/
|
|
147
|
+
stop(): this;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Manually trigger a resize (useful when container size changes)
|
|
151
|
+
* @param width - Optional new width
|
|
152
|
+
* @param height - Optional new height
|
|
153
|
+
* @returns this instance for chaining
|
|
154
|
+
*/
|
|
155
|
+
resize(width?: number, height?: number): this;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Force a single frame redraw (useful when animation is stopped)
|
|
159
|
+
* @returns this instance for chaining
|
|
160
|
+
*/
|
|
161
|
+
redraw(): this;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Show the pattern (expand from center)
|
|
165
|
+
* @param callback - Called when animation completes
|
|
166
|
+
* @returns this instance for chaining
|
|
167
|
+
*/
|
|
168
|
+
show(callback?: () => void): this;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Hide the pattern (collapse to center)
|
|
172
|
+
* @param callback - Called when animation completes
|
|
173
|
+
* @returns this instance for chaining
|
|
174
|
+
*/
|
|
175
|
+
hide(callback?: () => void): this;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Toggle between show and hide
|
|
179
|
+
* @param callback - Called when animation completes
|
|
180
|
+
* @returns this instance for chaining
|
|
181
|
+
*/
|
|
182
|
+
toggle(callback?: () => void): this;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Check if currently visible (not collapsed)
|
|
186
|
+
*/
|
|
187
|
+
isVisible(): boolean;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Check if currently hidden (fully collapsed)
|
|
191
|
+
*/
|
|
192
|
+
isHidden(): boolean;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Set a single option
|
|
196
|
+
* @param key - Option key
|
|
197
|
+
* @param value - Option value
|
|
198
|
+
* @returns this instance for chaining
|
|
199
|
+
*/
|
|
200
|
+
setOption<K extends keyof BorealisOptions>(key: K, value: BorealisOptions[K]): this;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Set effect type and options
|
|
204
|
+
* @param type - Effect type: 'none', 'wave', or 'twinkle'
|
|
205
|
+
* @param effectOptions - Effect-specific options
|
|
206
|
+
* @returns this instance for chaining
|
|
207
|
+
*/
|
|
208
|
+
setEffect(type: 'none' | 'wave' | 'twinkle' | null, effectOptions?: Omit<EffectOptions, 'type'>): this;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get current effect configuration
|
|
212
|
+
*/
|
|
213
|
+
getEffect(): EffectOptions;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Set multiple options at once
|
|
217
|
+
* @param options - Options object
|
|
218
|
+
* @returns this instance for chaining
|
|
219
|
+
*/
|
|
220
|
+
setOptions(options: Partial<BorealisOptions>): this;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Get current options
|
|
224
|
+
*/
|
|
225
|
+
getOptions(): BorealisOptions;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Get a specific option value
|
|
229
|
+
* @param key - Option key
|
|
230
|
+
*/
|
|
231
|
+
getOption<K extends keyof BorealisOptions>(key: K): BorealisOptions[K];
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Destroy the instance and clean up
|
|
235
|
+
*/
|
|
236
|
+
destroy(): void;
|
|
237
|
+
}
|
|
238
|
+
}
|