@diabolic/borealis 1.0.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/LICENSE +21 -0
- package/README.md +520 -0
- package/dist/borealis.d.ts +238 -0
- package/dist/borealis.esm.js +1243 -0
- package/dist/borealis.js +1251 -0
- package/dist/borealis.min.js +7 -0
- package/dist/borealis.min.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Borealis Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
# Borealis
|
|
2
|
+
|
|
3
|
+
An interactive, animated canvas background with noise-based patterns and visual effects.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@diabolic/borealis)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
https://github.com/user-attachments/assets/897d9ca9-2ac9-4b55-adaa-158a704aa220
|
|
9
|
+
|
|
10
|
+
> ðŽ [Live Demo](https://bugrakaan.github.io/borealis/)
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- ð **Noise-based patterns** - Beautiful river-like patterns using Simplex noise with domain warping
|
|
15
|
+
- ðĩ **Solid dot pattern** - Clean grid of uniform dots (alternative to noise)
|
|
16
|
+
- âĻ **Wave effect** - Diagonal sparkling wave that sweeps across the screen
|
|
17
|
+
- ðŦ **Twinkle effect** - Grouped star twinkling with customizable dead zone
|
|
18
|
+
- ð **Aurora colors** - Optional cyan-green to violet color gradient
|
|
19
|
+
- ðŊ **Radial collapse/expand** - Smooth show/hide animations from center
|
|
20
|
+
- ðŽ **WebM Recording** - Export animations as high-quality video (VP9 codec)
|
|
21
|
+
- ð **Alpha Mask Export** - Generate separate luma matte video for compositing
|
|
22
|
+
- ðū **URL State Persistence** - Share configurations via URL parameters
|
|
23
|
+
- ð **Copy Code Button** - Generate initialization code from current settings
|
|
24
|
+
- ⥠**Highly customizable** - 40+ configurable options
|
|
25
|
+
- ðą **Responsive** - Automatically adapts to window size
|
|
26
|
+
- ðŠķ **Lightweight** - No dependencies, pure JavaScript
|
|
27
|
+
- ðĶ **TypeScript support** - Full type definitions included
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
### npm
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @diabolic/borealis
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### yarn
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
yarn add @diabolic/borealis
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### pnpm
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm add @diabolic/borealis
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### CDN
|
|
50
|
+
|
|
51
|
+
```html
|
|
52
|
+
<!-- UMD (Global variable) -->
|
|
53
|
+
<script src="https://unpkg.com/@diabolic/borealis/dist/borealis.min.js"></script>
|
|
54
|
+
|
|
55
|
+
<!-- Or from jsDelivr -->
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@diabolic/borealis/dist/borealis.min.js"></script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Direct Script Include
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<script src="borealis.js"></script>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
### ES Module
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
import Borealis from '@diabolic/borealis';
|
|
71
|
+
|
|
72
|
+
// Create with default options (fullscreen)
|
|
73
|
+
const borealis = new Borealis();
|
|
74
|
+
|
|
75
|
+
// Create with custom options
|
|
76
|
+
const borealis = new Borealis({
|
|
77
|
+
effect: {
|
|
78
|
+
type: 'twinkle',
|
|
79
|
+
aurora: true
|
|
80
|
+
},
|
|
81
|
+
patternAurora: true,
|
|
82
|
+
density: 70
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Target a Specific Container
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// Render inside a specific element
|
|
90
|
+
const borealis = new Borealis({
|
|
91
|
+
container: document.getElementById('my-container'),
|
|
92
|
+
fullscreen: false // Use container dimensions instead of viewport
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// With explicit dimensions
|
|
96
|
+
const borealis = new Borealis({
|
|
97
|
+
container: document.getElementById('hero-section'),
|
|
98
|
+
fullscreen: false,
|
|
99
|
+
width: 800,
|
|
100
|
+
height: 400
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### CommonJS
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
const Borealis = require('@diabolic/borealis');
|
|
108
|
+
|
|
109
|
+
const borealis = new Borealis();
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Browser (UMD)
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<script src="https://unpkg.com/@diabolic/borealis/dist/borealis.min.js"></script>
|
|
116
|
+
<script>
|
|
117
|
+
const borealis = new Borealis({
|
|
118
|
+
effect: { type: 'wave' }
|
|
119
|
+
});
|
|
120
|
+
</script>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## API Reference
|
|
124
|
+
|
|
125
|
+
### Constructor
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
new Borealis(options)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Creates a new Borealis instance with the specified options.
|
|
132
|
+
|
|
133
|
+
### Methods
|
|
134
|
+
|
|
135
|
+
#### `start()`
|
|
136
|
+
Start the animation loop.
|
|
137
|
+
|
|
138
|
+
```javascript
|
|
139
|
+
borealis.start();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### `stop()`
|
|
143
|
+
Stop the animation loop.
|
|
144
|
+
|
|
145
|
+
```javascript
|
|
146
|
+
borealis.stop();
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### `resize([width], [height])`
|
|
150
|
+
Manually trigger a resize. Useful when container size changes.
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// Resize to specific dimensions
|
|
154
|
+
borealis.resize(800, 600);
|
|
155
|
+
|
|
156
|
+
// Resize using current container dimensions
|
|
157
|
+
borealis.resize();
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### `redraw()`
|
|
161
|
+
Force a single frame redraw. Useful when animation is stopped but you want to update the display.
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
borealis.stop();
|
|
165
|
+
borealis.setOption('patternAurora', true);
|
|
166
|
+
borealis.redraw(); // Update display without starting animation
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### `show([callback])`
|
|
170
|
+
Expand the pattern from center (reverse collapse).
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
borealis.show(() => {
|
|
174
|
+
console.log('Pattern is now visible');
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### `hide([callback])`
|
|
179
|
+
Collapse the pattern to center.
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
borealis.hide(() => {
|
|
183
|
+
console.log('Pattern is now hidden');
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
#### `toggle([callback])`
|
|
189
|
+
Toggle between show and hide states.
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
borealis.toggle();
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### `isVisible()`
|
|
196
|
+
Returns `true` if the pattern is fully visible (not collapsed).
|
|
197
|
+
|
|
198
|
+
```javascript
|
|
199
|
+
if (borealis.isVisible()) {
|
|
200
|
+
console.log('Pattern is visible');
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### `isHidden()`
|
|
205
|
+
Returns `true` if the pattern is fully hidden (collapsed).
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
if (borealis.isHidden()) {
|
|
209
|
+
console.log('Pattern is hidden');
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### `setOption(key, value)`
|
|
214
|
+
Set a single option value.
|
|
215
|
+
|
|
216
|
+
```javascript
|
|
217
|
+
borealis.setOption('effect', 'twinkle');
|
|
218
|
+
borealis.setOption('density', 80);
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### `setOptions(options)`
|
|
222
|
+
Set multiple options at once.
|
|
223
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
borealis.setOptions({
|
|
226
|
+
effect: 'twinkle',
|
|
227
|
+
patternAurora: true,
|
|
228
|
+
twinkleSpeed: 70
|
|
229
|
+
});
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### `getOption(key)`
|
|
233
|
+
Get a specific option value.
|
|
234
|
+
|
|
235
|
+
```javascript
|
|
236
|
+
const currentEffect = borealis.getOption('effect');
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### `getOptions()`
|
|
240
|
+
Get all current options.
|
|
241
|
+
|
|
242
|
+
```javascript
|
|
243
|
+
const options = borealis.getOptions();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### `destroy()`
|
|
247
|
+
Clean up and remove the canvas from DOM.
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
borealis.destroy();
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## Options Reference
|
|
254
|
+
|
|
255
|
+
### Container Options
|
|
256
|
+
|
|
257
|
+
| Option | Type | Default | Description |
|
|
258
|
+
|--------|------|---------|-------------|
|
|
259
|
+
| `container` | `HTMLElement` | `document.body` | Parent element for the canvas |
|
|
260
|
+
|
|
261
|
+
### Grid Options
|
|
262
|
+
|
|
263
|
+
| Option | Type | Default | Description |
|
|
264
|
+
|--------|------|---------|-------------|
|
|
265
|
+
| `density` | `number` | `50` | Grid density (10-100). Higher = more dots |
|
|
266
|
+
| `densityMinCell` | `number` | `2` | Minimum cell size at max density |
|
|
267
|
+
| `densityMaxCell` | `number` | `8` | Maximum cell size at min density |
|
|
268
|
+
| `dotSize` | `number` | `0` | Fixed dot size (0-10). 0 = noise-based size |
|
|
269
|
+
| `solidPattern` | `boolean` | `false` | Use uniform solid dots instead of noise pattern |
|
|
270
|
+
| `densityMinGap` | `number` | `1` | Minimum gap at max density |
|
|
271
|
+
| `densityMaxGap` | `number` | `4` | Maximum gap at min density |
|
|
272
|
+
|
|
273
|
+
### Pattern Options
|
|
274
|
+
|
|
275
|
+
| Option | Type | Default | Description |
|
|
276
|
+
|--------|------|---------|-------------|
|
|
277
|
+
| `patternScale` | `number` | `0.001` | Noise scale (smaller = larger patterns) |
|
|
278
|
+
| `patternAurora` | `boolean` | `false` | Use aurora colors for base pattern |
|
|
279
|
+
| `warpScale` | `number` | `0.5` | Domain warp frequency multiplier |
|
|
280
|
+
| `warpAmount` | `number` | `20` | Domain warp intensity |
|
|
281
|
+
| `animationSpeed` | `number` | `0.00002` | Base animation speed |
|
|
282
|
+
| `ridgePower` | `number` | `2` | Ridge sharpness (higher = sharper lines) |
|
|
283
|
+
| `minOpacity` | `number` | `0` | Minimum dot opacity (0-1) |
|
|
284
|
+
| `maxOpacity` | `number` | `1` | Maximum dot opacity (0-1) |
|
|
285
|
+
| `waveFrequency` | `number` | `3` | Wave oscillation frequency |
|
|
286
|
+
| `waveAmplitude` | `number` | `0.5` | Wave intensity (0-1) |
|
|
287
|
+
|
|
288
|
+
### Effect Options
|
|
289
|
+
|
|
290
|
+
| Option | Type | Default | Description |
|
|
291
|
+
|--------|------|---------|-------------|
|
|
292
|
+
| `effect` | `string` | `'wave'` | Effect type: `'none'`, `'wave'`, or `'twinkle'` |
|
|
293
|
+
| `effectAurora` | `boolean` | `false` | Use aurora colors for effect |
|
|
294
|
+
| `deadzone` | `number` | `0` | Effect dead zone around cursor (0-100) |
|
|
295
|
+
|
|
296
|
+
### Wave Effect Options
|
|
297
|
+
|
|
298
|
+
| Option | Type | Default | Description |
|
|
299
|
+
|--------|------|---------|-------------|
|
|
300
|
+
| `waveSpeed` | `number` | `0.0008` | Diagonal wave speed |
|
|
301
|
+
| `waveWidth` | `number` | `120` | Width of the wave band |
|
|
302
|
+
| `waveChance` | `number` | `0.08` | Chance of a cell sparkling (0-1) |
|
|
303
|
+
| `waveIntensity` | `number` | `1` | Maximum wave brightness |
|
|
304
|
+
| `waveDelayMin` | `number` | `1000` | Minimum delay between waves (ms) |
|
|
305
|
+
| `waveDelayMax` | `number` | `3000` | Maximum delay between waves (ms) |
|
|
306
|
+
| `waveCombineSparkle` | `boolean` | `false` | Combine wave with sparkle effect |
|
|
307
|
+
| `waveSparkleBaseOpacity` | `number` | `0.3` | Base opacity for combined sparkle (0-1) |
|
|
308
|
+
|
|
309
|
+
### Twinkle Effect Options
|
|
310
|
+
|
|
311
|
+
| Option | Type | Default | Description |
|
|
312
|
+
|--------|------|---------|-------------|
|
|
313
|
+
| `twinkleSpeed` | `number` | `50` | Animation speed (10-100) |
|
|
314
|
+
| `twinkleSize` | `number` | `50` | Pattern size (10-100, higher = larger groups) |
|
|
315
|
+
| `twinkleDensity` | `number` | `50` | Star density (0-100, higher = more stars) |
|
|
316
|
+
| `twinkleDeadzone` | `number` | `20` | Center dead zone size (0-50) |
|
|
317
|
+
| `twinkleIntensity` | `number` | `1` | Maximum twinkle brightness |
|
|
318
|
+
| `twinkleMode` | `string` | `'sparkle'` | Twinkle style: `'sparkle'` or `'wave'` |
|
|
319
|
+
| `twinkleCombined` | `boolean` | `false` | Combine with base pattern |
|
|
320
|
+
| `twinkleBaseOpacity` | `number` | `0.3` | Base opacity when combined (0-1) |
|
|
321
|
+
|
|
322
|
+
### Aurora Color Options
|
|
323
|
+
|
|
324
|
+
| Option | Type | Default | Description |
|
|
325
|
+
|--------|------|---------|-------------|
|
|
326
|
+
| `auroraColor1` | `array` | `[0, 255, 128]` | First aurora color (RGB) - Cyan-green |
|
|
327
|
+
| `auroraColor2` | `array` | `[148, 0, 211]` | Second aurora color (RGB) - Violet |
|
|
328
|
+
| `colorScale` | `number` | `0.003` | Color variation scale |
|
|
329
|
+
|
|
330
|
+
### Collapse Options
|
|
331
|
+
|
|
332
|
+
| Option | Type | Default | Description |
|
|
333
|
+
|--------|------|---------|-------------|
|
|
334
|
+
| `collapseSpeed` | `number` | `0.1` | Collapse/expand animation speed |
|
|
335
|
+
| `collapseWaveWidth` | `number` | `0.4` | Width of the collapse transition |
|
|
336
|
+
|
|
337
|
+
### Animation Options
|
|
338
|
+
|
|
339
|
+
| Option | Type | Default | Description |
|
|
340
|
+
|--------|------|---------|-------------|
|
|
341
|
+
| `animateOnHover` | `boolean` | `true` | Only animate when mouse is over document |
|
|
342
|
+
| `autoStart` | `boolean` | `true` | Start animation automatically |
|
|
343
|
+
|
|
344
|
+
### Callback Options
|
|
345
|
+
|
|
346
|
+
| Option | Type | Default | Description |
|
|
347
|
+
|--------|------|---------|-------------|
|
|
348
|
+
| `onShow` | `function` | `null` | Called when show animation completes |
|
|
349
|
+
| `onHide` | `function` | `null` | Called when hide animation completes |
|
|
350
|
+
|
|
351
|
+
## Examples
|
|
352
|
+
|
|
353
|
+
### Basic Usage
|
|
354
|
+
|
|
355
|
+
```html
|
|
356
|
+
<!DOCTYPE html>
|
|
357
|
+
<html>
|
|
358
|
+
<head>
|
|
359
|
+
<style>
|
|
360
|
+
body {
|
|
361
|
+
margin: 0;
|
|
362
|
+
min-height: 100vh;
|
|
363
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
|
|
364
|
+
}
|
|
365
|
+
</style>
|
|
366
|
+
</head>
|
|
367
|
+
<body>
|
|
368
|
+
<script src="borealis.js"></script>
|
|
369
|
+
<script>
|
|
370
|
+
const borealis = new Borealis();
|
|
371
|
+
</script>
|
|
372
|
+
</body>
|
|
373
|
+
</html>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Twinkle Effect with Aurora Colors
|
|
377
|
+
|
|
378
|
+
```javascript
|
|
379
|
+
const borealis = new Borealis({
|
|
380
|
+
effect: 'twinkle',
|
|
381
|
+
patternAurora: true,
|
|
382
|
+
effectAurora: true,
|
|
383
|
+
twinkleSpeed: 70,
|
|
384
|
+
twinkleDensity: 60,
|
|
385
|
+
twinkleDeadzone: 25
|
|
386
|
+
});
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Show/Hide on Button Click
|
|
390
|
+
|
|
391
|
+
```javascript
|
|
392
|
+
const borealis = new Borealis();
|
|
393
|
+
|
|
394
|
+
document.getElementById('toggleBtn').addEventListener('click', () => {
|
|
395
|
+
borealis.toggle(() => {
|
|
396
|
+
console.log('Animation complete');
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Custom Aurora Colors
|
|
402
|
+
|
|
403
|
+
```javascript
|
|
404
|
+
const borealis = new Borealis({
|
|
405
|
+
patternAurora: true,
|
|
406
|
+
auroraColor1: [255, 100, 100], // Pink
|
|
407
|
+
auroraColor2: [100, 100, 255], // Blue
|
|
408
|
+
});
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Programmatic Control
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
const borealis = new Borealis({ autoStart: false });
|
|
415
|
+
|
|
416
|
+
// Start when ready
|
|
417
|
+
setTimeout(() => {
|
|
418
|
+
borealis.start();
|
|
419
|
+
}, 1000);
|
|
420
|
+
|
|
421
|
+
// Change effect dynamically
|
|
422
|
+
borealis.setOption('effect', 'twinkle');
|
|
423
|
+
|
|
424
|
+
// Hide and perform action
|
|
425
|
+
borealis.hide(() => {
|
|
426
|
+
// Navigate or perform other action
|
|
427
|
+
window.location.href = '/next-page';
|
|
428
|
+
});
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Inside a Specific Container
|
|
432
|
+
|
|
433
|
+
```javascript
|
|
434
|
+
const container = document.getElementById('hero-section');
|
|
435
|
+
|
|
436
|
+
const borealis = new Borealis({
|
|
437
|
+
container: container,
|
|
438
|
+
density: 60,
|
|
439
|
+
effect: 'wave'
|
|
440
|
+
});
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## Browser Support
|
|
444
|
+
|
|
445
|
+
- Chrome 60+
|
|
446
|
+
- Firefox 55+
|
|
447
|
+
- Safari 12+
|
|
448
|
+
- Edge 79+
|
|
449
|
+
|
|
450
|
+
## Demo Page Features
|
|
451
|
+
|
|
452
|
+
The included `index.html` demo page provides a comprehensive interface for testing and configuring Borealis:
|
|
453
|
+
|
|
454
|
+
### Settings Panel
|
|
455
|
+
|
|
456
|
+
- **Two-column layout** - Organized controls for all options
|
|
457
|
+
- **Live preview** - Changes apply instantly
|
|
458
|
+
- **URL state persistence** - Settings are saved to URL parameters for easy sharing
|
|
459
|
+
- **Copy Code button** - Generate JavaScript initialization code from current settings
|
|
460
|
+
|
|
461
|
+
### Recording Features
|
|
462
|
+
|
|
463
|
+
The demo page includes WebM video recording capabilities:
|
|
464
|
+
|
|
465
|
+
| Feature | Description |
|
|
466
|
+
|---------|-------------|
|
|
467
|
+
| **Format** | WebM with VP9 codec |
|
|
468
|
+
| **Framerate** | 30 fps |
|
|
469
|
+
| **Main Video Bitrate** | 5 Mbps |
|
|
470
|
+
| **Alpha Mask Bitrate** | 3 Mbps |
|
|
471
|
+
| **Resolutions** | 640Ã360, 854Ã480, 1280Ã720, 1440Ã900, 1920Ã1080, 2560Ã1440 |
|
|
472
|
+
| **Durations** | 5s, 10s, 15s, 30s, 60s, 120s |
|
|
473
|
+
|
|
474
|
+
#### Alpha Mask Export
|
|
475
|
+
|
|
476
|
+
When "Include Alpha Mask" is enabled, a separate grayscale WebM video is generated alongside the main recording:
|
|
477
|
+
|
|
478
|
+
- **Purpose**: Luma matte for video compositing
|
|
479
|
+
- **Format**: Grayscale video where white = opaque, black = transparent
|
|
480
|
+
- **Usage**: Import into video editors (After Effects, Premiere, DaVinci Resolve) as a track matte
|
|
481
|
+
- **Filename**: `borealis-alpha-{timestamp}.webm`
|
|
482
|
+
|
|
483
|
+
Both files share the same timestamp for easy pairing.
|
|
484
|
+
|
|
485
|
+
### URL State Persistence
|
|
486
|
+
|
|
487
|
+
All settings are automatically saved to URL parameters. You can:
|
|
488
|
+
|
|
489
|
+
1. Configure settings using the panel
|
|
490
|
+
2. Copy the URL to share your exact configuration
|
|
491
|
+
3. Open the URL to restore all settings
|
|
492
|
+
|
|
493
|
+
Example URL:
|
|
494
|
+
```
|
|
495
|
+
index.html?effect=twinkle&patternAurora=true&density=70&twinkleSpeed=60
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
## Performance Tips
|
|
499
|
+
|
|
500
|
+
1. **Lower density on mobile** - Use lower density values (30-50) on mobile devices
|
|
501
|
+
2. **Disable on low-power mode** - Consider detecting battery status
|
|
502
|
+
3. **Use `stop()` when hidden** - Stop animation when tab is not visible
|
|
503
|
+
|
|
504
|
+
```javascript
|
|
505
|
+
document.addEventListener('visibilitychange', () => {
|
|
506
|
+
if (document.hidden) {
|
|
507
|
+
borealis.stop();
|
|
508
|
+
} else {
|
|
509
|
+
borealis.start();
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
## License
|
|
515
|
+
|
|
516
|
+
MIT License - feel free to use in personal and commercial projects.
|
|
517
|
+
|
|
518
|
+
## Contributing
|
|
519
|
+
|
|
520
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|