@fusion.dev/helix 0.202.0 → 0.204.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/api.json +1 -1
- package/custom-elements.json +493 -19
- package/dist/aura/root/aura-root.d.ts +8 -6
- package/dist/aura/shader.d.ts +3 -3
- package/dist/aura/shader.js +55 -1
- package/dist/element-events.generated.js +1 -1
- package/dist/log/line/log-line.css.js +1 -1
- package/dist/log/line/log-line.d.ts +1 -0
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +6 -6
- package/skills/helix/SKILL.md +2 -2
- package/types/jsx.d.ts +116 -34
- package/types/vue.d.ts +37 -8
|
@@ -115,7 +115,8 @@ export declare class HelixAura extends HelixElement {
|
|
|
115
115
|
* `variant`.
|
|
116
116
|
*
|
|
117
117
|
* Absent is `native`, which is each shape answering in the terms it is made
|
|
118
|
-
* of: braid leans, rays are occluded, threads pinch, particles scatter
|
|
118
|
+
* of: braid leans, rays are occluded, threads pinch, particles scatter, a
|
|
119
|
+
* constellation gathers. The
|
|
119
120
|
* named options are generic, and are a deliberate step down in meaning. A
|
|
120
121
|
* response made of the same material as the shape says something about that
|
|
121
122
|
* shape; a lamp following the cursor says the same nothing on every one.
|
|
@@ -205,10 +206,11 @@ export declare class HelixAura extends HelixElement {
|
|
|
205
206
|
* and a streak whose length passed through zero would be drawn as a bar
|
|
206
207
|
* across the whole frame.
|
|
207
208
|
*
|
|
208
|
-
* Read by
|
|
209
|
+
* Read by seven of the twelve shapes, the ones made of many similar things,
|
|
209
210
|
* whether those are counted or continuous: `streaks`, whose lanes draw a
|
|
210
|
-
* speed, a length, a width, a spacing and a weight apiece; `particles
|
|
211
|
-
* motes draw a size, a brightness and a
|
|
211
|
+
* speed, a length, a width, a spacing and a weight apiece; `particles` and
|
|
212
|
+
* `constellation`, whose motes and stars draw a size, a brightness and a
|
|
213
|
+
* wander; `rays` and `aurora`, whose
|
|
212
214
|
* fan, bundles and folds widen or even out; `caustics`, whose three depths of
|
|
213
215
|
* fold close on one scale and one weight while the pool over them flattens to
|
|
214
216
|
* an even wash; and `fracture`, whose sites come home to their own cell
|
|
@@ -233,11 +235,11 @@ export declare class HelixAura extends HelixElement {
|
|
|
233
235
|
*
|
|
234
236
|
* **`variant` and not `shape`.** `shape` is an axis about geometry, `circle`
|
|
235
237
|
* against `square`, `arc` against `ring`, and it is registered as one.
|
|
236
|
-
* Aurora, braid and caustics are not geometries; they are
|
|
238
|
+
* Aurora, braid and caustics are not geometries; they are twelve names for a
|
|
237
239
|
* look, which is what `variant` is for by the rule the registry already
|
|
238
240
|
* states.
|
|
239
241
|
*/
|
|
240
|
-
variant?: 'aurora' | 'braid' | 'caustics' | 'flow' | 'fracture' | 'lattice' | 'particles' | 'rays' | 'streaks' | 'threads' | 'waves';
|
|
242
|
+
variant?: 'aurora' | 'braid' | 'caustics' | 'constellation' | 'flow' | 'fracture' | 'lattice' | 'particles' | 'rays' | 'streaks' | 'threads' | 'waves';
|
|
241
243
|
/**
|
|
242
244
|
* The four ramp stops, resolved.
|
|
243
245
|
*
|
package/dist/aura/shader.d.ts
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Exported so the component can turn a property into the integer the uniform
|
|
5
5
|
* takes without a second list to keep in step.
|
|
6
6
|
*/
|
|
7
|
-
export declare const SHAPES: readonly ['braid', 'rays', 'aurora', 'streaks', 'waves', 'threads', 'particles', 'flow', 'caustics', 'lattice', 'fracture'];
|
|
7
|
+
export declare const SHAPES: readonly ['braid', 'rays', 'aurora', 'streaks', 'waves', 'threads', 'particles', 'flow', 'caustics', 'lattice', 'fracture', 'constellation'];
|
|
8
8
|
/** Which form the light takes. */
|
|
9
9
|
export type AuraShape = (typeof SHAPES)[number];
|
|
10
10
|
/**
|
|
11
11
|
* What the pointer does, in the order the shader branches on them.
|
|
12
12
|
*
|
|
13
13
|
* `native` is the shape's own, and is what absence means: braid leans, rays are
|
|
14
|
-
* occluded, threads pinch. The rest are generic, deliberately few, opt-in and
|
|
14
|
+
* occluded, threads pinch, a constellation gathers. The rest are generic, deliberately few, opt-in and
|
|
15
15
|
* never a default. A response made of the same material as the shape says
|
|
16
16
|
* something about that shape; a lamp that follows the cursor says the same
|
|
17
17
|
* nothing on every one of them. They are here because a consumer may want the
|
|
@@ -44,4 +44,4 @@ export declare const VERTEX = "#version 300 es\n out vec2 uv;\n void main() {\
|
|
|
44
44
|
* part of the string, and no minifier reads inside a template literal, so 38 kB
|
|
45
45
|
* of notes shipped in every bundle. The build strips a JavaScript comment.
|
|
46
46
|
*/
|
|
47
|
-
export declare const FRAGMENT = "#version 300 es\n precision highp float;\n\n in vec2 uv;\n out vec4 color;\n\n uniform vec2 uResolution;\n uniform float uTime;\n uniform int uShape;\n uniform vec2 uPointer;\n uniform float uReach;\n uniform int uInteraction;\n uniform float uTilt;\n uniform float uScale;\n uniform float uBloom;\n uniform float uGain;\n\n \n uniform float uVariance;\n \n uniform vec3 uTrail[9];\n uniform vec3 uGround;\n uniform vec3 uHaze;\n uniform vec3 uGlow;\n uniform vec3 uPeak;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n }\n\n float noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n \n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),\n mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),\n u.y\n );\n }\n\n \n const mat2 TURN = mat2(0.8, 0.6, -0.6, 0.8);\n\n float fbm(vec2 p) {\n float sum = 0.0;\n float amp = 0.5;\n for (int i = 0; i < 5; i++) {\n sum += amp * noise(p);\n p = TURN * p * 2.03;\n amp *= 0.5;\n }\n return sum;\n }\n\n \n float warped(vec2 p, float t) {\n vec2 q = vec2(fbm(p + vec2(0.0, t)), fbm(p + vec2(5.2, 1.3 - t)));\n vec2 r = vec2(fbm(p + 4.0 * q + vec2(1.7, 9.2)), fbm(p + 4.0 * q + vec2(8.3, 2.8)));\n return fbm(p + 4.0 * r);\n }\n\n \n float falloff(float d2, float k) {\n float soft = 0.06 / k;\n return exp(-sqrt(d2 + soft * soft) * k);\n }\n\n \n float braid(vec2 q, float t, vec2 qp, float reach) {\n \n float alongside = falloff((q.y - qp.y) * (q.y - qp.y), 1.1) * reach;\n float lean = qp.x * alongside * 0.45;\n float lit = 0.0;\n for (int i = 0; i < 2; i++) {\n float phase = float(i) * 3.14159265;\n float x = q.x - lean - 0.34 * sin(q.y * 1.6 + t * 1.4 + phase);\n lit += 0.8 * falloff(x * x, 13.0);\n }\n float volume = falloff(q.x * q.x, 2.6);\n \n float streak = fbm(vec2(q.x * 9.0, q.y * 0.55 - t * 2.4));\n float haze = warped(vec2(q.x * 0.8 + 4.0, q.y * 0.45), t * 0.5);\n return lit * mix(0.35, 1.65, streak) + volume * 0.3 * mix(0.35, 1.05, haze);\n }\n\n \n float rays(vec2 q, float t, vec2 qp, float reach) {\n \n vec2 o = vec2(0.0, 1.45);\n vec2 v = q - o;\n float dist = length(v);\n float ang = atan(v.x, -v.y);\n\n vec2 vp = qp - o;\n float distToBlocker = length(vp);\n float angToBlocker = atan(vp.x, -vp.y);\n \n float halfAngle = 0.055 / max(distToBlocker, 0.35);\n float across = (ang - angToBlocker) / halfAngle;\n \n float behind = smoothstep(-0.03, 0.05, dist - distToBlocker);\n float shadow = exp(-across * across) * behind * reach;\n\n float fan = fbm(vec2(ang * 8.0, dist * 0.5 - t * 1.8));\n float dust = warped(vec2(ang * 2.0, dist * 0.7), t * 0.4);\n float spread = smoothstep(0.85, 0.05, abs(ang));\n \n float rv = clamp(uVariance, 0.0, 1.0);\n float lit = spread * mix(mix(0.85, 0.2, rv), mix(0.85, 1.5, rv), fan) *\n mix(0.75, 1.15, dust) * falloff(dot(v, v), 0.8);\n return lit * (1.0 - shadow * 0.82);\n }\n\n \n float aurora(vec2 q, float t, vec2 qp, float reach) {\n \n float agitate = falloff((q.x - qp.x) * (q.x - qp.x), 1.5) * reach;\n\n \n float lit = 0.0;\n for (int i = 0; i < 2; i++) {\n float f = float(i);\n \n float ridge =\n ((noise(vec2(q.x * (0.55 + f * 0.2) + f * 4.0, t * 0.3)) - 0.5) * 1.7 +\n (noise(vec2(q.x * (1.3 + f * 0.4) + f * 9.0, t * 0.45)) - 0.5) * 0.55) *\n (1.0 + agitate * 2.0) +\n f * 0.22;\n \n float depth = q.y - ridge;\n \n float crisp = mix(0.04, 0.3, noise(vec2(q.x * 0.8 + f * 5.0, t * 0.15)));\n float edge = smoothstep(-crisp, crisp * 0.5, depth);\n \n float rise = exp(-max(depth, 0.0) * (2.9 + f * 1.1));\n \n float rays = fbm(vec2(q.x * (9.0 + f * 4.0), q.y * 0.9 - t * (2.2 + f)));\n\n \n float rim = falloff(depth * depth, 7.0) * 0.45;\n\n \n float lengths = smoothstep(0.2, 0.66, noise(vec2(q.x * 1.15 + f * 13.0, t * 0.12)));\n\n \n float bundles = smoothstep(0.34, 0.86, rays);\n\n \n float foldNoise = noise(vec2(q.x * 1.5 + f * 7.0, t * 0.25));\n\n \n float av = clamp(uVariance, 0.0, 1.0);\n float bundled = mix(mix(0.85, 0.1, av), mix(0.85, 1.6, av), bundles);\n float folded = mix(mix(0.775, 0.15, av), mix(0.775, 1.4, av), foldNoise);\n lit += edge * lengths * (rise * bundled * folded + rim) * (1.0 - f * 0.45);\n }\n return lit;\n }\n\n \n float streaks(vec2 q, float t, vec2 qp, float reach) {\n float near = falloff(dot(q - qp, q - qp), 1.6) * reach;\n vec2 s = q + vec2((q.x - qp.x) * near * 1.1, 0.0);\n\n \n float laneF = s.x * 1.6;\n float base = floor(laneF);\n\n float lit = 0.0;\n \n for (int k = -1; k <= 1; k++) {\n float id = base + float(k);\n float within = laneF - (id + 0.5);\n\n \n float v = clamp(uVariance, 0.0, 1.0);\n float alive = step(0.42, hash(vec2(id, 97.0)));\n float speed = mix(1.3, 0.55 + hash(vec2(id, 11.0)) * 1.5, v);\n float phase = hash(vec2(id, 29.0));\n \n float len = mix(0.85, 0.5 + hash(vec2(id, 47.0)) * 0.8, v);\n\n \n float gap = mix(4.2, 3.2 + hash(vec2(id, 59.0)) * 2.2, v);\n float travel = phase + t * speed * 1.8 / gap;\n float u = s.y / gap - travel;\n float w = fract(u);\n \n float across = within / 1.6;\n \n float wide = mix(0.045, 0.03 + hash(vec2(id, 71.0)) * 0.04, v);\n\n \n float behind = (1.0 - w) * gap;\n float ahead = w * gap;\n float toHead = min(ahead, behind);\n float nose = wide * 0.5;\n\n float near2 = toHead * toHead + across * across;\n float nucleus = exp(-near2 / (2.0 * nose * nose));\n float coma = exp(-near2 / (2.0 * (nose * 3.0) * (nose * 3.0))) * 0.42;\n\n \n float onset = 1.0 - exp(-behind / (0.15 * len));\n\n \n float spread = nose + (0.11 - nose) * (1.0 - exp(-behind * 1.3));\n float tail = exp(-behind / len) * onset *\n exp(-(across * across) / (2.0 * spread * spread)) * 0.5;\n\n \n float weight = mix(1.0, 0.5 + hash(vec2(id, 83.0)) * 0.95, v);\n lit += (nucleus + coma + tail) * alive * weight * mix(1.0, 0.45, near);\n }\n float grain = fbm(vec2(s.x * 3.0, s.y * 1.4 - t * 1.6));\n return lit * mix(0.55, 1.35, grain) * falloff(dot(q, q), 0.42);\n }\n\n \n float waves(vec2 q, float t, vec2 qp, float reach) {\n float pull = falloff(dot(q - qp, q - qp), 1.2) * reach;\n \n float warp = warped(vec2(q.x * 0.5, q.y * 0.4), t * 0.3) - 0.5;\n vec2 w = q + warp * 0.32;\n\n \n float a = sin((w.y * 8.1 + w.x * 2.3) - t * 0.9 - pull * 1.4);\n float b = sin((w.y * 5.3 - w.x * 3.4) + t * 0.6 + pull * 1.0);\n\n \n float band = a * 0.5 + 0.5;\n band *= mix(0.45, 1.0, b * 0.5 + 0.5);\n\n float grain = warped(vec2(w.x * 1.2 + 6.0, w.y * 0.85), t * 0.28);\n return pow(band, 2.2) * mix(0.55, 1.2, grain) * falloff(dot(q, q), 0.4);\n }\n\n \n float threads(vec2 q, float t, vec2 qp, float reach) {\n float pinchAt = mix(0.0, qp.x, reach);\n \n float gather = 1.0 - falloff((q.x - pinchAt) * (q.x - pinchAt), 1.1) * 0.6;\n\n \n float lit = 0.0;\n for (int i = 0; i < 7; i++) {\n float f = float(i);\n float phase = f * (6.2831853 / 7.0);\n\n \n float lane = (f - 3.0) * 0.17 * mix(1.0, gather, 0.65);\n float amp = 0.34 * gather;\n\n \n float y =\n lane +\n sin(q.x * 1.5 + t * 0.55 + phase) * amp +\n sin(q.x * 0.5 - t * 0.3 + phase) * amp * 0.32;\n\n lit += falloff((q.y - y) * (q.y - y), 24.0);\n }\n \n float grain = fbm(vec2(q.x * 2.0, q.y * 2.0 - t));\n return lit * mix(0.85, 1.12, grain) * falloff(dot(q, q), 0.4);\n }\n\n \n float particles(vec2 q, float t, vec2 qp, float reach) {\n float lit = 0.0;\n vec2 cell = floor(q * 2.6);\n for (int j = -1; j <= 1; j++) {\n for (int i = -1; i <= 1; i++) {\n vec2 c = cell + vec2(float(i), float(j));\n float a = hash(c);\n float b = hash(c + 17.3);\n float v = clamp(uVariance, 0.0, 1.0);\n vec2 at = (c + 0.5 + (vec2(a, b) - 0.5) * 0.85) / 2.6;\n at += vec2(\n sin(t * mix(1.0, 0.5 + a, v) + b * 6.28),\n cos(t * mix(1.0, 0.42 + b, v) + a * 6.28)\n ) * 0.07;\n\n vec2 away = at - qp;\n float push = falloff(dot(away, away), 2.2) * reach;\n at += away * push * 0.55;\n\n vec2 off = q - at;\n \n float grade = mix(52.0, 52.0 * (0.62 + hash(c + 5.7) * 0.95), v);\n\n \n float core = falloff(dot(off, off), grade);\n float halo = falloff(dot(off, off), grade * 0.16) * 0.1;\n lit += (core + halo) * mix(0.8, 0.35 + a * 0.9, v);\n }\n }\n return lit * falloff(dot(q, q), 0.4);\n }\n\n \n float flowWake(vec2 at, mat2 turn, vec2 shift, out vec2 push) {\n push = vec2(0.0);\n float wake = 0.0;\n\n for (int i = 0; i < 8; i++) {\n vec3 a = uTrail[i];\n vec3 b = uTrail[i + 1];\n if (a.z >= 1.0 || b.z >= 1.0) {\n continue;\n }\n \n vec2 pa = turn * (a.xy - shift) * uScale;\n vec2 pb = turn * (b.xy - shift) * uScale;\n vec2 ab = pb - pa;\n float len2 = dot(ab, ab);\n if (len2 < 1e-6) {\n continue;\n }\n float t = clamp(dot(at - pa, ab) / len2, 0.0, 1.0);\n vec2 off = at - (pa + ab * t);\n\n \n vec2 tangent = ab * inversesqrt(len2);\n float alongOff = dot(off, tangent);\n float acrossOff = dot(off, vec2(-tangent.y, tangent.x));\n float shaped = acrossOff * acrossOff + alongOff * alongOff * 0.3;\n\n \n float life = 1.0 - mix(a.z, b.z, t);\n float w = life * life * falloff(shaped, 3.2);\n wake += w;\n push += (ab * inversesqrt(len2)) * w;\n }\n\n \n float mag = length(push);\n push = mag > 0.0 ? push * (0.24 / (0.9 + mag)) : vec2(0.0);\n return wake;\n }\n\n float flow(vec2 q, float t, mat2 turn, vec2 shift) {\n vec2 push;\n float wake = flowWake(q, turn, shift, push);\n \n vec2 p = q + push;\n\n \n float ink = warped(p * 0.55, t * 0.55);\n float sheet = warped(p * 1.1 + vec2(3.1, 1.7), t * 0.35);\n\n \n float mass = smoothstep(0.24, 0.72, noise(vec2(p.x * 0.45 - t * 0.1, p.y * 0.4 + t * 0.07)));\n \n float body = mix(0.05, 1.4, ink) * mix(0.4, 1.2, sheet) * mix(0.22, 1.45, mass);\n\n \n return body * (0.85 + clamp(wake, 0.0, 1.0) * 0.5) * falloff(dot(q, q), 0.55);\n }\n\n \n float caustics(vec2 q, float t, vec2 qp, float reach) {\n \n float dropD = length(q - qp);\n float drop = falloff(dropD * dropD, 1.4) * reach;\n\n \n float cv = clamp(uVariance, 0.0, 1.0);\n\n float lit = 0.0;\n for (int i = 0; i < 3; i++) {\n float f = float(i);\n vec2 p = q * mix(2.05, 1.5 + f * 0.55, cv);\n\n \n vec2 w = p + vec2(\n noise(p * 1.25 + vec2(t * 0.42 + f * 4.0, 0.0)),\n noise(p * 1.1 - vec2(0.0, t * 0.36 + f * 7.0))\n ) * 0.85;\n\n float sum = sin(w.x * 3.1 + t * 0.7 + drop * 6.0) + sin(w.y * 2.7 - t * 0.55 - drop * 5.0);\n float fold = 1.0 - clamp(abs(sum) * 0.5, 0.0, 1.0);\n lit += pow(fold, 7.0) * mix(0.78, 1.0 - f * 0.22, cv);\n }\n\n \n float pool = smoothstep(0.2, 0.78, noise(vec2(q.x * 0.55 - t * 0.09, q.y * 0.5 + t * 0.06)));\n\n \n float dim = warped(q * 0.7, t * 0.2);\n return lit * mix(0.55, 1.25, dim) *\n mix(mix(0.75, 0.25, cv), mix(0.75, 1.25, cv), pool) *\n (1.0 + drop * 0.9) * falloff(dot(q, q), 0.4);\n }\n\n \n float lattice(vec2 q, float t, vec2 qp, float reach) {\n \n vec2 away = q - qp;\n float near = falloff(dot(away, away), 1.8) * reach;\n\n \n float below = max(1.45 - q.y, 0.14);\n float depth = 1.0 / below;\n vec2 g = vec2(\n q.x * depth * (2.3 + near * 1.4),\n depth * 1.6 + t * 0.28\n );\n vec2 cell = fract(g) - 0.5;\n\n \n float rail = min(abs(cell.x), abs(cell.y));\n float lines = falloff(rail * rail, 24.0);\n\n \n float node = falloff(dot(cell, cell), 26.0) * 2.1 * (0.6 + near * 0.9);\n\n \n float far = smoothstep(0.0, 0.55, below) * smoothstep(3.4, 1.3, below);\n\n float dust = warped(q * 0.9, t * 0.25);\n return (lines * 0.5 + node) * far * mix(0.7, 1.2, dust) * falloff(dot(q, q), 0.42);\n }\n\n \n float fracture(vec2 q, float t, vec2 qp, float reach) {\n \n float fv = clamp(uVariance, 0.0, 1.0);\n\n vec2 g = q * 2.1;\n vec2 base = floor(g);\n vec2 f = g - base;\n\n float first = 9.0;\n float second = 9.0;\n for (int j = -1; j <= 1; j++) {\n for (int i = -1; i <= 1; i++) {\n vec2 o = vec2(float(i), float(j));\n vec2 id = base + o;\n\n \n float a = hash(id) * 6.2831853;\n float b = hash(id + 41.7) * 6.2831853;\n vec2 site = o + 0.5 + 0.42 * fv * vec2(sin(t * 0.5 + a), cos(t * 0.42 + b));\n\n \n vec2 world = (id + 0.5) / 2.1;\n vec2 shove = world - qp;\n site += normalize(shove + 0.0001) * falloff(dot(shove, shove), 2.4) * reach * 0.5;\n\n float d = length(site - f);\n if (d < first) {\n second = first;\n first = d;\n } else if (d < second) {\n second = d;\n }\n }\n }\n\n float wall = second - first;\n float seam = falloff(wall * wall, 17.0);\n\n \n float contested = smoothstep(0.24, 0.8, noise(vec2(q.x * 0.6 + t * 0.07, q.y * 0.55 - t * 0.05)));\n\n float grain = warped(q * 1.3, t * 0.3);\n return seam * mix(0.6, 1.25, grain) *\n mix(mix(0.74, 0.18, fv), mix(0.74, 1.3, fv), contested) *\n falloff(dot(q, q), 0.42);\n }\n\n \n void main() {\n vec2 p = uv * 2.0 - 1.0;\n float aspect = uResolution.x / max(uResolution.y, 1.0);\n p.x *= aspect;\n\n \n vec2 q = p;\n\n \n float want = radians(uTilt);\n float a = atan(sin(want), cos(want) * aspect);\n mat2 turn = mat2(cos(a), sin(a), -sin(a), cos(a));\n q = turn * q * uScale;\n\n \n vec2 qp = turn * uPointer * uScale;\n\n float t = uTime * 0.06;\n\n \n float own = uInteraction == 0 ? uReach : 0.0;\n\n float d = 0.0;\n if (uShape == 0) {\n d = braid(q, t, qp, own);\n } else if (uShape == 1) {\n d = rays(q, t, qp, own);\n } else if (uShape == 2) {\n d = aurora(q, t, qp, own);\n } else if (uShape == 3) {\n d = streaks(q, t, qp, own);\n } else if (uShape == 4) {\n d = waves(q, t, qp, own);\n } else if (uShape == 5) {\n d = threads(q, t, qp, own);\n } else if (uShape == 6) {\n d = particles(q, t, qp, own);\n } else if (uShape == 7) {\n d = flow(q, t, turn, uPointer * 0.05 * uReach);\n } else if (uShape == 8) {\n d = caustics(q, t, qp, own);\n } else if (uShape == 9) {\n d = lattice(q, t, qp, own);\n } else {\n d = fracture(q, t, qp, own);\n }\n\n \n d = pow(max(d, 0.0), mix(2.0, 0.5, clamp(uBloom, 0.0, 1.0))) * uGain;\n\n \n if (uInteraction != 0 && uInteraction != 4) {\n vec2 toCursor = p - uPointer;\n float near = falloff(dot(toCursor, toCursor), 3.0) * uReach;\n if (uInteraction == 1) {\n d = d * (1.0 + near * 1.2) + near * 0.08;\n } else if (uInteraction == 2) {\n d *= 1.0 - near * 0.85;\n } else {\n float rings = sin(length(toCursor) * 13.0 - uTime * 3.2);\n d *= 1.0 + rings * near * 0.75;\n }\n }\n\n d *= mix(0.65, 1.35, smoothstep(-1.0, 1.0, q.y));\n\n \n float lift = 1.0 - exp(-max(d, 0.0) * 1.15);\n\n vec3 rgb = mix(uGround, uHaze, smoothstep(0.0, 0.16, lift));\n rgb = mix(rgb, uGlow, smoothstep(0.10, 0.46, lift));\n rgb = mix(rgb, uPeak, smoothstep(0.40, 0.72, lift) * 0.6);\n\n \n float dither = (hash(gl_FragCoord.xy) - 0.5) / 255.0;\n color = vec4(rgb + dither, 1.0);\n }\n";
|
|
47
|
+
export declare const FRAGMENT = "#version 300 es\n precision highp float;\n\n in vec2 uv;\n out vec4 color;\n\n uniform vec2 uResolution;\n uniform float uTime;\n uniform int uShape;\n uniform vec2 uPointer;\n uniform float uReach;\n uniform int uInteraction;\n uniform float uTilt;\n uniform float uScale;\n uniform float uBloom;\n uniform float uGain;\n\n \n uniform float uVariance;\n \n uniform vec3 uTrail[9];\n uniform vec3 uGround;\n uniform vec3 uHaze;\n uniform vec3 uGlow;\n uniform vec3 uPeak;\n\n float hash(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);\n }\n\n float noise(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n \n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n return mix(\n mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x),\n mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x),\n u.y\n );\n }\n\n \n const mat2 TURN = mat2(0.8, 0.6, -0.6, 0.8);\n\n float fbm(vec2 p) {\n float sum = 0.0;\n float amp = 0.5;\n for (int i = 0; i < 5; i++) {\n sum += amp * noise(p);\n p = TURN * p * 2.03;\n amp *= 0.5;\n }\n return sum;\n }\n\n \n float warped(vec2 p, float t) {\n vec2 q = vec2(fbm(p + vec2(0.0, t)), fbm(p + vec2(5.2, 1.3 - t)));\n vec2 r = vec2(fbm(p + 4.0 * q + vec2(1.7, 9.2)), fbm(p + 4.0 * q + vec2(8.3, 2.8)));\n return fbm(p + 4.0 * r);\n }\n\n \n float falloff(float d2, float k) {\n float soft = 0.06 / k;\n return exp(-sqrt(d2 + soft * soft) * k);\n }\n\n \n float braid(vec2 q, float t, vec2 qp, float reach) {\n \n float alongside = falloff((q.y - qp.y) * (q.y - qp.y), 1.1) * reach;\n float lean = qp.x * alongside * 0.45;\n float lit = 0.0;\n for (int i = 0; i < 2; i++) {\n float phase = float(i) * 3.14159265;\n float x = q.x - lean - 0.34 * sin(q.y * 1.6 + t * 1.4 + phase);\n lit += 0.8 * falloff(x * x, 13.0);\n }\n float volume = falloff(q.x * q.x, 2.6);\n \n float streak = fbm(vec2(q.x * 9.0, q.y * 0.55 - t * 2.4));\n float haze = warped(vec2(q.x * 0.8 + 4.0, q.y * 0.45), t * 0.5);\n return lit * mix(0.35, 1.65, streak) + volume * 0.3 * mix(0.35, 1.05, haze);\n }\n\n \n float rays(vec2 q, float t, vec2 qp, float reach) {\n \n vec2 o = vec2(0.0, 1.45);\n vec2 v = q - o;\n float dist = length(v);\n float ang = atan(v.x, -v.y);\n\n vec2 vp = qp - o;\n float distToBlocker = length(vp);\n float angToBlocker = atan(vp.x, -vp.y);\n \n float halfAngle = 0.055 / max(distToBlocker, 0.35);\n float across = (ang - angToBlocker) / halfAngle;\n \n float behind = smoothstep(-0.03, 0.05, dist - distToBlocker);\n float shadow = exp(-across * across) * behind * reach;\n\n float fan = fbm(vec2(ang * 8.0, dist * 0.5 - t * 1.8));\n float dust = warped(vec2(ang * 2.0, dist * 0.7), t * 0.4);\n float spread = smoothstep(0.85, 0.05, abs(ang));\n \n float rv = clamp(uVariance, 0.0, 1.0);\n float lit = spread * mix(mix(0.85, 0.2, rv), mix(0.85, 1.5, rv), fan) *\n mix(0.75, 1.15, dust) * falloff(dot(v, v), 0.8);\n return lit * (1.0 - shadow * 0.82);\n }\n\n \n float aurora(vec2 q, float t, vec2 qp, float reach) {\n \n float agitate = falloff((q.x - qp.x) * (q.x - qp.x), 1.5) * reach;\n\n \n float lit = 0.0;\n for (int i = 0; i < 2; i++) {\n float f = float(i);\n \n float ridge =\n ((noise(vec2(q.x * (0.55 + f * 0.2) + f * 4.0, t * 0.3)) - 0.5) * 1.7 +\n (noise(vec2(q.x * (1.3 + f * 0.4) + f * 9.0, t * 0.45)) - 0.5) * 0.55) *\n (1.0 + agitate * 2.0) +\n f * 0.22;\n \n float depth = q.y - ridge;\n \n float crisp = mix(0.04, 0.3, noise(vec2(q.x * 0.8 + f * 5.0, t * 0.15)));\n float edge = smoothstep(-crisp, crisp * 0.5, depth);\n \n float rise = exp(-max(depth, 0.0) * (2.9 + f * 1.1));\n \n float rays = fbm(vec2(q.x * (9.0 + f * 4.0), q.y * 0.9 - t * (2.2 + f)));\n\n \n float rim = falloff(depth * depth, 7.0) * 0.45;\n\n \n float lengths = smoothstep(0.2, 0.66, noise(vec2(q.x * 1.15 + f * 13.0, t * 0.12)));\n\n \n float bundles = smoothstep(0.34, 0.86, rays);\n\n \n float foldNoise = noise(vec2(q.x * 1.5 + f * 7.0, t * 0.25));\n\n \n float av = clamp(uVariance, 0.0, 1.0);\n float bundled = mix(mix(0.85, 0.1, av), mix(0.85, 1.6, av), bundles);\n float folded = mix(mix(0.775, 0.15, av), mix(0.775, 1.4, av), foldNoise);\n lit += edge * lengths * (rise * bundled * folded + rim) * (1.0 - f * 0.45);\n }\n return lit;\n }\n\n \n float streaks(vec2 q, float t, vec2 qp, float reach) {\n float near = falloff(dot(q - qp, q - qp), 1.6) * reach;\n vec2 s = q + vec2((q.x - qp.x) * near * 1.1, 0.0);\n\n \n float laneF = s.x * 1.6;\n float base = floor(laneF);\n\n float lit = 0.0;\n \n for (int k = -1; k <= 1; k++) {\n float id = base + float(k);\n float within = laneF - (id + 0.5);\n\n \n float v = clamp(uVariance, 0.0, 1.0);\n float alive = step(0.42, hash(vec2(id, 97.0)));\n float speed = mix(1.3, 0.55 + hash(vec2(id, 11.0)) * 1.5, v);\n float phase = hash(vec2(id, 29.0));\n \n float len = mix(0.85, 0.5 + hash(vec2(id, 47.0)) * 0.8, v);\n\n \n float gap = mix(4.2, 3.2 + hash(vec2(id, 59.0)) * 2.2, v);\n float travel = phase + t * speed * 1.8 / gap;\n float u = s.y / gap - travel;\n float w = fract(u);\n \n float across = within / 1.6;\n \n float wide = mix(0.045, 0.03 + hash(vec2(id, 71.0)) * 0.04, v);\n\n \n float behind = (1.0 - w) * gap;\n float ahead = w * gap;\n float toHead = min(ahead, behind);\n float nose = wide * 0.5;\n\n float near2 = toHead * toHead + across * across;\n float nucleus = exp(-near2 / (2.0 * nose * nose));\n float coma = exp(-near2 / (2.0 * (nose * 3.0) * (nose * 3.0))) * 0.42;\n\n \n float onset = 1.0 - exp(-behind / (0.15 * len));\n\n \n float spread = nose + (0.11 - nose) * (1.0 - exp(-behind * 1.3));\n float tail = exp(-behind / len) * onset *\n exp(-(across * across) / (2.0 * spread * spread)) * 0.5;\n\n \n float weight = mix(1.0, 0.5 + hash(vec2(id, 83.0)) * 0.95, v);\n lit += (nucleus + coma + tail) * alive * weight * mix(1.0, 0.45, near);\n }\n float grain = fbm(vec2(s.x * 3.0, s.y * 1.4 - t * 1.6));\n return lit * mix(0.55, 1.35, grain) * falloff(dot(q, q), 0.42);\n }\n\n \n float waves(vec2 q, float t, vec2 qp, float reach) {\n float pull = falloff(dot(q - qp, q - qp), 1.2) * reach;\n \n float warp = warped(vec2(q.x * 0.5, q.y * 0.4), t * 0.3) - 0.5;\n vec2 w = q + warp * 0.32;\n\n \n float a = sin((w.y * 8.1 + w.x * 2.3) - t * 0.9 - pull * 1.4);\n float b = sin((w.y * 5.3 - w.x * 3.4) + t * 0.6 + pull * 1.0);\n\n \n float band = a * 0.5 + 0.5;\n band *= mix(0.45, 1.0, b * 0.5 + 0.5);\n\n float grain = warped(vec2(w.x * 1.2 + 6.0, w.y * 0.85), t * 0.28);\n return pow(band, 2.2) * mix(0.55, 1.2, grain) * falloff(dot(q, q), 0.4);\n }\n\n \n float threads(vec2 q, float t, vec2 qp, float reach) {\n float pinchAt = mix(0.0, qp.x, reach);\n \n float gather = 1.0 - falloff((q.x - pinchAt) * (q.x - pinchAt), 1.1) * 0.6;\n\n \n float lit = 0.0;\n for (int i = 0; i < 7; i++) {\n float f = float(i);\n float phase = f * (6.2831853 / 7.0);\n\n \n float lane = (f - 3.0) * 0.17 * mix(1.0, gather, 0.65);\n float amp = 0.34 * gather;\n\n \n float y =\n lane +\n sin(q.x * 1.5 + t * 0.55 + phase) * amp +\n sin(q.x * 0.5 - t * 0.3 + phase) * amp * 0.32;\n\n lit += falloff((q.y - y) * (q.y - y), 24.0);\n }\n \n float grain = fbm(vec2(q.x * 2.0, q.y * 2.0 - t));\n return lit * mix(0.85, 1.12, grain) * falloff(dot(q, q), 0.4);\n }\n\n \n float particles(vec2 q, float t, vec2 qp, float reach) {\n float lit = 0.0;\n vec2 cell = floor(q * 2.6);\n for (int j = -1; j <= 1; j++) {\n for (int i = -1; i <= 1; i++) {\n vec2 c = cell + vec2(float(i), float(j));\n float a = hash(c);\n float b = hash(c + 17.3);\n float v = clamp(uVariance, 0.0, 1.0);\n vec2 at = (c + 0.5 + (vec2(a, b) - 0.5) * 0.85) / 2.6;\n at += vec2(\n sin(t * mix(1.0, 0.5 + a, v) + b * 6.28),\n cos(t * mix(1.0, 0.42 + b, v) + a * 6.28)\n ) * 0.07;\n\n vec2 away = at - qp;\n float push = falloff(dot(away, away), 2.2) * reach;\n at += away * push * 0.55;\n\n vec2 off = q - at;\n \n float grade = mix(52.0, 52.0 * (0.62 + hash(c + 5.7) * 0.95), v);\n\n \n float core = falloff(dot(off, off), grade);\n float halo = falloff(dot(off, off), grade * 0.16) * 0.1;\n lit += (core + halo) * mix(0.8, 0.35 + a * 0.9, v);\n }\n }\n return lit * falloff(dot(q, q), 0.4);\n }\n\n \n vec2 star(vec2 c, float t, vec2 qp, float reach) {\n float a = hash(c);\n float b = hash(c + 17.3);\n float v = clamp(uVariance, 0.0, 1.0);\n vec2 at = (c + 0.5 + (vec2(a, b) - 0.5) * 0.8) / 2.2;\n at += vec2(\n sin(t * mix(0.7, 0.35 + a * 0.7, v) + b * 6.28),\n cos(t * mix(0.7, 0.3 + b * 0.7, v) + a * 6.28)\n ) * 0.06;\n vec2 toward = qp - at;\n float pull = falloff(dot(toward, toward), 1.6) * reach;\n return at + toward * pull * 0.3;\n }\n\n \n float link(vec2 q, vec2 a, vec2 b) {\n vec2 ab = b - a;\n float len2 = dot(ab, ab);\n float reachable = smoothstep(0.62, 0.38, sqrt(len2));\n if (reachable <= 0.0) {\n return 0.0;\n }\n float h = clamp(dot(q - a, ab) / max(len2, 0.0001), 0.0, 1.0);\n vec2 off = q - (a + ab * h);\n return falloff(dot(off, off), 180.0) * reachable;\n }\n\n float constellation(vec2 q, float t, vec2 qp, float reach) {\n float lit = 0.0;\n float v = clamp(uVariance, 0.0, 1.0);\n vec2 cell = floor(q * 2.2);\n for (int j = -1; j <= 1; j++) {\n for (int i = -1; i <= 1; i++) {\n vec2 c = cell + vec2(float(i), float(j));\n vec2 at = star(c, t, qp, reach);\n vec2 off = q - at;\n \n float grade = mix(70.0, 70.0 * (0.7 + hash(c + 5.7) * 0.8), v);\n lit += falloff(dot(off, off), grade) * mix(0.9, 0.5 + hash(c) * 0.8, v);\n lit += falloff(dot(off, off), grade * 0.16) * 0.06;\n \n lit += link(q, at, star(c + vec2(1.0, 0.0), t, qp, reach)) * 0.35;\n lit += link(q, at, star(c + vec2(0.0, 1.0), t, qp, reach)) * 0.35;\n lit += link(q, at, star(c + vec2(1.0, 1.0), t, qp, reach)) * 0.35;\n lit += link(q, at, star(c + vec2(-1.0, 1.0), t, qp, reach)) * 0.35;\n }\n }\n return lit * falloff(dot(q, q), 0.4);\n }\n\n \n float flowWake(vec2 at, mat2 turn, vec2 shift, out vec2 push) {\n push = vec2(0.0);\n float wake = 0.0;\n\n for (int i = 0; i < 8; i++) {\n vec3 a = uTrail[i];\n vec3 b = uTrail[i + 1];\n if (a.z >= 1.0 || b.z >= 1.0) {\n continue;\n }\n \n vec2 pa = turn * (a.xy - shift) * uScale;\n vec2 pb = turn * (b.xy - shift) * uScale;\n vec2 ab = pb - pa;\n float len2 = dot(ab, ab);\n if (len2 < 1e-6) {\n continue;\n }\n float t = clamp(dot(at - pa, ab) / len2, 0.0, 1.0);\n vec2 off = at - (pa + ab * t);\n\n \n vec2 tangent = ab * inversesqrt(len2);\n float alongOff = dot(off, tangent);\n float acrossOff = dot(off, vec2(-tangent.y, tangent.x));\n float shaped = acrossOff * acrossOff + alongOff * alongOff * 0.3;\n\n \n float life = 1.0 - mix(a.z, b.z, t);\n float w = life * life * falloff(shaped, 3.2);\n wake += w;\n push += (ab * inversesqrt(len2)) * w;\n }\n\n \n float mag = length(push);\n push = mag > 0.0 ? push * (0.24 / (0.9 + mag)) : vec2(0.0);\n return wake;\n }\n\n float flow(vec2 q, float t, mat2 turn, vec2 shift) {\n vec2 push;\n float wake = flowWake(q, turn, shift, push);\n \n vec2 p = q + push;\n\n \n float ink = warped(p * 0.55, t * 0.55);\n float sheet = warped(p * 1.1 + vec2(3.1, 1.7), t * 0.35);\n\n \n float mass = smoothstep(0.24, 0.72, noise(vec2(p.x * 0.45 - t * 0.1, p.y * 0.4 + t * 0.07)));\n \n float body = mix(0.05, 1.4, ink) * mix(0.4, 1.2, sheet) * mix(0.22, 1.45, mass);\n\n \n return body * (0.85 + clamp(wake, 0.0, 1.0) * 0.5) * falloff(dot(q, q), 0.55);\n }\n\n \n float caustics(vec2 q, float t, vec2 qp, float reach) {\n \n float dropD = length(q - qp);\n float drop = falloff(dropD * dropD, 1.4) * reach;\n\n \n float cv = clamp(uVariance, 0.0, 1.0);\n\n float lit = 0.0;\n for (int i = 0; i < 3; i++) {\n float f = float(i);\n vec2 p = q * mix(2.05, 1.5 + f * 0.55, cv);\n\n \n vec2 w = p + vec2(\n noise(p * 1.25 + vec2(t * 0.42 + f * 4.0, 0.0)),\n noise(p * 1.1 - vec2(0.0, t * 0.36 + f * 7.0))\n ) * 0.85;\n\n float sum = sin(w.x * 3.1 + t * 0.7 + drop * 6.0) + sin(w.y * 2.7 - t * 0.55 - drop * 5.0);\n float fold = 1.0 - clamp(abs(sum) * 0.5, 0.0, 1.0);\n lit += pow(fold, 7.0) * mix(0.78, 1.0 - f * 0.22, cv);\n }\n\n \n float pool = smoothstep(0.2, 0.78, noise(vec2(q.x * 0.55 - t * 0.09, q.y * 0.5 + t * 0.06)));\n\n \n float dim = warped(q * 0.7, t * 0.2);\n return lit * mix(0.55, 1.25, dim) *\n mix(mix(0.75, 0.25, cv), mix(0.75, 1.25, cv), pool) *\n (1.0 + drop * 0.9) * falloff(dot(q, q), 0.4);\n }\n\n \n float lattice(vec2 q, float t, vec2 qp, float reach) {\n \n vec2 away = q - qp;\n float near = falloff(dot(away, away), 1.8) * reach;\n\n \n float below = max(1.45 - q.y, 0.14);\n float depth = 1.0 / below;\n vec2 g = vec2(\n q.x * depth * (2.3 + near * 1.4),\n depth * 1.6 + t * 0.28\n );\n vec2 cell = fract(g) - 0.5;\n\n \n float rail = min(abs(cell.x), abs(cell.y));\n float lines = falloff(rail * rail, 24.0);\n\n \n float node = falloff(dot(cell, cell), 26.0) * 2.1 * (0.6 + near * 0.9);\n\n \n float far = smoothstep(0.0, 0.55, below) * smoothstep(3.4, 1.3, below);\n\n float dust = warped(q * 0.9, t * 0.25);\n return (lines * 0.5 + node) * far * mix(0.7, 1.2, dust) * falloff(dot(q, q), 0.42);\n }\n\n \n float fracture(vec2 q, float t, vec2 qp, float reach) {\n \n float fv = clamp(uVariance, 0.0, 1.0);\n\n vec2 g = q * 2.1;\n vec2 base = floor(g);\n vec2 f = g - base;\n\n float first = 9.0;\n float second = 9.0;\n for (int j = -1; j <= 1; j++) {\n for (int i = -1; i <= 1; i++) {\n vec2 o = vec2(float(i), float(j));\n vec2 id = base + o;\n\n \n float a = hash(id) * 6.2831853;\n float b = hash(id + 41.7) * 6.2831853;\n vec2 site = o + 0.5 + 0.42 * fv * vec2(sin(t * 0.5 + a), cos(t * 0.42 + b));\n\n \n vec2 world = (id + 0.5) / 2.1;\n vec2 shove = world - qp;\n site += normalize(shove + 0.0001) * falloff(dot(shove, shove), 2.4) * reach * 0.5;\n\n float d = length(site - f);\n if (d < first) {\n second = first;\n first = d;\n } else if (d < second) {\n second = d;\n }\n }\n }\n\n float wall = second - first;\n float seam = falloff(wall * wall, 17.0);\n\n \n float contested = smoothstep(0.24, 0.8, noise(vec2(q.x * 0.6 + t * 0.07, q.y * 0.55 - t * 0.05)));\n\n float grain = warped(q * 1.3, t * 0.3);\n return seam * mix(0.6, 1.25, grain) *\n mix(mix(0.74, 0.18, fv), mix(0.74, 1.3, fv), contested) *\n falloff(dot(q, q), 0.42);\n }\n\n \n void main() {\n vec2 p = uv * 2.0 - 1.0;\n float aspect = uResolution.x / max(uResolution.y, 1.0);\n p.x *= aspect;\n\n \n vec2 q = p;\n\n \n float want = radians(uTilt);\n float a = atan(sin(want), cos(want) * aspect);\n mat2 turn = mat2(cos(a), sin(a), -sin(a), cos(a));\n q = turn * q * uScale;\n\n \n vec2 qp = turn * uPointer * uScale;\n\n float t = uTime * 0.06;\n\n \n float own = uInteraction == 0 ? uReach : 0.0;\n\n float d = 0.0;\n if (uShape == 0) {\n d = braid(q, t, qp, own);\n } else if (uShape == 1) {\n d = rays(q, t, qp, own);\n } else if (uShape == 2) {\n d = aurora(q, t, qp, own);\n } else if (uShape == 3) {\n d = streaks(q, t, qp, own);\n } else if (uShape == 4) {\n d = waves(q, t, qp, own);\n } else if (uShape == 5) {\n d = threads(q, t, qp, own);\n } else if (uShape == 6) {\n d = particles(q, t, qp, own);\n } else if (uShape == 7) {\n d = flow(q, t, turn, uPointer * 0.05 * uReach);\n } else if (uShape == 8) {\n d = caustics(q, t, qp, own);\n } else if (uShape == 9) {\n d = lattice(q, t, qp, own);\n } else if (uShape == 10) {\n d = fracture(q, t, qp, own);\n } else {\n d = constellation(q, t, qp, own);\n }\n\n \n d = pow(max(d, 0.0), mix(2.0, 0.5, clamp(uBloom, 0.0, 1.0))) * uGain;\n\n \n if (uInteraction != 0 && uInteraction != 4) {\n vec2 toCursor = p - uPointer;\n float near = falloff(dot(toCursor, toCursor), 3.0) * uReach;\n if (uInteraction == 1) {\n d = d * (1.0 + near * 1.2) + near * 0.08;\n } else if (uInteraction == 2) {\n d *= 1.0 - near * 0.85;\n } else {\n float rings = sin(length(toCursor) * 13.0 - uTime * 3.2);\n d *= 1.0 + rings * near * 0.75;\n }\n }\n\n d *= mix(0.65, 1.35, smoothstep(-1.0, 1.0, q.y));\n\n \n float lift = 1.0 - exp(-max(d, 0.0) * 1.15);\n\n vec3 rgb = mix(uGround, uHaze, smoothstep(0.0, 0.16, lift));\n rgb = mix(rgb, uGlow, smoothstep(0.10, 0.46, lift));\n rgb = mix(rgb, uPeak, smoothstep(0.40, 0.72, lift) * 0.6);\n\n \n float dither = (hash(gl_FragCoord.xy) - 0.5) / 255.0;\n color = vec4(rgb + dither, 1.0);\n }\n";
|
package/dist/aura/shader.js
CHANGED
|
@@ -10,6 +10,7 @@ export const SHAPES = [
|
|
|
10
10
|
'caustics',
|
|
11
11
|
'lattice',
|
|
12
12
|
'fracture',
|
|
13
|
+
'constellation',
|
|
13
14
|
];
|
|
14
15
|
export const INTERACTIONS = ['native', 'light', 'shadow', 'ripple', 'none'];
|
|
15
16
|
export const VERTEX = `#version 300 es
|
|
@@ -321,6 +322,57 @@ export const FRAGMENT = `#version 300 es
|
|
|
321
322
|
return lit * falloff(dot(q, q), 0.4);
|
|
322
323
|
}
|
|
323
324
|
|
|
325
|
+
${''}
|
|
326
|
+
vec2 star(vec2 c, float t, vec2 qp, float reach) {
|
|
327
|
+
float a = hash(c);
|
|
328
|
+
float b = hash(c + 17.3);
|
|
329
|
+
float v = clamp(uVariance, 0.0, 1.0);
|
|
330
|
+
vec2 at = (c + 0.5 + (vec2(a, b) - 0.5) * 0.8) / 2.2;
|
|
331
|
+
at += vec2(
|
|
332
|
+
sin(t * mix(0.7, 0.35 + a * 0.7, v) + b * 6.28),
|
|
333
|
+
cos(t * mix(0.7, 0.3 + b * 0.7, v) + a * 6.28)
|
|
334
|
+
) * 0.06;
|
|
335
|
+
vec2 toward = qp - at;
|
|
336
|
+
float pull = falloff(dot(toward, toward), 1.6) * reach;
|
|
337
|
+
return at + toward * pull * 0.3;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
${''}
|
|
341
|
+
float link(vec2 q, vec2 a, vec2 b) {
|
|
342
|
+
vec2 ab = b - a;
|
|
343
|
+
float len2 = dot(ab, ab);
|
|
344
|
+
float reachable = smoothstep(0.62, 0.38, sqrt(len2));
|
|
345
|
+
if (reachable <= 0.0) {
|
|
346
|
+
return 0.0;
|
|
347
|
+
}
|
|
348
|
+
float h = clamp(dot(q - a, ab) / max(len2, 0.0001), 0.0, 1.0);
|
|
349
|
+
vec2 off = q - (a + ab * h);
|
|
350
|
+
return falloff(dot(off, off), 180.0) * reachable;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
float constellation(vec2 q, float t, vec2 qp, float reach) {
|
|
354
|
+
float lit = 0.0;
|
|
355
|
+
float v = clamp(uVariance, 0.0, 1.0);
|
|
356
|
+
vec2 cell = floor(q * 2.2);
|
|
357
|
+
for (int j = -1; j <= 1; j++) {
|
|
358
|
+
for (int i = -1; i <= 1; i++) {
|
|
359
|
+
vec2 c = cell + vec2(float(i), float(j));
|
|
360
|
+
vec2 at = star(c, t, qp, reach);
|
|
361
|
+
vec2 off = q - at;
|
|
362
|
+
${''}
|
|
363
|
+
float grade = mix(70.0, 70.0 * (0.7 + hash(c + 5.7) * 0.8), v);
|
|
364
|
+
lit += falloff(dot(off, off), grade) * mix(0.9, 0.5 + hash(c) * 0.8, v);
|
|
365
|
+
lit += falloff(dot(off, off), grade * 0.16) * 0.06;
|
|
366
|
+
${''}
|
|
367
|
+
lit += link(q, at, star(c + vec2(1.0, 0.0), t, qp, reach)) * 0.35;
|
|
368
|
+
lit += link(q, at, star(c + vec2(0.0, 1.0), t, qp, reach)) * 0.35;
|
|
369
|
+
lit += link(q, at, star(c + vec2(1.0, 1.0), t, qp, reach)) * 0.35;
|
|
370
|
+
lit += link(q, at, star(c + vec2(-1.0, 1.0), t, qp, reach)) * 0.35;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return lit * falloff(dot(q, q), 0.4);
|
|
374
|
+
}
|
|
375
|
+
|
|
324
376
|
${''}
|
|
325
377
|
float flowWake(vec2 at, mat2 turn, vec2 shift, out vec2 push) {
|
|
326
378
|
push = vec2(0.0);
|
|
@@ -537,8 +589,10 @@ export const FRAGMENT = `#version 300 es
|
|
|
537
589
|
d = caustics(q, t, qp, own);
|
|
538
590
|
} else if (uShape == 9) {
|
|
539
591
|
d = lattice(q, t, qp, own);
|
|
540
|
-
} else {
|
|
592
|
+
} else if (uShape == 10) {
|
|
541
593
|
d = fracture(q, t, qp, own);
|
|
594
|
+
} else {
|
|
595
|
+
d = constellation(q, t, qp, own);
|
|
542
596
|
}
|
|
543
597
|
|
|
544
598
|
${''}
|
|
@@ -173,7 +173,7 @@ registerElementEvents({
|
|
|
173
173
|
'helix-reorder',
|
|
174
174
|
'input',
|
|
175
175
|
],
|
|
176
|
-
'helix-log': ['helix-before-pin', 'helix-expand', 'helix-pin'],
|
|
176
|
+
'helix-log': ['helix-before-pin', 'helix-expand', 'helix-pin', 'helix-select', 'helix-selected'],
|
|
177
177
|
'helix-log-group': ['helix-before-close', 'helix-before-open', 'toggle'],
|
|
178
178
|
'helix-map': [
|
|
179
179
|
'change',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createSheet } from '@fusion.dev/helix-core';
|
|
2
|
-
export const styles = createSheet(`:host {display: block}[part~="line"] {column-gap: var(--helix-space-md);display: flex;inline-size: var(--_log-line-size, max-content);min-inline-size: 100%;padding-inline: var(--log-padding-inline, var(--helix-space-md))}[part~="line"]:hover {background-color: color-mix(in oklab, var(--helix-color-foreground) 4%, transparent)}[part="number"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;min-inline-size: max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch));text-align: end;text-decoration: none;user-select: none}a[part="number"]:hover {color: var(--helix-color-foreground);text-decoration: underline}a[part="number"]:focus-visible {border-radius: var(--helix-radii-sm);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1)}[part="time"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;user-select: none}[part="text"] {flex: 1 1 auto;min-inline-size: 0;overflow-wrap: anywhere;white-space: var(--_log-white-space, pre)}[part~="line-debug"] {color: var(--helix-color-foreground-subtle)}[part~="line-warn"] {background-color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 10%, transparent);color: var(--log-warn-color, var(--helix-color-warning))}[part~="line-error"] {background-color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 10%, transparent);color: var(--log-error-color, var(--helix-color-danger))}[part~="line-marked"] {background-color: var(--log-mark-background-color, color-mix(in oklab, var(--helix-color-primary) 12%, transparent))}[part~="run"] {background-color: var(--log-run-background-color, transparent);color: var(--log-run-color, inherit)}[part~="run-bold"] {font-weight: var(--helix-weight-semibold)}[part~="run-dim"] {opacity: 0.7}[part~="run-italic"] {font-style: italic}[part~="run-underline"] {text-decoration-line: underline}[part~="run-strike"] {text-decoration-line: line-through}[part~="run-underline"][part~="run-strike"] {text-decoration-line: underline line-through}[part="match"] {background-color: var(--log-match-background-color, var(--helix-color-warning-surface));border-radius: var(--helix-radii-sm);color: inherit}@media print {[part~="line"] {print-color-adjust: exact}}`);
|
|
2
|
+
export const styles = createSheet(`:host {display: block}[part~="line"] {column-gap: var(--helix-space-md);display: flex;inline-size: var(--_log-line-size, max-content);min-inline-size: 100%;padding-inline: var(--log-padding-inline, var(--helix-space-md))}[part~="line"]:hover {background-color: color-mix(in oklab, var(--helix-color-foreground) 4%, transparent)}:where(button[part="number"]) {all: unset;box-sizing: border-box}[part="number"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;min-inline-size: max(var(--helix-size-icon-sm), calc(var(--log-digits, 2) * 1ch));text-align: end;text-decoration: none;user-select: none}a[part="number"]:hover, button[part="number"]:hover {color: var(--helix-color-foreground);cursor: pointer}a[part="number"]:hover {text-decoration: underline}a[part="number"]:focus-visible, button[part="number"]:focus-visible {border-radius: var(--helix-radii-sm);outline: var(--helix-size-focus-ring) solid var(--helix-color-focus-ring);outline-offset: calc(var(--helix-size-focus-offset) * -1)}[part="time"] {color: var(--helix-color-foreground-muted);flex: none;font-variant-numeric: tabular-nums;user-select: none}[part="text"] {flex: 1 1 auto;min-inline-size: 0;overflow-wrap: anywhere;white-space: var(--_log-white-space, pre)}[part~="line-debug"] {color: var(--helix-color-foreground-subtle)}[part~="line-warn"] {background-color: color-mix(in oklab, var(--log-warn-color, var(--helix-color-warning)) 10%, transparent);color: var(--log-warn-color, var(--helix-color-warning))}[part~="line-error"] {background-color: color-mix(in oklab, var(--log-error-color, var(--helix-color-danger)) 10%, transparent);color: var(--log-error-color, var(--helix-color-danger))}[part~="line-marked"] {background-color: var(--log-mark-background-color, color-mix(in oklab, var(--helix-color-primary) 12%, transparent))}[part~="line-selected"] {background-color: var(--log-selected-background-color, color-mix(in oklab, var(--helix-color-info) 14%, transparent))}[part~="line-selected"] > [part="number"] {color: var(--helix-color-foreground)}[part~="run"] {background-color: var(--log-run-background-color, transparent);color: var(--log-run-color, inherit)}[part~="run-bold"] {font-weight: var(--helix-weight-semibold)}[part~="run-dim"] {opacity: 0.7}[part~="run-italic"] {font-style: italic}[part~="run-underline"] {text-decoration-line: underline}[part~="run-strike"] {text-decoration-line: line-through}[part~="run-underline"][part~="run-strike"] {text-decoration-line: underline line-through}[part="match"] {background-color: var(--log-match-background-color, var(--helix-color-warning-surface));border-radius: var(--helix-radii-sm);color: inherit}@media print {[part~="line"] {print-color-adjust: exact}}`);
|
|
@@ -15,6 +15,7 @@ import type { CSSResultGroup } from 'lit';
|
|
|
15
15
|
* @cssproperty --log-error-color - The color of a line at `error`, and of the band behind it. Defaults to the danger color.
|
|
16
16
|
* @cssproperty --log-mark-background-color - The band behind a line `mark-lines` names.
|
|
17
17
|
* @cssproperty --log-match-background-color - The fill behind text that matches the log's `query`.
|
|
18
|
+
* @cssproperty --log-selected-background-color - The band behind a selected line, on a `selectable` log.
|
|
18
19
|
* @cssproperty --log-warn-color - The color of a line at `warn`, and of the band behind it. Defaults to the warning color.
|
|
19
20
|
*/
|
|
20
21
|
export declare class HelixLogLine extends HelixHeadlessLogLine {
|