shaders 2.3.51 → 2.3.53
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/dist/core/Aurora-BDnL1XdK.js +233 -0
- package/dist/core/CursorRipples-Dn_rE8nA.js +177 -0
- package/dist/core/registry.js +144 -140
- package/dist/core/shaderRegistry.d.ts.map +1 -1
- package/dist/core/shaders/Aurora/index.d.ts +99 -0
- package/dist/core/shaders/Aurora/index.d.ts.map +1 -0
- package/dist/core/shaders/Aurora/index.js +5 -0
- package/dist/core/shaders/Beam/index.js +1 -1
- package/dist/core/shaders/Blob/index.js +1 -1
- package/dist/core/shaders/Blur/index.js +1 -1
- package/dist/core/shaders/BrightnessContrast/index.js +1 -1
- package/dist/core/shaders/Bulge/index.js +1 -1
- package/dist/core/shaders/CRTScreen/index.js +1 -1
- package/dist/core/shaders/ChannelBlur/index.js +1 -1
- package/dist/core/shaders/Checkerboard/index.js +1 -1
- package/dist/core/shaders/ChromaFlow/index.js +1 -1
- package/dist/core/shaders/ChromaticAberration/index.js +1 -1
- package/dist/core/shaders/Circle/index.js +1 -1
- package/dist/core/shaders/ConcentricSpin/index.js +1 -1
- package/dist/core/shaders/ContourLines/index.js +1 -1
- package/dist/core/shaders/CursorRipples/index.d.ts +42 -0
- package/dist/core/shaders/CursorRipples/index.d.ts.map +1 -0
- package/dist/core/shaders/CursorRipples/index.js +4 -0
- package/dist/core/shaders/CursorTrail/index.js +1 -1
- package/dist/core/shaders/DiffuseBlur/index.js +1 -1
- package/dist/core/shaders/Dither/index.js +1 -1
- package/dist/core/shaders/DotGrid/index.js +1 -1
- package/dist/core/shaders/Duotone/index.js +1 -1
- package/dist/core/shaders/FilmGrain/index.js +1 -1
- package/dist/core/shaders/FloatingParticles/index.js +1 -1
- package/dist/core/shaders/FlowField/index.js +1 -1
- package/dist/core/shaders/GlassTiles/index.js +1 -1
- package/dist/core/shaders/Glitch/index.js +1 -1
- package/dist/core/shaders/Glow/index.js +1 -1
- package/dist/core/shaders/Godrays/index.js +1 -1
- package/dist/core/shaders/Grayscale/index.js +1 -1
- package/dist/core/shaders/Grid/index.js +1 -1
- package/dist/core/shaders/GridDistortion/index.js +1 -1
- package/dist/core/shaders/Group/index.js +1 -1
- package/dist/core/shaders/Halftone/index.js +1 -1
- package/dist/core/shaders/HueShift/index.js +1 -1
- package/dist/core/shaders/ImageTexture/index.js +1 -1
- package/dist/core/shaders/Invert/index.js +1 -1
- package/dist/core/shaders/Kaleidoscope/index.js +1 -1
- package/dist/core/shaders/LensFlare/index.js +1 -1
- package/dist/core/shaders/LinearBlur/index.js +1 -1
- package/dist/core/shaders/LinearGradient/index.js +1 -1
- package/dist/core/shaders/Liquify/index.js +1 -1
- package/dist/core/shaders/Mirror/index.js +1 -1
- package/dist/core/shaders/Perspective/index.js +1 -1
- package/dist/core/shaders/Pixelate/index.js +1 -1
- package/dist/core/shaders/Plasma/index.js +1 -1
- package/dist/core/shaders/PolarCoordinates/index.js +1 -1
- package/dist/core/shaders/Posterize/index.js +1 -1
- package/dist/core/shaders/ProgressiveBlur/index.js +1 -1
- package/dist/core/shaders/RadialGradient/index.js +1 -1
- package/dist/core/shaders/RectangularCoordinates/index.js +1 -1
- package/dist/core/shaders/Ripples/index.js +1 -1
- package/dist/core/shaders/Saturation/index.js +1 -1
- package/dist/core/shaders/Sharpness/index.js +1 -1
- package/dist/core/shaders/Shatter/index.js +1 -1
- package/dist/core/shaders/SimplexNoise/index.js +1 -1
- package/dist/core/shaders/SineWave/index.js +1 -1
- package/dist/core/shaders/SolidColor/index.js +1 -1
- package/dist/core/shaders/Spherize/index.js +1 -1
- package/dist/core/shaders/Spiral/index.js +1 -1
- package/dist/core/shaders/Strands/index.js +1 -1
- package/dist/core/shaders/Stretch/index.js +1 -1
- package/dist/core/shaders/Stripes/index.js +1 -1
- package/dist/core/shaders/StudioBackground/index.js +1 -1
- package/dist/core/shaders/Swirl/index.js +1 -1
- package/dist/core/shaders/TiltShift/index.js +1 -1
- package/dist/core/shaders/Tint/index.js +1 -1
- package/dist/core/shaders/Tritone/index.js +1 -1
- package/dist/core/shaders/Twirl/index.js +1 -1
- package/dist/core/shaders/Vibrance/index.js +1 -1
- package/dist/core/shaders/VideoTexture/index.js +1 -1
- package/dist/core/shaders/WaveDistortion/index.js +1 -1
- package/dist/core/shaders/WebcamTexture/index.js +1 -1
- package/dist/core/shaders/ZoomBlur/index.js +1 -1
- package/dist/react/Aurora.js +164 -0
- package/dist/react/CursorRipples.js +164 -0
- package/dist/react/components/Aurora.d.ts +31 -0
- package/dist/react/components/Aurora.d.ts.map +1 -0
- package/dist/react/components/CursorRipples.d.ts +31 -0
- package/dist/react/components/CursorRipples.d.ts.map +1 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/react/utils/generatePresetCode.js +31 -0
- package/dist/registry.js +499 -0
- package/dist/solid/components/Aurora.d.ts +28 -0
- package/dist/solid/components/Aurora.d.ts.map +1 -0
- package/dist/solid/components/Aurora.js +168 -0
- package/dist/solid/components/CursorRipples.d.ts +28 -0
- package/dist/solid/components/CursorRipples.d.ts.map +1 -0
- package/dist/solid/components/CursorRipples.js +168 -0
- package/dist/solid/index.d.ts +2 -0
- package/dist/solid/index.d.ts.map +1 -1
- package/dist/solid/index.js +146 -142
- package/dist/solid/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/solid/utils/generatePresetCode.js +31 -0
- package/dist/svelte/components/Aurora.svelte.d.ts +19 -0
- package/dist/svelte/components/CursorRipples.svelte.d.ts +19 -0
- package/dist/svelte/{generatePresetCode-TDa1I3YR.js → generatePresetCode-DN-iUvZN.js} +31 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/index.js +545 -285
- package/dist/svelte/utils/generatePresetCode.js +1 -1
- package/dist/vue/Aurora.js +3 -0
- package/dist/vue/Aurora.vue_vue_type_script_setup_true_lang.js +156 -0
- package/dist/vue/CursorRipples.js +3 -0
- package/dist/vue/CursorRipples.vue_vue_type_script_setup_true_lang.js +148 -0
- package/dist/vue/components/Aurora.vue.d.ts +54 -0
- package/dist/vue/components/Aurora.vue.d.ts.map +1 -0
- package/dist/vue/components/CursorRipples.vue.d.ts +54 -0
- package/dist/vue/components/CursorRipples.vue.d.ts.map +1 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +3 -1
- package/dist/vue/utils/generatePresetCode.d.ts.map +1 -1
- package/dist/vue/utils/generatePresetCode.js +31 -0
- package/package.json +17 -1
- /package/dist/core/{Beam-BBbjVQDP.js → Beam-CyRoRQEj.js} +0 -0
- /package/dist/core/{Blob-DeD9KRj-.js → Blob-BgN4aVOR.js} +0 -0
- /package/dist/core/{Blur-Brqgsz7y.js → Blur-NNElJwzj.js} +0 -0
- /package/dist/core/{BrightnessContrast-DSePKfxC.js → BrightnessContrast-FdkKMaQQ.js} +0 -0
- /package/dist/core/{Bulge-D2OwcL23.js → Bulge-Ca9hW7y4.js} +0 -0
- /package/dist/core/{CRTScreen-D6qh6DnD.js → CRTScreen-BHKDJ9_0.js} +0 -0
- /package/dist/core/{ChannelBlur-BKo9uGaB.js → ChannelBlur-A0r5Gx_y.js} +0 -0
- /package/dist/core/{Checkerboard-ChbG4nPC.js → Checkerboard-XJh_tV6B.js} +0 -0
- /package/dist/core/{ChromaFlow-DyqU1igx.js → ChromaFlow-Cc647Knw.js} +0 -0
- /package/dist/core/{ChromaticAberration-9nlFN2h0.js → ChromaticAberration-CYvju_kr.js} +0 -0
- /package/dist/core/{Circle-DSQ_9vPx.js → Circle-C9DYXDnD.js} +0 -0
- /package/dist/core/{ConcentricSpin-CLTGx_sN.js → ConcentricSpin-CnuAW_6I.js} +0 -0
- /package/dist/core/{ContourLines-Dc5J7iw5.js → ContourLines-DJ0R9q6Y.js} +0 -0
- /package/dist/core/{CursorTrail-COnyRZH9.js → CursorTrail-DD4YxAqo.js} +0 -0
- /package/dist/core/{DiffuseBlur-DcV8M7hN.js → DiffuseBlur-GlibDd8O.js} +0 -0
- /package/dist/core/{Dither-C-w0ugGX.js → Dither-BOWyA2dp.js} +0 -0
- /package/dist/core/{DotGrid-wXnfcjrM.js → DotGrid-Cm-wz6WU.js} +0 -0
- /package/dist/core/{Duotone-B8dYgrFR.js → Duotone-C8mRw_1e.js} +0 -0
- /package/dist/core/{FilmGrain-D_6m7GJ4.js → FilmGrain-BzD2zoUK.js} +0 -0
- /package/dist/core/{FloatingParticles-YuuXeICf.js → FloatingParticles-GkVY1twT.js} +0 -0
- /package/dist/core/{FlowField-Dx2eqOcU.js → FlowField-S_LXjhaN.js} +0 -0
- /package/dist/core/{GlassTiles-hnt2pUQN.js → GlassTiles--hbefQlc.js} +0 -0
- /package/dist/core/{Glitch-DfPXeSlL.js → Glitch-lbgQYebN.js} +0 -0
- /package/dist/core/{Glow-CQv_dRPj.js → Glow-DM9zbhbr.js} +0 -0
- /package/dist/core/{Godrays-B_-HliEA.js → Godrays-DVo1ikUR.js} +0 -0
- /package/dist/core/{Grayscale-DRFXhxr4.js → Grayscale-CRYK8foe.js} +0 -0
- /package/dist/core/{Grid-DKSUwEIe.js → Grid-BmYSb6Ur.js} +0 -0
- /package/dist/core/{GridDistortion-DahXljLX.js → GridDistortion-PNU8pi2I.js} +0 -0
- /package/dist/core/{Group-r9gMBd5y.js → Group-D-QMn-Co.js} +0 -0
- /package/dist/core/{Halftone-ZVjwkjaQ.js → Halftone-BlY2LuT8.js} +0 -0
- /package/dist/core/{HueShift-gZlNBwNE.js → HueShift-p4t6HfqE.js} +0 -0
- /package/dist/core/{ImageTexture-DuXMku_O.js → ImageTexture-BAOtuVAy.js} +0 -0
- /package/dist/core/{Invert-gUjZNHF3.js → Invert-oYct5uwC.js} +0 -0
- /package/dist/core/{Kaleidoscope-COKZ0BDb.js → Kaleidoscope-BXKsOJl2.js} +0 -0
- /package/dist/core/{LensFlare-D6jy4M7G.js → LensFlare-BWl8PWjv.js} +0 -0
- /package/dist/core/{LinearBlur-CArDQIhs.js → LinearBlur-gV1sIMuQ.js} +0 -0
- /package/dist/core/{LinearGradient-BkB_3gVV.js → LinearGradient-C5kz9RSs.js} +0 -0
- /package/dist/core/{Liquify-BrIB9ajS.js → Liquify-CtUvuV0S.js} +0 -0
- /package/dist/core/{Mirror-BRPYfVAr.js → Mirror-C3Bn9m7T.js} +0 -0
- /package/dist/core/{Perspective-CglPLWTZ.js → Perspective-NsMXVWAS.js} +0 -0
- /package/dist/core/{Pixelate-CwnuDc5L.js → Pixelate-C-LbtIjf.js} +0 -0
- /package/dist/core/{Plasma-CuW-GOI_.js → Plasma-Dr516u2H.js} +0 -0
- /package/dist/core/{PolarCoordinates-9AFXKnSC.js → PolarCoordinates-HVxz9oX-.js} +0 -0
- /package/dist/core/{Posterize-DU2yrydV.js → Posterize-DbPe3f5d.js} +0 -0
- /package/dist/core/{ProgressiveBlur-BXv2mob_.js → ProgressiveBlur-Cf2pKf8U.js} +0 -0
- /package/dist/core/{RadialGradient-Dd21Be-_.js → RadialGradient-Bel2cjwV.js} +0 -0
- /package/dist/core/{RectangularCoordinates-DAOGnX2p.js → RectangularCoordinates-BfeH7Mp6.js} +0 -0
- /package/dist/core/{Ripples-Nk5is8WX.js → Ripples-DBqbjqb_.js} +0 -0
- /package/dist/core/{Saturation-KoiVB92Y.js → Saturation-4L5KnzYg.js} +0 -0
- /package/dist/core/{Sharpness-CK-zaDVc.js → Sharpness-C5h9h3NY.js} +0 -0
- /package/dist/core/{Shatter-EEzkIXGb.js → Shatter-BDTHZrbz.js} +0 -0
- /package/dist/core/{SimplexNoise-DKov4Yho.js → SimplexNoise-DU-QPbwp.js} +0 -0
- /package/dist/core/{SineWave-Cy0wWKUU.js → SineWave-CsoVJf9C.js} +0 -0
- /package/dist/core/{SolidColor-P4OKglCC.js → SolidColor-BOK2t0JT.js} +0 -0
- /package/dist/core/{Spherize-BLEvqakM.js → Spherize-BxUTtFAg.js} +0 -0
- /package/dist/core/{Spiral-DXuKs26n.js → Spiral-DVURsiiQ.js} +0 -0
- /package/dist/core/{Strands-DsdASoV4.js → Strands-C2l4JaUt.js} +0 -0
- /package/dist/core/{Stretch-By8f2wmJ.js → Stretch-uSJDtqi2.js} +0 -0
- /package/dist/core/{Stripes-D8HSlP1H.js → Stripes-IFl3of9w.js} +0 -0
- /package/dist/core/{StudioBackground-CFjfBnWp.js → StudioBackground-DbBGv5fk.js} +0 -0
- /package/dist/core/{Swirl-BIFGxHL0.js → Swirl-C16tmwEg.js} +0 -0
- /package/dist/core/{TiltShift-CLMFkzBs.js → TiltShift-C5t3YMVT.js} +0 -0
- /package/dist/core/{Tint-NQjiXLGu.js → Tint-VTnDmiKF.js} +0 -0
- /package/dist/core/{Tritone-67eoddBF.js → Tritone-v6z_O967.js} +0 -0
- /package/dist/core/{Twirl-ZaYAMqmq.js → Twirl-BWpsT8iI.js} +0 -0
- /package/dist/core/{Vibrance-DbSUuK_4.js → Vibrance-C_DSuzwf.js} +0 -0
- /package/dist/core/{VideoTexture-lHzoN3G9.js → VideoTexture-OrpXuUNQ.js} +0 -0
- /package/dist/core/{WaveDistortion-CB6xTndT.js → WaveDistortion-BAxVvc8B.js} +0 -0
- /package/dist/core/{WebcamTexture-BJUvpMmV.js → WebcamTexture-D2CHXtkO.js} +0 -0
- /package/dist/core/{ZoomBlur-BCClC8fw.js → ZoomBlur-D--sEenn.js} +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { i as transformColorSpace, r as transformColor, s as transformPosition, t as colorSpaceOptions } from "./transformations-CC_c-QAT.js";
|
|
2
|
+
import { t as createAnimatedTime } from "./time-BZqyVJXt.js";
|
|
3
|
+
import { t as mixColors } from "./colorMixing-Ehw-Hfs_.js";
|
|
4
|
+
import { Fn, clamp, exp, float, fract, mix, mx_noise_float, pow, screenUV, sin, smoothstep, step, vec2, vec3, vec4, viewportSize } from "three/tsl";
|
|
5
|
+
const componentDefinition = {
|
|
6
|
+
name: "Aurora",
|
|
7
|
+
category: "Textures",
|
|
8
|
+
description: "Mesmerizing aurora borealis with layered curtains, vertical rays, and flowing light.",
|
|
9
|
+
props: {
|
|
10
|
+
colorA: {
|
|
11
|
+
default: "#a533f8",
|
|
12
|
+
transform: transformColor,
|
|
13
|
+
description: "Edge color at the curtain base",
|
|
14
|
+
ui: {
|
|
15
|
+
type: "color",
|
|
16
|
+
label: "Color A",
|
|
17
|
+
group: "Colors"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
colorB: {
|
|
21
|
+
default: "#22ee88",
|
|
22
|
+
transform: transformColor,
|
|
23
|
+
description: "Core color in the bright center",
|
|
24
|
+
ui: {
|
|
25
|
+
type: "color",
|
|
26
|
+
label: "Color B",
|
|
27
|
+
group: "Colors"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
colorC: {
|
|
31
|
+
default: "#1694e8",
|
|
32
|
+
transform: transformColor,
|
|
33
|
+
description: "Tip color at the ray ends",
|
|
34
|
+
ui: {
|
|
35
|
+
type: "color",
|
|
36
|
+
label: "Color C",
|
|
37
|
+
group: "Colors"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
colorSpace: {
|
|
41
|
+
default: "linear",
|
|
42
|
+
transform: transformColorSpace,
|
|
43
|
+
description: "Color space for color interpolation",
|
|
44
|
+
ui: {
|
|
45
|
+
type: "select",
|
|
46
|
+
options: colorSpaceOptions,
|
|
47
|
+
label: "Color Space",
|
|
48
|
+
group: "Colors"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
balance: {
|
|
52
|
+
default: 50,
|
|
53
|
+
description: "Shifts color distribution across the curtain height",
|
|
54
|
+
ui: {
|
|
55
|
+
type: "range",
|
|
56
|
+
min: 0,
|
|
57
|
+
max: 100,
|
|
58
|
+
step: 1,
|
|
59
|
+
label: "Balance",
|
|
60
|
+
group: "Colors"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
intensity: {
|
|
64
|
+
default: 80,
|
|
65
|
+
description: "Overall aurora brightness",
|
|
66
|
+
ui: {
|
|
67
|
+
type: "range",
|
|
68
|
+
min: 0,
|
|
69
|
+
max: 100,
|
|
70
|
+
step: 1,
|
|
71
|
+
label: "Intensity",
|
|
72
|
+
group: "Aurora"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
curtainCount: {
|
|
76
|
+
default: 4,
|
|
77
|
+
description: "Number of aurora curtain layers",
|
|
78
|
+
ui: {
|
|
79
|
+
type: "range",
|
|
80
|
+
min: 1,
|
|
81
|
+
max: 4,
|
|
82
|
+
step: 1,
|
|
83
|
+
label: "Curtains",
|
|
84
|
+
group: "Aurora"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
speed: {
|
|
88
|
+
default: 5,
|
|
89
|
+
description: "Animation speed",
|
|
90
|
+
ui: {
|
|
91
|
+
type: "range",
|
|
92
|
+
min: -10,
|
|
93
|
+
max: 10,
|
|
94
|
+
step: .1,
|
|
95
|
+
label: "Speed",
|
|
96
|
+
group: "Aurora"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
waviness: {
|
|
100
|
+
default: 50,
|
|
101
|
+
description: "How much the curtains undulate",
|
|
102
|
+
ui: {
|
|
103
|
+
type: "range",
|
|
104
|
+
min: 0,
|
|
105
|
+
max: 200,
|
|
106
|
+
step: 1,
|
|
107
|
+
label: "Waviness",
|
|
108
|
+
group: "Aurora"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
rayDensity: {
|
|
112
|
+
default: 20,
|
|
113
|
+
description: "Density of vertical ray structures",
|
|
114
|
+
ui: {
|
|
115
|
+
type: "range",
|
|
116
|
+
min: 0,
|
|
117
|
+
max: 100,
|
|
118
|
+
step: 1,
|
|
119
|
+
label: "Ray Detail",
|
|
120
|
+
group: "Aurora"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
height: {
|
|
124
|
+
default: 120,
|
|
125
|
+
description: "How tall the aurora extends",
|
|
126
|
+
ui: {
|
|
127
|
+
type: "range",
|
|
128
|
+
min: 10,
|
|
129
|
+
max: 200,
|
|
130
|
+
step: 1,
|
|
131
|
+
label: "Height",
|
|
132
|
+
group: "Scene"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
center: {
|
|
136
|
+
default: {
|
|
137
|
+
x: .5,
|
|
138
|
+
y: .5
|
|
139
|
+
},
|
|
140
|
+
transform: transformPosition,
|
|
141
|
+
description: "Center position of the aurora",
|
|
142
|
+
ui: {
|
|
143
|
+
type: "position",
|
|
144
|
+
label: "Center",
|
|
145
|
+
group: "Scene"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
seed: {
|
|
149
|
+
default: 0,
|
|
150
|
+
description: "Random seed for variation",
|
|
151
|
+
ui: {
|
|
152
|
+
type: "range",
|
|
153
|
+
min: 0,
|
|
154
|
+
max: 100,
|
|
155
|
+
step: 1,
|
|
156
|
+
label: "Seed",
|
|
157
|
+
group: "Aurora"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
fragmentNode: (params) => {
|
|
162
|
+
const { uniforms } = params;
|
|
163
|
+
const colorA = uniforms.colorA.uniform;
|
|
164
|
+
const colorB = uniforms.colorB.uniform;
|
|
165
|
+
const colorC = uniforms.colorC.uniform;
|
|
166
|
+
const csMode = uniforms.colorSpace.uniform;
|
|
167
|
+
const balanceExp = mix(float(2.5), float(.4), uniforms.balance.uniform.mul(.01));
|
|
168
|
+
const intensity = uniforms.intensity.uniform.mul(.018);
|
|
169
|
+
const curtainCount = uniforms.curtainCount.uniform;
|
|
170
|
+
const waviness = uniforms.waviness.uniform.mul(.01);
|
|
171
|
+
const rayAmount = uniforms.rayDensity.uniform.mul(.01);
|
|
172
|
+
const auroraHeight = uniforms.height.uniform.mul(.01);
|
|
173
|
+
const centerX = uniforms.center.uniform.x;
|
|
174
|
+
const centerY = uniforms.center.uniform.y.oneMinus();
|
|
175
|
+
const seed = uniforms.seed.uniform;
|
|
176
|
+
const aspect = viewportSize.x.div(viewportSize.y);
|
|
177
|
+
const t = createAnimatedTime(params, uniforms.speed);
|
|
178
|
+
const auroraCurtain = Fn(([uv$1, layerIdx, layerTime]) => {
|
|
179
|
+
const tSlow = t.mul(.06).add(layerTime);
|
|
180
|
+
const lSeed = seed.add(layerIdx.mul(31.7));
|
|
181
|
+
const wx = uv$1.x.sub(centerX).mul(aspect).mul(2);
|
|
182
|
+
const ph1 = fract(sin(lSeed.mul(12.9)).mul(4758.5)).mul(Math.PI * 2);
|
|
183
|
+
const ph2 = fract(sin(lSeed.mul(78.2)).mul(2847.1)).mul(Math.PI * 2);
|
|
184
|
+
const ph3 = fract(sin(lSeed.mul(41.6)).mul(1593.7)).mul(Math.PI * 2);
|
|
185
|
+
const arc = sin(wx.mul(.7).add(tSlow.mul(.4)).add(ph1)).mul(.15).add(sin(wx.mul(1.6).add(tSlow.mul(.65)).add(ph2)).mul(.08)).add(sin(wx.mul(2.9).add(tSlow.mul(.3)).add(ph3)).mul(.04));
|
|
186
|
+
const noiseWarp = mx_noise_float(vec3(wx.mul(.5), tSlow.mul(.25), lSeed.mul(.1)));
|
|
187
|
+
const pathY = centerY.add(arc.mul(waviness)).add(noiseWarp.mul(.14).mul(waviness));
|
|
188
|
+
const warpedX = wx.add(noiseWarp.mul(2.5));
|
|
189
|
+
const rayFreq = mix(float(6), float(20), rayAmount);
|
|
190
|
+
const rayPhase = fract(sin(lSeed.mul(53.7)).mul(3847.2)).mul(Math.PI * 2);
|
|
191
|
+
const rays = pow(sin(warpedX.mul(rayFreq.mul(.15)).add(tSlow.mul(.1)).add(rayPhase)).mul(.5).add(.5), float(1.5));
|
|
192
|
+
const localHeight = auroraHeight.mul(mix(float(.4), float(1), rays));
|
|
193
|
+
const distFromPath = uv$1.y.sub(pathY);
|
|
194
|
+
const bottomFade = smoothstep(float(-.04), float(.015), distFromPath);
|
|
195
|
+
const topExtent = localHeight.mul(rays.mul(.4).add(.6));
|
|
196
|
+
const topFade = smoothstep(topExtent, float(0), distFromPath);
|
|
197
|
+
const envelope = bottomFade.mul(topFade);
|
|
198
|
+
const sectionBright = mix(float(.4), float(1), noiseWarp.mul(.5).add(.5));
|
|
199
|
+
const colorT = clamp(distFromPath.div(topExtent.add(.001)), 0, 1);
|
|
200
|
+
const coreD = colorT.sub(.2);
|
|
201
|
+
const coreBright = exp(coreD.mul(coreD).mul(-6)).mul(.3).add(1);
|
|
202
|
+
return vec2(colorT, envelope.mul(rays).mul(sectionBright).mul(coreBright));
|
|
203
|
+
});
|
|
204
|
+
return Fn(() => {
|
|
205
|
+
const uv$1 = screenUV;
|
|
206
|
+
const weightedT = float(0).toVar();
|
|
207
|
+
const totalAlpha = float(0).toVar();
|
|
208
|
+
const a1 = auroraCurtain(uv$1, float(0), float(0));
|
|
209
|
+
weightedT.assign(weightedT.add(a1.x.mul(a1.y)));
|
|
210
|
+
totalAlpha.assign(totalAlpha.add(a1.y));
|
|
211
|
+
const a2 = auroraCurtain(uv$1, float(1), float(3.1));
|
|
212
|
+
const w2 = a2.y.mul(step(float(2), curtainCount)).mul(.65);
|
|
213
|
+
weightedT.assign(weightedT.add(a2.x.mul(w2)));
|
|
214
|
+
totalAlpha.assign(totalAlpha.add(w2));
|
|
215
|
+
const a3 = auroraCurtain(uv$1, float(2), float(6.7));
|
|
216
|
+
const w3 = a3.y.mul(step(float(3), curtainCount)).mul(.45);
|
|
217
|
+
weightedT.assign(weightedT.add(a3.x.mul(w3)));
|
|
218
|
+
totalAlpha.assign(totalAlpha.add(w3));
|
|
219
|
+
const a4 = auroraCurtain(uv$1, float(3), float(9.4));
|
|
220
|
+
const w4 = a4.y.mul(step(float(4), curtainCount)).mul(.3);
|
|
221
|
+
weightedT.assign(weightedT.add(a4.x.mul(w4)));
|
|
222
|
+
totalAlpha.assign(totalAlpha.add(w4));
|
|
223
|
+
const avgT = pow(weightedT.div(totalAlpha.add(.001)), balanceExp);
|
|
224
|
+
const lowToMid = smoothstep(float(0), float(.2), avgT);
|
|
225
|
+
const midToHigh = smoothstep(float(.4), float(.85), avgT);
|
|
226
|
+
const col = mixColors(mixColors(colorA, colorB, lowToMid, csMode), colorC, midToHigh, csMode).rgb.mul(totalAlpha).mul(intensity);
|
|
227
|
+
const alpha = clamp(totalAlpha.mul(intensity).mul(.5), 0, 1);
|
|
228
|
+
return vec4(clamp(col, 0, 1), alpha);
|
|
229
|
+
})();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var Aurora_default = componentDefinition;
|
|
233
|
+
export { componentDefinition as n, Aurora_default as t };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { t as applyEdgeHandling } from "./edges-Bd7GP4s2.js";
|
|
2
|
+
import { o as transformEdges } from "./transformations-CC_c-QAT.js";
|
|
3
|
+
import { DataTexture, FloatType, LinearFilter, RGFormat } from "three";
|
|
4
|
+
import { convertToTexture, float, screenUV, texture, vec2, vec4 } from "three/tsl";
|
|
5
|
+
var GRID_SIZE = 128;
|
|
6
|
+
const componentDefinition = {
|
|
7
|
+
name: "CursorRipples",
|
|
8
|
+
category: "Interactive",
|
|
9
|
+
description: "Fluid-like ripple distortion",
|
|
10
|
+
requiresRTT: true,
|
|
11
|
+
requiresChild: true,
|
|
12
|
+
props: {
|
|
13
|
+
intensity: {
|
|
14
|
+
default: 10,
|
|
15
|
+
description: "Strength of the ripple distortion",
|
|
16
|
+
ui: {
|
|
17
|
+
type: "range",
|
|
18
|
+
min: 0,
|
|
19
|
+
max: 20,
|
|
20
|
+
step: .1,
|
|
21
|
+
label: "Intensity",
|
|
22
|
+
group: "Effect"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
decay: {
|
|
26
|
+
default: 10,
|
|
27
|
+
description: "How quickly ripples fade (higher = faster)",
|
|
28
|
+
ui: {
|
|
29
|
+
type: "range",
|
|
30
|
+
min: 0,
|
|
31
|
+
max: 20,
|
|
32
|
+
step: .1,
|
|
33
|
+
label: "Decay",
|
|
34
|
+
group: "Effect"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
radius: {
|
|
38
|
+
default: .5,
|
|
39
|
+
description: "Radius of cursor influence",
|
|
40
|
+
ui: {
|
|
41
|
+
type: "range",
|
|
42
|
+
min: .1,
|
|
43
|
+
max: 1,
|
|
44
|
+
step: .1,
|
|
45
|
+
label: "Radius",
|
|
46
|
+
group: "Effect"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
chromaticSplit: {
|
|
50
|
+
default: 1,
|
|
51
|
+
description: "RGB channel separation along ripple edges",
|
|
52
|
+
ui: {
|
|
53
|
+
type: "range",
|
|
54
|
+
min: 0,
|
|
55
|
+
max: 3,
|
|
56
|
+
step: .1,
|
|
57
|
+
label: "Chromatic Split",
|
|
58
|
+
group: "Effect"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
edges: {
|
|
62
|
+
default: "stretch",
|
|
63
|
+
description: "How to handle edges when distortion pushes content out of bounds",
|
|
64
|
+
transform: transformEdges,
|
|
65
|
+
ui: {
|
|
66
|
+
type: "select",
|
|
67
|
+
options: [
|
|
68
|
+
{
|
|
69
|
+
label: "Stretch",
|
|
70
|
+
value: "stretch"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Transparent",
|
|
74
|
+
value: "transparent"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "Mirror",
|
|
78
|
+
value: "mirror"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "Wrap",
|
|
82
|
+
value: "wrap"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
label: "Edges",
|
|
86
|
+
group: "Effect"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
fragmentNode: ({ uniforms, onBeforeRender, childNode, onCleanup, dimensions }) => {
|
|
91
|
+
const buffers = [new Float32Array(GRID_SIZE * GRID_SIZE), new Float32Array(GRID_SIZE * GRID_SIZE)];
|
|
92
|
+
let currentBuffer = 0;
|
|
93
|
+
const displacementData = new Float32Array(GRID_SIZE * GRID_SIZE * 2);
|
|
94
|
+
const displacementTexture = new DataTexture(displacementData, GRID_SIZE, GRID_SIZE, RGFormat, FloatType);
|
|
95
|
+
displacementTexture.magFilter = LinearFilter;
|
|
96
|
+
displacementTexture.minFilter = LinearFilter;
|
|
97
|
+
displacementTexture.needsUpdate = true;
|
|
98
|
+
const displacementField = texture(displacementTexture);
|
|
99
|
+
let prevX = .5;
|
|
100
|
+
let prevY = .5;
|
|
101
|
+
let lastTime = Date.now();
|
|
102
|
+
onBeforeRender(({ pointer }) => {
|
|
103
|
+
const currentTime = Date.now();
|
|
104
|
+
const dt = Math.min((currentTime - lastTime) / 1e3, .016);
|
|
105
|
+
lastTime = currentTime;
|
|
106
|
+
const aspect = dimensions.width / dimensions.height;
|
|
107
|
+
const substeps = 1;
|
|
108
|
+
const decay = uniforms.decay.uniform.value;
|
|
109
|
+
const radius = uniforms.radius.uniform.value * .05;
|
|
110
|
+
const rawVelX = dt > 0 ? (pointer.x - prevX) / dt : 0;
|
|
111
|
+
const rawVelY = dt > 0 ? (pointer.y - prevY) / dt : 0;
|
|
112
|
+
const mouseSpeed = Math.min(Math.sqrt(rawVelX * rawVelX + rawVelY * rawVelY), 2);
|
|
113
|
+
const dampFactor = 1 - decay * .004;
|
|
114
|
+
for (let s = 0; s < substeps; s++) {
|
|
115
|
+
const curr$1 = buffers[currentBuffer];
|
|
116
|
+
const prev = buffers[1 - currentBuffer];
|
|
117
|
+
if (s === 0 && mouseSpeed > .01) {
|
|
118
|
+
const influenceRadius = radius * 3;
|
|
119
|
+
const minJ = Math.max(1, Math.floor((pointer.x - influenceRadius) * GRID_SIZE));
|
|
120
|
+
const maxJ = Math.min(GRID_SIZE - 2, Math.ceil((pointer.x + influenceRadius) * GRID_SIZE));
|
|
121
|
+
const minI = Math.max(1, Math.floor((pointer.y - influenceRadius) * GRID_SIZE));
|
|
122
|
+
const maxI = Math.min(GRID_SIZE - 2, Math.ceil((pointer.y + influenceRadius) * GRID_SIZE));
|
|
123
|
+
for (let i = minI; i <= maxI; i++) for (let j = minJ; j <= maxJ; j++) {
|
|
124
|
+
const idx = i * GRID_SIZE + j;
|
|
125
|
+
const cellX = (j + .5) / GRID_SIZE;
|
|
126
|
+
const cellY = (i + .5) / GRID_SIZE;
|
|
127
|
+
const ddx = aspect >= 1 ? (cellX - pointer.x) * aspect : cellX - pointer.x;
|
|
128
|
+
const ddy = aspect >= 1 ? cellY - pointer.y : (cellY - pointer.y) / aspect;
|
|
129
|
+
const dist = Math.sqrt(ddx * ddx + ddy * ddy);
|
|
130
|
+
if (dist < influenceRadius) {
|
|
131
|
+
const influence = Math.exp(-dist * dist / (radius * radius));
|
|
132
|
+
curr$1[idx] -= influence * mouseSpeed * dt * 3;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
for (let i = 1; i < GRID_SIZE - 1; i++) for (let j = 1; j < GRID_SIZE - 1; j++) {
|
|
137
|
+
const idx = i * GRID_SIZE + j;
|
|
138
|
+
prev[idx] = ((curr$1[idx - 1] + curr$1[idx + 1] + curr$1[idx - GRID_SIZE] + curr$1[idx + GRID_SIZE]) * .5 - prev[idx]) * dampFactor;
|
|
139
|
+
}
|
|
140
|
+
currentBuffer = 1 - currentBuffer;
|
|
141
|
+
}
|
|
142
|
+
const curr = buffers[currentBuffer];
|
|
143
|
+
for (let i = 1; i < GRID_SIZE - 1; i++) for (let j = 1; j < GRID_SIZE - 1; j++) {
|
|
144
|
+
const idx = i * GRID_SIZE + j;
|
|
145
|
+
const dIdx = idx * 2;
|
|
146
|
+
displacementData[dIdx] = (curr[idx + 1] - curr[idx - 1]) * .5;
|
|
147
|
+
displacementData[dIdx + 1] = (curr[idx + GRID_SIZE] - curr[idx - GRID_SIZE]) * .5;
|
|
148
|
+
}
|
|
149
|
+
displacementTexture.needsUpdate = true;
|
|
150
|
+
prevX = pointer.x;
|
|
151
|
+
prevY = pointer.y;
|
|
152
|
+
});
|
|
153
|
+
onCleanup(() => {
|
|
154
|
+
displacementTexture.dispose();
|
|
155
|
+
});
|
|
156
|
+
if (!childNode) return vec4(0, 0, 0, 0);
|
|
157
|
+
const childTexture = convertToTexture(childNode);
|
|
158
|
+
onCleanup(() => {
|
|
159
|
+
if (childTexture?.renderTarget?.dispose) childTexture.renderTarget.dispose();
|
|
160
|
+
});
|
|
161
|
+
const displacement = displacementField.sample(screenUV).xy;
|
|
162
|
+
const intensityScale = uniforms.intensity.uniform.mul(.1);
|
|
163
|
+
const scaledDisplacement = displacement.mul(intensityScale);
|
|
164
|
+
const maxDisp = float(.15);
|
|
165
|
+
const clampedDisplacement = scaledDisplacement.clamp(vec2(maxDisp.negate(), maxDisp.negate()), vec2(maxDisp, maxDisp));
|
|
166
|
+
const chromaticScale = uniforms.chromaticSplit.uniform.mul(.1);
|
|
167
|
+
const rUV = screenUV.sub(clampedDisplacement.mul(float(1).add(chromaticScale)));
|
|
168
|
+
const gUV = screenUV.sub(clampedDisplacement);
|
|
169
|
+
const bUV = screenUV.sub(clampedDisplacement.mul(float(1).sub(chromaticScale)));
|
|
170
|
+
const rSample = applyEdgeHandling(rUV, childTexture.sample(rUV), childTexture, uniforms.edges.uniform);
|
|
171
|
+
const gSample = applyEdgeHandling(gUV, childTexture.sample(gUV), childTexture, uniforms.edges.uniform);
|
|
172
|
+
const bSample = applyEdgeHandling(bUV, childTexture.sample(bUV), childTexture, uniforms.edges.uniform);
|
|
173
|
+
return vec4(rSample.r, gSample.g, bSample.b, gSample.a);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
var CursorRipples_default = componentDefinition;
|
|
177
|
+
export { componentDefinition as n, CursorRipples_default as t };
|