@brandonlukas/luminar 0.2.0 → 0.2.1
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 +87 -50
- package/bin/luminar.mjs +22 -36
- package/dist/assets/index-BTv18fJQ.css +1 -0
- package/dist/assets/index-DqXax9_P.js +4181 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/lib/constants.ts +37 -0
- package/src/lib/csv-parser.ts +24 -0
- package/src/lib/types.ts +26 -0
- package/src/main.ts +240 -690
- package/src/modules/controls.ts +424 -0
- package/src/modules/field-loader.ts +71 -0
- package/src/modules/particle-system.ts +329 -0
- package/src/modules/recording.ts +227 -0
- package/src/style.css +75 -0
- package/dist/assets/index-BHq4NTuF.css +0 -1
- package/dist/assets/index-Dn5q-yAE.js +0 -4151
package/dist/index.html
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
7
7
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
8
8
|
<title>luminar</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-DqXax9_P.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BTv18fJQ.css">
|
|
11
11
|
</head>
|
|
12
12
|
|
|
13
13
|
<body>
|
package/package.json
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ColorPreset, ParticleParams } from './types'
|
|
2
|
+
|
|
3
|
+
export const WORLD_EXTENT = 1.25
|
|
4
|
+
export const FLOW_SCALE = 0.85
|
|
5
|
+
export const SPEED_TO_GLOW = 2.6
|
|
6
|
+
export const JITTER = 0.015
|
|
7
|
+
export const FIELD_BORDER_MIN = 0.01
|
|
8
|
+
export const FIELD_BORDER_MAX = 0.1
|
|
9
|
+
|
|
10
|
+
export const COLOR_PRESETS: ColorPreset[] = [
|
|
11
|
+
{ key: 'luminous-violet', label: 'Luminous violet', rgb: [0.6, 0.25, 0.9] },
|
|
12
|
+
{ key: 'pure-white', label: 'Pure white', rgb: [1, 1, 1] },
|
|
13
|
+
{ key: 'neon-cyan', label: 'Neon cyan', rgb: [0.25, 0.95, 1] },
|
|
14
|
+
{ key: 'electric-lime', label: 'Electric lime', rgb: [0.75, 1, 0.25] },
|
|
15
|
+
{ key: 'solar-flare', label: 'Solar flare', rgb: [1, 0.55, 0.15] },
|
|
16
|
+
{ key: 'aurora-mint', label: 'Aurora mint', rgb: [0.4, 1, 0.85] },
|
|
17
|
+
{ key: 'sunrise-coral', label: 'Sunrise coral', rgb: [1, 0.6, 0.5] },
|
|
18
|
+
{ key: 'ember-gold', label: 'Ember gold', rgb: [1, 0.8, 0.2] },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_COLOR_PRESET = 'luminous-violet'
|
|
22
|
+
|
|
23
|
+
export const defaultParams: ParticleParams = {
|
|
24
|
+
size: 2,
|
|
25
|
+
bloomStrength: 1.2,
|
|
26
|
+
bloomRadius: 0.35,
|
|
27
|
+
lifeMin: 0.5,
|
|
28
|
+
lifeMax: 1.4,
|
|
29
|
+
fieldValidDistance: 0.05,
|
|
30
|
+
speed: 6.0,
|
|
31
|
+
particleCount: 5000,
|
|
32
|
+
colorPresetA: DEFAULT_COLOR_PRESET,
|
|
33
|
+
colorPresetB: DEFAULT_COLOR_PRESET,
|
|
34
|
+
noiseStrength: 0.0,
|
|
35
|
+
trailsEnabled: false,
|
|
36
|
+
trailDecay: 0.9,
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type VectorDatum = { x: number; y: number; dx: number; dy: number }
|
|
2
|
+
|
|
3
|
+
export function parseCsv(text: string): VectorDatum[] {
|
|
4
|
+
const lines = text.split(/\r?\n/).filter(Boolean)
|
|
5
|
+
const rows: VectorDatum[] = []
|
|
6
|
+
let skippedHeader = false
|
|
7
|
+
|
|
8
|
+
for (const line of lines) {
|
|
9
|
+
const parts = line.split(/[,\s]+/).filter(Boolean)
|
|
10
|
+
if (parts.length < 4) continue
|
|
11
|
+
|
|
12
|
+
const [x, y, dx, dy] = parts.map(Number)
|
|
13
|
+
if ([x, y, dx, dy].some((n) => Number.isNaN(n))) {
|
|
14
|
+
if (!skippedHeader && rows.length === 0) {
|
|
15
|
+
skippedHeader = true
|
|
16
|
+
console.log('skipping header line:', line.substring(0, 60))
|
|
17
|
+
}
|
|
18
|
+
continue
|
|
19
|
+
}
|
|
20
|
+
rows.push({ x, y, dx, dy })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return rows
|
|
24
|
+
}
|
package/src/lib/types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type VectorSample = { x: number; y: number }
|
|
2
|
+
export type VectorDatum = { x: number; y: number; dx: number; dy: number }
|
|
3
|
+
export type SliderHandle = { input: HTMLInputElement; valueTag: HTMLSpanElement }
|
|
4
|
+
export type ColorPreset = { key: string; label: string; rgb: [number, number, number] }
|
|
5
|
+
|
|
6
|
+
export interface ParticleParams {
|
|
7
|
+
size: number
|
|
8
|
+
bloomStrength: number
|
|
9
|
+
bloomRadius: number
|
|
10
|
+
lifeMin: number
|
|
11
|
+
lifeMax: number
|
|
12
|
+
fieldValidDistance: number
|
|
13
|
+
speed: number
|
|
14
|
+
particleCount: number
|
|
15
|
+
colorPresetA: string
|
|
16
|
+
colorPresetB: string
|
|
17
|
+
noiseStrength: number
|
|
18
|
+
trailsEnabled: boolean
|
|
19
|
+
trailDecay: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface FieldTransform {
|
|
23
|
+
scale: number
|
|
24
|
+
offsetX: number
|
|
25
|
+
offsetY: number
|
|
26
|
+
}
|