@mkbabb/glass-ui 3.6.0 → 3.7.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/dist/CardAction-D8nSE62a.js +163 -0
- package/dist/CollapsibleContent-D7UNsXQr.js +63 -0
- package/dist/{CommandShortcut-BiVyqipe.js → CommandShortcut-CY0aQTz5.js} +4 -4
- package/dist/{ContextMenuContent-De01_83g.js → ContextMenuContent-DGKZX1Du.js} +1 -1
- package/dist/{ContextMenuSubContent-DrWkXKQP.js → ContextMenuSubContent-BeDz7G6f.js} +4 -4
- package/dist/{DataTable-BGVXx0Ww.js → DataTable-gtPOLZvl.js} +14 -7
- package/dist/{DialogContent-IQ8_BRrC.js → DialogContent-DG1YMR-P.js} +24 -24
- package/dist/{DialogFooter-Er0wA3K6.js → DialogFooter-BCIaDP15.js} +2 -2
- package/dist/{DiscoGlyph-BaZ8OawK.js → DiscoGlyph-ZoBYpoxI.js} +1 -1
- package/dist/{GlyphFace-B_7vOmYn.js → GlyphFace-Ce_oe3tM.js} +1 -1
- package/dist/{HoverCardContent-ICfIMZX1.js → HoverCardContent-Bn0UBMY9.js} +1 -1
- package/dist/{HoverPopover-DTSYkJtw.js → HoverPopover-DXpOEw1P.js} +1 -1
- package/dist/{IconTooltip-DZlCkU-0.js → IconTooltip-Cu86JR4e.js} +1 -1
- package/dist/{Input-CRJ2owjN.js → Input-DWQQIOC4.js} +4 -1
- package/dist/{Label-CZk-3nTc.js → Label-DBc7bKzZ.js} +1 -1
- package/dist/{MetricBadge-BlrdbOGN.js → MetricBadge-D-bRaQUD.js} +1 -1
- package/dist/{Notification-DP_ApJLo.js → Notification-B5WHP3_1.js} +5 -4
- package/dist/{NumberFieldContent-Bhhmk95p.js → NumberFieldContent-CLNVR1iY.js} +5 -5
- package/dist/{PopoverContent-B8WtJECb.js → PopoverContent-F1bWnYoh.js} +2 -2
- package/dist/{Progress-DjM86vfb.js → Progress-c4vo4ALi.js} +6 -6
- package/dist/{ScrollingText-P9o_DuMn.js → ScrollingText-BEp377U5.js} +2 -2
- package/dist/{SelectScrollDownButton-BGn3rjs9.js → SelectScrollDownButton-DAo5NmY_.js} +8 -7
- package/dist/{Separator-C2XtAXRp.js → Separator-DZyqsCum.js} +1 -1
- package/dist/{Switch-x8n6husW.js → Switch-2rsAtDfA.js} +8 -2
- package/dist/TabsList-COqIdW7i.js +101 -0
- package/dist/{Toaster-DdhMKfus.js → Toaster-BMaeziJJ.js} +54 -60
- package/dist/{ToggleGroupItem-gyXj998A.js → ToggleGroupItem-C-AIkBUw.js} +13 -5
- package/dist/{TooltipProvider-D-JrSqDu.js → TooltipProvider-CD2IXfRv.js} +1 -1
- package/dist/{UnderlineTabs-CuIK16JI.js → UnderlineTabs-D_c1iYo-.js} +1 -1
- package/dist/animated-digit.js +2 -2
- package/dist/api/index.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/aurora.js +690 -227
- package/dist/{badge-Cl6JZ1B7.js → badge-DHQrc_GQ.js} +13 -9
- package/dist/badge.js +1 -1
- package/dist/{button-BcMzVrqs.js → button-CAywcrhO.js} +6 -3
- package/dist/button.js +1 -1
- package/dist/card.js +2 -2
- package/dist/carousel.js +5 -5
- package/dist/{check-CdkxGxXJ.js → check-BBKKKSTf.js} +1 -1
- package/dist/{chevron-down-pBY8sYfV.js → chevron-down-BSkTP2aL.js} +1 -1
- package/dist/{chevron-right-BjeKC22V.js → chevron-right-sDM0Yvrf.js} +1 -1
- package/dist/{chevron-up-DBeNHUm1.js → chevron-up-CCOD_FTz.js} +1 -1
- package/dist/collapsible.js +1 -1
- package/dist/color-DjJCAQ6f.js +76 -0
- package/dist/color.js +2 -2
- package/dist/command.js +1 -1
- package/dist/compile-iM4IUB66.js +158 -0
- package/dist/components/custom/aurora/Aurora.vue.d.ts +1 -0
- package/dist/components/custom/aurora/composables/atoms.d.ts +60 -0
- package/dist/components/custom/aurora/composables/color.d.ts +7 -13
- package/dist/components/custom/aurora/composables/cursorModel.d.ts +35 -2
- package/dist/components/custom/aurora/composables/glSetup.d.ts +1 -1
- package/dist/components/custom/aurora/composables/gpuRuntime.d.ts +16 -0
- package/dist/components/custom/aurora/composables/runtime.d.ts +18 -0
- package/dist/components/custom/aurora/composables/uniformBridge.d.ts +23 -0
- package/dist/components/custom/aurora/composables/useAurora.d.ts +6 -0
- package/dist/components/custom/aurora/composables/useCursorInteraction.d.ts +8 -0
- package/dist/components/custom/aurora/constants/presets.d.ts +55 -2
- package/dist/components/custom/aurora/constants/renderMode.d.ts +10 -0
- package/dist/components/custom/aurora/constants/shaders/aurora.wgsl.d.ts +7 -0
- package/dist/components/custom/aurora/constants/shaders/brush.glsl.d.ts +1 -1
- package/dist/components/custom/aurora/constants/shaders/flow.glsl.d.ts +1 -1
- package/dist/components/custom/aurora/constants/shaders/mediums.glsl.d.ts +2 -2
- package/dist/components/custom/aurora/constants/shaders/painterly.wgsl.d.ts +7 -0
- package/dist/components/custom/aurora/constants/shaders/wake.wgsl.d.ts +4 -0
- package/dist/components/custom/aurora/index.d.ts +2 -1
- package/dist/components/custom/fourier-field/FourierField.vue.d.ts +38 -0
- package/dist/components/custom/fourier-field/index.d.ts +2 -0
- package/dist/components/custom/fourier-field/math.d.ts +57 -0
- package/dist/components/custom/goo-blob/GooBlob.vue.d.ts +2 -0
- package/dist/components/custom/goo-blob/composables/useBlobMood.d.ts +14 -2
- package/dist/components/custom/goo-blob/composables/useBlobPointer.d.ts +45 -4
- package/dist/components/custom/goo-blob/composables/useMetaballRenderer.d.ts +1 -1
- package/dist/components/custom/goo-blob/index.d.ts +1 -1
- package/dist/components/custom/goo-blob/shaders/sdf-body.glsl.d.ts +1 -1
- package/dist/components/custom/goo-blob/shaders/watercolor-edges.glsl.d.ts +2 -2
- package/dist/components/custom/goo-blob/types.d.ts +40 -0
- package/dist/components/custom/metric-cell/MetricCell.vue.d.ts +1 -1
- package/dist/components/custom/metric-stack/MetricStack.vue.d.ts +1 -1
- package/dist/components/ui/_shared/ModalOverlay.vue.d.ts +1 -1
- package/dist/components/ui/alert/index.d.ts +1 -1
- package/dist/components/ui/card/Card.vue.d.ts +10 -3
- package/dist/components/ui/card/CardAction.vue.d.ts +24 -0
- package/dist/components/ui/card/index.d.ts +1 -0
- package/dist/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +5 -1
- package/dist/components/ui/tabs/TabsList.vue.d.ts +13 -3
- package/dist/components/ui/toast/Toast.vue.d.ts +5 -5
- package/dist/components/ui/toast/use-toast.d.ts +1 -1
- package/dist/composables/color/index.d.ts +50 -0
- package/dist/composables/glass/createGPUCanvas.d.ts +40 -0
- package/dist/composables/glass/webgl/createCanvasLifecycle.d.ts +45 -0
- package/dist/composables/glass/webgl/shaders/procedural-color.glsl.d.ts +3 -0
- package/dist/composables/glass/webgl/useWebGLCanvas.d.ts +4 -4
- package/dist/configurator.js +1 -1
- package/dist/confirm-dialog.js +3 -3
- package/dist/constellation.js +3 -3
- package/dist/context-menu.js +2 -2
- package/dist/controls.js +2 -2
- package/dist/dark.js +1 -1
- package/dist/data-table.js +1 -1
- package/dist/dialog.js +2 -2
- package/dist/disco-glyph.js +1 -1
- package/dist/dock.js +9 -9
- package/dist/{dockContext-spUj_-E5.js → dockContext-DLgrVWsU.js} +1 -1
- package/dist/dom.js +5 -5
- package/dist/{dropdown-menu-EFjl5iKo.js → dropdown-menu-BWpwutt0.js} +5 -5
- package/dist/dropdown-menu.js +1 -1
- package/dist/expandable-container.js +2 -2
- package/dist/forms.js +10 -7
- package/dist/fourier-field.d.ts +1 -0
- package/dist/fourier-field.js +166 -0
- package/dist/glass-carousel.js +1 -1
- package/dist/glass-panel.js +2 -2
- package/dist/glass-ui.css +1 -1
- package/dist/glass-ui.js +207 -192
- package/dist/glyph-face.js +2 -2
- package/dist/goo-blob.js +336 -234
- package/dist/header-ribbon.js +1 -1
- package/dist/hover-card.js +1 -1
- package/dist/hover-popover.js +1 -1
- package/dist/icon-tooltip.js +1 -1
- package/dist/instrument-chassis.js +1 -1
- package/dist/instrument-rail.js +1 -1
- package/dist/keyboard.js +1 -1
- package/dist/{keys-BFoma9vm.js → keys-Dyf_uTs5.js} +1 -1
- package/dist/label.js +1 -1
- package/dist/labeled-field.js +6 -6
- package/dist/metric-badge.js +1 -1
- package/dist/metric-stack.js +1 -1
- package/dist/{minimize-2-BP27-qBY.js → minimize-2-lcXOuc6V.js} +1 -1
- package/dist/motion-core.js +76 -106
- package/dist/motion.js +3 -3
- package/dist/notification.js +1 -1
- package/dist/number-field.js +1 -1
- package/dist/paper-backdrop.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress.js +1 -1
- package/dist/pulse.js +1 -1
- package/dist/reactive.js +2 -2
- package/dist/responsive-tabs.js +2 -2
- package/dist/scrolling-text.js +1 -1
- package/dist/{search-DBG8qaRs.js → search-nbkvr2dC.js} +1 -1
- package/dist/search.js +8 -8
- package/dist/select.js +3 -3
- package/dist/separator.js +1 -1
- package/dist/{sheet-CQYYrkr9.js → sheet-Cv1uO-Gq.js} +4 -4
- package/dist/sheet.js +1 -1
- package/dist/{slider-CgNzRSh6.js → slider-BA9wIs5e.js} +5 -4
- package/dist/slider.js +1 -1
- package/dist/sortable-list.js +3 -3
- package/dist/styles/components.css +1 -1
- package/dist/styles/theme.css +49 -0
- package/dist/styles/typography.css +3 -3
- package/dist/styles/utilities.css +17 -13
- package/dist/supportsCssTimeline-C5oe0lnD.js +12 -0
- package/dist/switch.js +1 -1
- package/dist/tabs.js +3 -3
- package/dist/timeline.js +2 -2
- package/dist/toast.js +1 -1
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/typewriter.js +1 -1
- package/dist/{useAnimatedNumber-DfVgP4te.js → useAnimatedNumber-C5I3wWd8.js} +1 -1
- package/dist/{useConfiguratorState-DUtC1jxr.js → useConfiguratorState-B24TcgIn.js} +5 -5
- package/dist/useScrollProgress-CAH8Ofwt.js +35 -0
- package/dist/{useTouchGate-CS5Csc2h.js → useTouchGate-YQRwyUGU.js} +1 -1
- package/dist/{vReveal-u2wSG2El.js → vReveal-BE2TsPoR.js} +6 -17
- package/dist/watercolor-dot.js +2 -2
- package/dist/{x-C4pz9nbD.js → x-Dfsegz9Y.js} +1 -1
- package/package.json +29 -1
- package/src/styles/theme.css +49 -0
- package/src/styles/typography.css +3 -3
- package/src/styles/utilities.css +17 -13
- package/dist/CardFooter-C390imy7.js +0 -129
- package/dist/CollapsibleContent-cauTbZEM.js +0 -52
- package/dist/TabsIndicator-DA0x9gPr.js +0 -97
- package/dist/color-DS-iLRVM.js +0 -33
- package/dist/compile-C62K_FpC.js +0 -106
- /package/dist/{InstrumentChassis-DaHIZCqy.js → InstrumentChassis-BLJBl1BW.js} +0 -0
- /package/dist/{InstrumentRail-B0qqLFN0.js → InstrumentRail-BElFwKyt.js} +0 -0
- /package/dist/{ModalOverlay-B_CBtqcE.js → ModalOverlay-D1VrWyoi.js} +0 -0
- /package/dist/{PaperBackdrop-D_YZW47j.js → PaperBackdrop-DCGoGatv.js} +0 -0
- /package/dist/{SelectGroup-CMdoCjRE.js → SelectGroup-BcaFjvP4.js} +0 -0
- /package/dist/{SelectSeparator-CaJnPF3_.js → SelectSeparator-COFMJGng.js} +0 -0
- /package/dist/{_plugin-vue_export-helper-C1je1s0u.js → _plugin-vue_export-helper-gLzyemvl.js} +0 -0
- /package/dist/{constants-C8NMonuo.js → constants-CS75AWHG.js} +0 -0
- /package/dist/{createContext-DBMGRlx4.js → createContext-CvNyBk4o.js} +0 -0
- /package/dist/{createLucideIcon-DuDoe_ra.js → createLucideIcon-B6uNAU9G.js} +0 -0
- /package/dist/{menuItemVariants-C2QlXqT3.js → menuItemVariants-B4eFR5Ix.js} +0 -0
- /package/dist/{presets-Dyv9Zl7W.js → presets-BKVyQfbt.js} +0 -0
- /package/dist/{prng-CjVgzjQT.js → prng-wHuHlNHE.js} +0 -0
- /package/dist/{useCanvas2D-BeNJqqIS.js → useCanvas2D-C31yfUGY.js} +0 -0
- /package/dist/{useGlassRenderer-Dn3WpfG-.js → useGlassRenderer-HebgSEgN.js} +0 -0
- /package/dist/{useGlobalDark-D7R9OypB.js → useGlobalDark-yhL4Wp-s.js} +0 -0
- /package/dist/{useIntersectionPause-DsQYGc8V.js → useIntersectionPause-Cc-H9ees.js} +0 -0
- /package/dist/{useInterval-CHVYFpXV.js → useInterval-D3USn0yc.js} +0 -0
- /package/dist/{useKeyboardShortcuts-i8tHd5WO.js → useKeyboardShortcuts-Be3w_Rwk.js} +0 -0
- /package/dist/{useResizeObserver-DX-STszm.js → useResizeObserver-CSyxGxIX.js} +0 -0
- /package/dist/{useSortable-muI29agz.js → useSortable-C8ReQ50P.js} +0 -0
- /package/dist/{useSpringMount-CnizvZGm.js → useSpringMount-LRZqJTaF.js} +0 -0
- /package/dist/{useTextHighlight-Dmtofpk2.js → useTextHighlight-aMPdEpkq.js} +0 -0
- /package/dist/{useTimer-DGgoxTXL.js → useTimer-DEJonOZa.js} +0 -0
- /package/dist/{useUserInvalidAria-DmvZ_6Dx.js → useUserInvalidAria-CQKjEfwP.js} +0 -0
- /package/dist/{useViewTransition-DI0Rs2rV.js → useViewTransition-DaN5Zrox.js} +0 -0
- /package/dist/{useViewportReady-Dcvf0c4p.js → useViewportReady-K96m-Mdv.js} +0 -0
package/dist/goo-blob.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { t as e } from "./_plugin-vue_export-helper-
|
|
2
|
-
import {
|
|
3
|
-
import { t as c } from "./useIntersectionPause-
|
|
4
|
-
import { n as l, t as u } from "./prng-
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-gLzyemvl.js";
|
|
2
|
+
import { d as t, l as n, n as r, o as i, r as a, s as o, t as s } from "./compile-iM4IUB66.js";
|
|
3
|
+
import { t as c } from "./useIntersectionPause-Cc-H9ees.js";
|
|
4
|
+
import { n as l, t as u } from "./prng-wHuHlNHE.js";
|
|
5
5
|
import { computed as d, createElementBlock as f, createElementVNode as p, defineComponent as m, inject as h, normalizeStyle as g, onScopeDispose as _, onUnmounted as v, openBlock as y, readonly as b, ref as x, useTemplateRef as S, watch as C } from "vue";
|
|
6
|
+
import { SpringProgress as w } from "@mkbabb/keyframes.js";
|
|
6
7
|
//#region src/components/custom/goo-blob/types.ts
|
|
7
|
-
var
|
|
8
|
+
var T = {
|
|
8
9
|
canvasSize: 200,
|
|
9
10
|
bodyRadius: .25,
|
|
10
11
|
satelliteCount: 3,
|
|
11
12
|
satelliteRadius: .13,
|
|
12
13
|
orbitRadius: .35,
|
|
13
|
-
|
|
14
|
+
tempo: 1,
|
|
15
|
+
smoothK: .12,
|
|
16
|
+
merge: "quadratic",
|
|
14
17
|
noiseAmp: .025,
|
|
15
18
|
noiseFreq: 3.5,
|
|
16
19
|
noiseSpeed: .08,
|
|
20
|
+
warpAmp: 0,
|
|
17
21
|
pulseFreq: .3,
|
|
18
22
|
pulseAmp: .008,
|
|
19
23
|
hueRange: 5,
|
|
@@ -21,8 +25,28 @@ var w = {
|
|
|
21
25
|
brightnessShift: 0,
|
|
22
26
|
colorNoiseFreq: 2,
|
|
23
27
|
colorNoiseSpeed: .05,
|
|
24
|
-
|
|
28
|
+
paletteStops: [],
|
|
29
|
+
iridescence: 0,
|
|
30
|
+
iridHue: 85,
|
|
31
|
+
iridSpeed: .06,
|
|
32
|
+
sssScale: 0,
|
|
33
|
+
sssPower: 2,
|
|
34
|
+
coreGlow: 0,
|
|
35
|
+
lit: !1,
|
|
36
|
+
rimColor: "var(--foreground)",
|
|
37
|
+
lightDir: [
|
|
38
|
+
.4,
|
|
39
|
+
.7,
|
|
40
|
+
.6
|
|
41
|
+
],
|
|
42
|
+
specStrength: .9,
|
|
43
|
+
specShininess: 32,
|
|
44
|
+
rimPower: 2.5,
|
|
45
|
+
rimStrength: .5,
|
|
46
|
+
pointerAttraction: .35,
|
|
25
47
|
pointerStrength: .08,
|
|
48
|
+
stretch: .4,
|
|
49
|
+
clickImpulse: .5,
|
|
26
50
|
eccentricity: .25,
|
|
27
51
|
orbitSpeedScale: 1,
|
|
28
52
|
wobbleScale: 1,
|
|
@@ -31,94 +55,72 @@ var w = {
|
|
|
31
55
|
absorbedDuration: [2e3, 4e3],
|
|
32
56
|
emergeDuration: 2200,
|
|
33
57
|
orbitDuration: [8e3, 14e3]
|
|
34
|
-
},
|
|
58
|
+
}, E = Symbol("blobConfig");
|
|
35
59
|
//#endregion
|
|
36
60
|
//#region src/components/custom/goo-blob/composables/easing.ts
|
|
37
|
-
function
|
|
61
|
+
function D(e) {
|
|
38
62
|
return e < .5 ? 2 * e * e : 1 - 2 * (1 - e) * (1 - e);
|
|
39
63
|
}
|
|
40
|
-
function
|
|
64
|
+
function O(e) {
|
|
41
65
|
return e * e;
|
|
42
66
|
}
|
|
43
|
-
function
|
|
67
|
+
function k(e) {
|
|
44
68
|
return 1 - (1 - e) * (1 - e);
|
|
45
69
|
}
|
|
46
70
|
//#endregion
|
|
47
71
|
//#region src/components/custom/goo-blob/composables/useBlobMood.ts
|
|
48
|
-
var
|
|
72
|
+
var A = {
|
|
49
73
|
idle: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
pulseFreq: .3,
|
|
53
|
-
pulseAmp: .015,
|
|
54
|
-
noiseAmp: .025,
|
|
55
|
-
hueRange: 5,
|
|
56
|
-
satShift: 0,
|
|
57
|
-
brightnessShift: 0,
|
|
58
|
-
smoothK: .22,
|
|
59
|
-
pointerAttraction: 0,
|
|
60
|
-
mergeRate: 1
|
|
74
|
+
valence: 0,
|
|
75
|
+
arousal: .35
|
|
61
76
|
},
|
|
62
77
|
happy: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
pulseFreq: .8,
|
|
66
|
-
pulseAmp: .03,
|
|
67
|
-
noiseAmp: .035,
|
|
68
|
-
hueRange: 15,
|
|
69
|
-
satShift: .05,
|
|
70
|
-
brightnessShift: .05,
|
|
71
|
-
smoothK: .28,
|
|
72
|
-
pointerAttraction: .3,
|
|
73
|
-
mergeRate: .6
|
|
78
|
+
valence: .8,
|
|
79
|
+
arousal: .6
|
|
74
80
|
},
|
|
75
81
|
curious: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
pulseFreq: .5,
|
|
79
|
-
pulseAmp: .02,
|
|
80
|
-
noiseAmp: .03,
|
|
81
|
-
hueRange: 10,
|
|
82
|
-
satShift: .03,
|
|
83
|
-
brightnessShift: .02,
|
|
84
|
-
smoothK: .25,
|
|
85
|
-
pointerAttraction: .6,
|
|
86
|
-
mergeRate: 1.2
|
|
82
|
+
valence: .3,
|
|
83
|
+
arousal: .5
|
|
87
84
|
},
|
|
88
85
|
sleepy: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
pulseFreq: .15,
|
|
92
|
-
pulseAmp: .008,
|
|
93
|
-
noiseAmp: .015,
|
|
94
|
-
hueRange: 3,
|
|
95
|
-
satShift: -.05,
|
|
96
|
-
brightnessShift: -.03,
|
|
97
|
-
smoothK: .16,
|
|
98
|
-
pointerAttraction: -.2,
|
|
99
|
-
mergeRate: 2
|
|
86
|
+
valence: -.1,
|
|
87
|
+
arousal: .1
|
|
100
88
|
},
|
|
101
89
|
excited: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
pulseFreq: 1.5,
|
|
105
|
-
pulseAmp: .05,
|
|
106
|
-
noiseAmp: .045,
|
|
107
|
-
hueRange: 25,
|
|
108
|
-
satShift: .1,
|
|
109
|
-
brightnessShift: .08,
|
|
110
|
-
smoothK: .32,
|
|
111
|
-
pointerAttraction: .1,
|
|
112
|
-
mergeRate: .3
|
|
90
|
+
valence: .7,
|
|
91
|
+
arousal: 1
|
|
113
92
|
}
|
|
114
|
-
},
|
|
93
|
+
}, j = (e, t, n) => e + (t - e) * n;
|
|
94
|
+
function M({ valence: e, arousal: t }) {
|
|
95
|
+
return {
|
|
96
|
+
orbitSpeedScale: j(.4, 2.2, t),
|
|
97
|
+
wobbleScale: j(.5, 2, t),
|
|
98
|
+
pulseFreq: j(.15, 1.5, t),
|
|
99
|
+
pulseAmp: j(.008, .05, t),
|
|
100
|
+
noiseAmp: j(.015, .045, t),
|
|
101
|
+
hueRange: j(3, 25, t * .6 + (e * .5 + .5) * .4),
|
|
102
|
+
satShift: j(-.05, .1, e * .5 + .5),
|
|
103
|
+
brightnessShift: j(-.03, .08, e * .5 + .5),
|
|
104
|
+
smoothK: j(.16, .32, t),
|
|
105
|
+
pointerAttraction: j(-.2, .6, e * .5 + .5) * (.4 + .6 * t),
|
|
106
|
+
mergeRate: j(2, .3, t),
|
|
107
|
+
iridScale: j(.4, 1.8, t)
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
var N = {
|
|
111
|
+
idle: M(A.idle),
|
|
112
|
+
happy: M(A.happy),
|
|
113
|
+
curious: M(A.curious),
|
|
114
|
+
sleepy: M(A.sleepy),
|
|
115
|
+
excited: M(A.excited)
|
|
116
|
+
}, P = {
|
|
115
117
|
idle: 1500,
|
|
116
118
|
happy: 1200,
|
|
117
119
|
curious: 800,
|
|
118
120
|
sleepy: 2500,
|
|
119
121
|
excited: 600
|
|
120
122
|
};
|
|
121
|
-
function
|
|
123
|
+
function F(e, t, n) {
|
|
122
124
|
let r = (e, t) => e + (t - e) * n;
|
|
123
125
|
return {
|
|
124
126
|
orbitSpeedScale: r(e.orbitSpeedScale, t.orbitSpeedScale),
|
|
@@ -131,75 +133,146 @@ function A(e, t, n) {
|
|
|
131
133
|
brightnessShift: r(e.brightnessShift, t.brightnessShift),
|
|
132
134
|
smoothK: r(e.smoothK, t.smoothK),
|
|
133
135
|
pointerAttraction: r(e.pointerAttraction, t.pointerAttraction),
|
|
134
|
-
mergeRate: r(e.mergeRate, t.mergeRate)
|
|
136
|
+
mergeRate: r(e.mergeRate, t.mergeRate),
|
|
137
|
+
iridScale: r(e.iridScale, t.iridScale)
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
140
|
+
var I = 6e3;
|
|
141
|
+
function L() {
|
|
142
|
+
let e = x("idle"), t = x({ ...N.idle }), n = { ...N.idle }, r = { ...N.idle }, i = 0, a = 0, o = !1, s = 0;
|
|
143
|
+
function c(s) {
|
|
144
|
+
s === e.value && !o || (e.value = s, n = { ...t.value }, r = N[s], a = P[s], i = 0, o = !0);
|
|
145
|
+
}
|
|
146
|
+
function l(e) {
|
|
147
|
+
if (e.clicked) {
|
|
148
|
+
s = 900, c("excited");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
s > 0 || (e.pointerActive ? c("curious") : e.idleMs > I ? c("sleepy") : c("idle"));
|
|
141
152
|
}
|
|
142
|
-
function
|
|
143
|
-
if (!o) return;
|
|
153
|
+
function u(e) {
|
|
154
|
+
if (s > 0 && (s = Math.max(0, s - e)), !o) return;
|
|
144
155
|
i += e;
|
|
145
|
-
let
|
|
146
|
-
t.value =
|
|
156
|
+
let c = Math.min(i / a, 1), l = D(c);
|
|
157
|
+
t.value = F(n, r, l), c >= 1 && (o = !1);
|
|
147
158
|
}
|
|
148
159
|
return {
|
|
149
160
|
currentMood: b(e),
|
|
150
161
|
params: b(t),
|
|
151
|
-
setMood:
|
|
152
|
-
|
|
162
|
+
setMood: c,
|
|
163
|
+
update: l,
|
|
164
|
+
tick: u
|
|
153
165
|
};
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
//#region src/components/custom/goo-blob/composables/useBlobPointer.ts
|
|
157
|
-
var M = .12;
|
|
158
|
-
function N(e) {
|
|
167
|
+
function R(e) {
|
|
159
168
|
let t = x({
|
|
160
169
|
x: 0,
|
|
161
170
|
y: 0
|
|
162
|
-
}), n = x(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
171
|
+
}), n = x({
|
|
172
|
+
x: 0,
|
|
173
|
+
y: 0
|
|
174
|
+
}), r = x(!1), i = x(0), a = 0, o = 0, s = {
|
|
175
|
+
from: 0,
|
|
176
|
+
to: 0,
|
|
177
|
+
response: .18,
|
|
178
|
+
dampingFraction: 1
|
|
179
|
+
}, c = new w(s), l = new w(s), u = Array.from({ length: 15 }, () => ({
|
|
180
|
+
x: 0,
|
|
181
|
+
y: 0,
|
|
182
|
+
radius: 0
|
|
183
|
+
})), d = 0, f = 0, p = 0, m = 0;
|
|
184
|
+
function h(t) {
|
|
185
|
+
let n = e.value;
|
|
186
|
+
if (!n) return;
|
|
187
|
+
let i = n.getBoundingClientRect();
|
|
188
|
+
a = (t.clientX - i.left) / i.width * 2 - 1, o = (t.clientY - i.top) / i.height * 2 - 1, r.value = !0;
|
|
168
189
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
190
|
+
function g() {
|
|
191
|
+
r.value = !1;
|
|
171
192
|
}
|
|
172
|
-
let
|
|
193
|
+
let _ = null;
|
|
173
194
|
C(e, (e) => {
|
|
174
|
-
|
|
175
|
-
e.removeEventListener("pointermove",
|
|
195
|
+
_ &&= (_(), null), e && (e.addEventListener("pointermove", h), e.addEventListener("pointerleave", g), _ = () => {
|
|
196
|
+
e.removeEventListener("pointermove", h), e.removeEventListener("pointerleave", g);
|
|
176
197
|
});
|
|
177
|
-
}, { immediate: !0 }), v(() =>
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
198
|
+
}, { immediate: !0 }), v(() => _?.());
|
|
199
|
+
function y(e = 16) {
|
|
200
|
+
let s = Math.min(e, 50) / 1e3;
|
|
201
|
+
r.value ? O = 0 : O += Math.min(e, 50);
|
|
202
|
+
let h = r.value ? a : 0, g = r.value ? o : 0;
|
|
203
|
+
if (c.target = h, l.target = g, c.tick(s), l.tick(s), t.value = {
|
|
204
|
+
x: c.value,
|
|
205
|
+
y: l.value
|
|
206
|
+
}, n.value = {
|
|
207
|
+
x: c.velocity,
|
|
208
|
+
y: l.velocity
|
|
209
|
+
}, p !== 0 || m !== 0) {
|
|
210
|
+
let e = -324 * p - 2 * .35 * 18 * m;
|
|
211
|
+
m += e * s, p += m * s, p < -.9 && (p = -.9), Math.abs(p) < 1e-4 && Math.abs(m) < 1e-4 && (p = 0, m = 0);
|
|
212
|
+
}
|
|
213
|
+
i.value = p;
|
|
214
|
+
let _ = Math.hypot(c.velocity, l.velocity);
|
|
215
|
+
r.value || _ > .05 ? (d = (d + 1) % 15, u[d].x = c.value, u[d].y = l.value, f = Math.min(f + 1, 15)) : f > 0 && (f = Math.max(0, f - 1));
|
|
216
|
+
}
|
|
217
|
+
function S(e) {
|
|
218
|
+
let t = [];
|
|
219
|
+
for (let n = 0; n < f; n++) {
|
|
220
|
+
let r = u[(d - n + 30) % 15];
|
|
221
|
+
t.push({
|
|
222
|
+
x: r.x,
|
|
223
|
+
y: r.y,
|
|
224
|
+
radius: e * (1 - n / 15)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return {
|
|
228
|
+
sources: t,
|
|
229
|
+
count: f
|
|
182
230
|
};
|
|
183
231
|
}
|
|
232
|
+
let T = !1;
|
|
233
|
+
function E(e) {
|
|
234
|
+
m += e * 18, T = !0;
|
|
235
|
+
}
|
|
236
|
+
function D() {
|
|
237
|
+
let e = T;
|
|
238
|
+
return T = !1, e;
|
|
239
|
+
}
|
|
240
|
+
let O = 0;
|
|
241
|
+
function k() {
|
|
242
|
+
c.reset(0, 0), l.reset(0, 0), c.target = 0, l.target = 0, t.value = {
|
|
243
|
+
x: 0,
|
|
244
|
+
y: 0
|
|
245
|
+
}, n.value = {
|
|
246
|
+
x: 0,
|
|
247
|
+
y: 0
|
|
248
|
+
}, p = 0, m = 0, i.value = 0, f = 0;
|
|
249
|
+
}
|
|
184
250
|
return {
|
|
185
251
|
pointer: b(t),
|
|
186
|
-
|
|
187
|
-
|
|
252
|
+
velocity: b(n),
|
|
253
|
+
active: b(r),
|
|
254
|
+
pulse: b(i),
|
|
255
|
+
idleMs: () => O,
|
|
256
|
+
tick: y,
|
|
257
|
+
trailSources: S,
|
|
258
|
+
click: E,
|
|
259
|
+
consumeClick: D,
|
|
260
|
+
rest: k
|
|
188
261
|
};
|
|
189
262
|
}
|
|
190
263
|
//#endregion
|
|
191
264
|
//#region src/components/custom/goo-blob/composables/useBlobSatellites.ts
|
|
192
|
-
function
|
|
265
|
+
function z(e, t, n) {
|
|
193
266
|
return t + e() * (n - t);
|
|
194
267
|
}
|
|
195
|
-
function
|
|
268
|
+
function B(e) {
|
|
196
269
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
197
270
|
}
|
|
198
|
-
function
|
|
271
|
+
function V(e, t, n) {
|
|
199
272
|
return e + (t - e) * n;
|
|
200
273
|
}
|
|
201
|
-
function
|
|
202
|
-
let
|
|
274
|
+
function ee(e, t, n, r, i) {
|
|
275
|
+
let a = t / 4 * Math.PI * 2 + (e() - .5) * Math.PI, o = n * (.8 + e() * .4), s = r * (.3 + e() * .7);
|
|
203
276
|
return {
|
|
204
277
|
phase: "orbiting",
|
|
205
278
|
phaseStart: i,
|
|
@@ -225,23 +298,23 @@ function L(e, t, n, r) {
|
|
|
225
298
|
endY: 0
|
|
226
299
|
};
|
|
227
300
|
}
|
|
228
|
-
function
|
|
301
|
+
function H(e, t, n, r) {
|
|
229
302
|
e.phase = t, e.phaseStart = n, e.phaseDuration = r;
|
|
230
303
|
}
|
|
231
|
-
function
|
|
232
|
-
let
|
|
304
|
+
function U(e, t, n, r) {
|
|
305
|
+
let i = (t - e.timeOrigin) / 1e3, a = e.angularSpeed * n * i + e.phaseOffset, o = r * (e.wobbleAmp1 * Math.sin(e.wobbleFreq1 * i) + e.wobbleAmp2 * Math.sin(e.wobbleFreq2 * i + 1.3));
|
|
233
306
|
return {
|
|
234
|
-
x: (e.baseRadiusX +
|
|
235
|
-
y: (e.baseRadiusY +
|
|
307
|
+
x: (e.baseRadiusX + o) * Math.cos(a) + e.pertXAmp * Math.sin(e.pertXFreq * i + e.pertXPhase),
|
|
308
|
+
y: (e.baseRadiusY + o) * Math.sin(a) + e.pertYAmp * Math.cos(e.pertYFreq * i + e.pertYPhase)
|
|
236
309
|
};
|
|
237
310
|
}
|
|
238
|
-
function
|
|
311
|
+
function te(e, t, n, r, i) {
|
|
239
312
|
e.timeOrigin = i, e.angularSpeed = .08 + t() * .16, e.phaseOffset = t() * Math.PI * 2;
|
|
240
313
|
let a = n * (.8 + t() * .4), o = r * (.3 + t() * .7);
|
|
241
314
|
e.baseRadiusX = a * (1 - o), e.baseRadiusY = a * (1 + o), e.wobbleAmp1 = .02 + t() * .06, e.wobbleFreq1 = .08 + t() * .22, e.wobbleAmp2 = .015 + t() * .04, e.wobbleFreq2 = .18 + t() * .32, e.pertXAmp = .03 + t() * .05, e.pertXFreq = .06 + t() * .18, e.pertXPhase = t() * Math.PI * 2, e.pertYAmp = .03 + t() * .05, e.pertYFreq = .07 + t() * .17, e.pertYPhase = t() * Math.PI * 2;
|
|
242
315
|
}
|
|
243
|
-
var
|
|
244
|
-
function
|
|
316
|
+
var W = .75, G = 2e3;
|
|
317
|
+
function K(e, t) {
|
|
245
318
|
let n = l(u(t + "goo")), r = [], i = [], a = [], o = -Infinity, s = e.orbitRadius;
|
|
246
319
|
function c() {
|
|
247
320
|
let t = e.orbitRadius;
|
|
@@ -251,9 +324,9 @@ function U(e, t) {
|
|
|
251
324
|
s = t;
|
|
252
325
|
}
|
|
253
326
|
}
|
|
254
|
-
function d() {
|
|
255
|
-
let
|
|
256
|
-
for (; r.length <
|
|
327
|
+
function d(t) {
|
|
328
|
+
let o = e.satelliteCount;
|
|
329
|
+
for (; r.length < o;) r.push(ee(n, r.length, e.orbitRadius, e.eccentricity, t)), i.push({
|
|
257
330
|
x: 0,
|
|
258
331
|
y: 0,
|
|
259
332
|
radius: e.satelliteRadius,
|
|
@@ -263,74 +336,73 @@ function U(e, t) {
|
|
|
263
336
|
y: 0,
|
|
264
337
|
start: 0
|
|
265
338
|
});
|
|
266
|
-
r.length >
|
|
339
|
+
r.length > o && (r.length = o, i.length = o, a.length = o);
|
|
267
340
|
}
|
|
268
|
-
d();
|
|
269
341
|
function f(t, s) {
|
|
270
|
-
d(), c();
|
|
342
|
+
d(t), c();
|
|
271
343
|
let l = r.length, u = s.mergeRate, f = e.satelliteRadius, p = e.mergeDuration, m = e.emergeDuration, h = e.orbitDuration, g = e.absorbedDuration;
|
|
272
|
-
for (let
|
|
273
|
-
let
|
|
274
|
-
switch (
|
|
344
|
+
for (let c = 0; c < l; c++) {
|
|
345
|
+
let l = r[c], d = t - l.phaseStart, _ = B(l.phaseDuration > 0 ? d / l.phaseDuration : 1);
|
|
346
|
+
switch (l.phase) {
|
|
275
347
|
case "orbiting":
|
|
276
|
-
if (
|
|
348
|
+
if (_ >= 1) if (t - o < 3e3 * u) l.phaseStart = t, l.phaseDuration = z(n, h[0], h[1]);
|
|
277
349
|
else {
|
|
278
|
-
let e =
|
|
279
|
-
|
|
350
|
+
let e = U(l, t, s.orbitSpeedScale, s.wobbleScale);
|
|
351
|
+
l.startX = e.x, l.startY = e.y;
|
|
280
352
|
let n = Math.hypot(e.x, e.y), r = n > .01 ? .08 / n : 0;
|
|
281
|
-
|
|
353
|
+
l.endX = e.x * r, l.endY = e.y * r, H(l, "merging", t, p), o = t;
|
|
282
354
|
}
|
|
283
355
|
break;
|
|
284
356
|
case "merging":
|
|
285
|
-
|
|
357
|
+
_ >= 1 && H(l, "absorbed", t, z(n, g[0], g[1]));
|
|
286
358
|
break;
|
|
287
359
|
case "absorbed":
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
let r =
|
|
291
|
-
|
|
360
|
+
if (_ >= 1) {
|
|
361
|
+
te(l, n, e.orbitRadius, e.eccentricity, t);
|
|
362
|
+
let r = U(l, t + 3e3, s.orbitSpeedScale, s.wobbleScale);
|
|
363
|
+
l.endX = r.x, l.endY = r.y;
|
|
292
364
|
let i = Math.hypot(r.x, r.y), a = i > .01 ? .08 / i : 0;
|
|
293
|
-
|
|
365
|
+
l.startX = r.x * a, l.startY = r.y * a, H(l, "emerging", t, m);
|
|
294
366
|
}
|
|
295
367
|
break;
|
|
296
368
|
case "emerging":
|
|
297
|
-
if (
|
|
298
|
-
let e = a[
|
|
299
|
-
e.x =
|
|
369
|
+
if (_ >= 1) {
|
|
370
|
+
let e = a[c];
|
|
371
|
+
e.x = l.endX, e.y = l.endY, e.start = t, l.timeOrigin = t, l.phaseOffset = Math.atan2(l.endY, l.endX), H(l, "orbiting", t, z(n, h[0], h[1]));
|
|
300
372
|
}
|
|
301
373
|
break;
|
|
302
374
|
}
|
|
303
|
-
let
|
|
304
|
-
switch (
|
|
375
|
+
let v, y, b, x;
|
|
376
|
+
switch (l.phase) {
|
|
305
377
|
case "orbiting": {
|
|
306
|
-
let e =
|
|
307
|
-
if (n.start > 0 && r <
|
|
308
|
-
let t =
|
|
309
|
-
|
|
310
|
-
} else
|
|
311
|
-
|
|
378
|
+
let e = U(l, t, s.orbitSpeedScale, s.wobbleScale), n = a[c], r = t - n.start;
|
|
379
|
+
if (n.start > 0 && r < G) {
|
|
380
|
+
let t = B(r / G), i = t * t * (3 - 2 * t);
|
|
381
|
+
v = V(n.x, e.x, i), y = V(n.y, e.y, i);
|
|
382
|
+
} else v = e.x, y = e.y;
|
|
383
|
+
b = W, x = 1;
|
|
312
384
|
break;
|
|
313
385
|
}
|
|
314
386
|
case "merging": {
|
|
315
|
-
let e =
|
|
316
|
-
|
|
317
|
-
let n =
|
|
318
|
-
|
|
387
|
+
let e = O(B((t - l.phaseStart) / l.phaseDuration));
|
|
388
|
+
v = V(l.startX, l.endX, e), y = V(l.startY, l.endY, e);
|
|
389
|
+
let n = B((t - l.phaseStart) / l.phaseDuration);
|
|
390
|
+
b = n > .85 ? V(W, 0, (n - .85) / .15) : W, x = V(1, .65, e);
|
|
319
391
|
break;
|
|
320
392
|
}
|
|
321
393
|
case "absorbed":
|
|
322
|
-
|
|
394
|
+
v = 0, y = 0, b = 0, x = .5;
|
|
323
395
|
break;
|
|
324
396
|
case "emerging": {
|
|
325
|
-
let e =
|
|
326
|
-
|
|
327
|
-
let n =
|
|
328
|
-
|
|
397
|
+
let e = k(B((t - l.phaseStart) / l.phaseDuration));
|
|
398
|
+
v = V(l.startX, l.endX, e), y = V(l.startY, l.endY, e);
|
|
399
|
+
let n = B((t - l.phaseStart) / l.phaseDuration);
|
|
400
|
+
b = n < .1 ? V(0, W, n / .1) : W, x = V(.65, 1, e);
|
|
329
401
|
break;
|
|
330
402
|
}
|
|
331
403
|
}
|
|
332
|
-
let
|
|
333
|
-
|
|
404
|
+
let S = i[c];
|
|
405
|
+
S.x = v, S.y = y, S.radius = f * x, S.opacity = b;
|
|
334
406
|
}
|
|
335
407
|
}
|
|
336
408
|
function p() {
|
|
@@ -348,9 +420,9 @@ function U(e, t) {
|
|
|
348
420
|
}
|
|
349
421
|
//#endregion
|
|
350
422
|
//#region src/components/custom/goo-blob/shaders/metaball.vert.ts
|
|
351
|
-
var
|
|
423
|
+
var ne = "#version 300 es\n\nin vec2 aPosition;\nout vec2 vUv;\n\nvoid main() {\n vUv = 0.5 * (aPosition + 1.0);\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}", re = "// --- SDF ---\n\nfloat sdCircle(vec2 p, vec2 center, float radius) {\n return length(p - center) - radius;\n}\n\n// IQ 2024 quadratic-polynomial smin, NORMALIZED so k is a blend band in distance\n// units. The k *= 4.0 pre-scale makes the h*h*k*0.25 poly's effective blend width\n// equal to k (the un-normalized form's width was 0.25*k).\nfloat sminQuadratic(float a, float b, float k) {\n k *= 4.0;\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - h * h * k * 0.25;\n}\n\n// IQ circular smin — a quarter-circle fillet at the seam (rounder than the\n// quadratic). The k *= 1.0/(1.0-sqrt(0.5)) factor normalizes k to the same\n// blend-band units so the merge axis swaps shape without re-tuning uSmoothK.\nfloat sminCircular(float a, float b, float k) {\n k *= 1.0 / (1.0 - sqrt(0.5));\n float h = max(k - abs(a - b), 0.0) / k;\n return min(a, b) - k * 0.5 * (1.0 + h - sqrt(1.0 - h * (h - 2.0)));\n}\n\n// Config-gated merge dispatch — uMerge 0 = quadratic, 1 = circular.\nfloat smin(float a, float b, float k) {\n if (uMerge > 0.5) return sminCircular(a, b, k);\n return sminQuadratic(a, b, k);\n}", ie = "// --- Noise ---\n\nfloat hash21(vec2 p) {\n vec3 p3 = fract(vec3(p.xyx) * 0.1031);\n p3 += dot(p3, p3.yzx + 33.33);\n return fract((p3.x + p3.y) * p3.z);\n}\n\n// IQ analytic-derivative gradient noise — value in .x, ANALYTIC gradient\n// (d/dx, d/dy) in .yz, from one eval. The quintic fade has a continuous 2nd\n// derivative so the gradient is smooth (a cubic smoothstep fade would crease it).\n// (Inigo Quilez, https://iquilezles.org/articles/gradientnoise/.)\nvec3 noised(vec2 p) {\n vec2 i = floor(p);\n vec2 f = fract(p);\n\n // Quintic fade + its derivative.\n vec2 u = f * f * f * (f * (f * 6.0 - 15.0) + 10.0);\n vec2 du = 30.0 * f * f * (f * (f - 2.0) + 1.0);\n\n // Per-corner gradient vectors from the hash (centred to [-1, 1]).\n vec2 ga = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 0.0)), hash21(i + vec2(7.3, 0.0)));\n vec2 gb = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 0.0)), hash21(i + vec2(8.3, 0.0)));\n vec2 gc = -1.0 + 2.0 * vec2(hash21(i + vec2(0.0, 1.0)), hash21(i + vec2(7.3, 1.0)));\n vec2 gd = -1.0 + 2.0 * vec2(hash21(i + vec2(1.0, 1.0)), hash21(i + vec2(8.3, 1.0)));\n\n float va = dot(ga, f - vec2(0.0, 0.0));\n float vb = dot(gb, f - vec2(1.0, 0.0));\n float vc = dot(gc, f - vec2(0.0, 1.0));\n float vd = dot(gd, f - vec2(1.0, 1.0));\n\n // Value, remapped to [0,1] so it drops in for the prior valueNoise.\n float n = va + u.x * (vb - va) + u.y * (vc - va) + u.x * u.y * (va - vb - vc + vd);\n float value = 0.5 + 0.5 * n;\n\n // Analytic gradient (chain rule through the bilinear blend + the fade).\n vec2 grad =\n ga + u.x * (gb - ga) + u.y * (gc - ga) + u.x * u.y * (ga - gb - gc + gd) +\n du * (vec2(u.y, u.x) * (va - vb - vc + vd) + vec2(vb, vc) - va);\n return vec3(value, 0.5 * grad);\n}\n\n// Rotated-octave FBM over the analytic gradient noise: a fixed ~0.5 rad 2x2\n// rotation between octaves breaks the axis-aligned banding. The rotation CONSTANT\n// is spliced from the shared chunk (AV.W2 — the one FBM_ROT); the loops below\n// stay blob-local (param octaves + 2.0 lacunarity, per §3a).", ae = "float fbm(vec2 p, int octaves) {\n float value = 0.0;\n float amp = 0.5;\n float freq = 1.0;\n for (int i = 0; i < 4; i++) {\n if (i >= octaves) break;\n value += amp * noised(p * freq).x;\n p = FBM_ROT * p;\n freq *= 2.0;\n amp *= 0.5;\n }\n return value;\n}\n\n// One domain-warp pass: offset the sample point by a low-frequency FBM of itself\n// (the IQ fbm(p + W*fbm(p)) marbling). warpAmp (uniform-driven) is the warp\n// strength; warpAmp == 0.0 degrades to plain fbm (the pre-warp look).\nfloat fbmWarped(vec2 p, int octaves, float warpAmp) {\n if (warpAmp <= 0.0) return fbm(p, octaves);\n vec2 q = vec2(fbm(p + vec2(0.0, 0.0), octaves), fbm(p + vec2(5.2, 1.3), octaves));\n return fbm(p + warpAmp * (q - 0.5), octaves);\n}\n", oe = "// Edit #4's gamut step — hue-preserving inward chroma clamp. If the linear result\n// is out of [0,1], bisect chroma toward 0 (L + h fixed) until in gamut. Preserves\n// hue exactly (only C shrinks). 16 steps resolve C to < 2^-16 of its span.\nbool inGamut(vec3 lin) {\n return all(greaterThanEqual(lin, vec3(0.0))) && all(lessThanEqual(lin, vec3(1.0)));\n}\nvec3 gamutClampOklch(vec3 lch) {\n vec3 lin = oklabToLinearSrgb(oklchToOklab(lch));\n if (inGamut(lin)) return lch;\n float lo = 0.0;\n float hi = lch.y;\n for (int i = 0; i < 16; i++) {\n float mid = 0.5 * (lo + hi);\n vec3 test = vec3(lch.x, mid, lch.z);\n if (inGamut(oklabToLinearSrgb(oklchToOklab(test)))) {\n lo = mid;\n } else {\n hi = mid;\n }\n }\n return vec3(lch.x, lo, lch.z);\n}", q = "\n", se = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform vec2 uResolution;\nuniform float uTime;\nuniform vec3 uBaseColor;\n\n// Multi-stop palette (W11.b) — 2-4 in-family OKLCh stops (uploaded GAMMA sRGB, like\n// uBaseColor). uStopCount <= 1 falls back to uBaseColor (the single-color default,\n// zero regression). MAX_BLOB_STOPS is a compile-time #define.\n#define MAX_BLOB_STOPS 4\nuniform int uStopCount;\nuniform vec3 uPalette[MAX_BLOB_STOPS];\n\n// Pointer\nuniform vec2 uPointer;\nuniform float uPointerActive;\nuniform float uPointerAttraction;\nuniform float uPointerStrength;\n\n// Main body\nuniform float uBodyRadius;\n\n// Pulsation\nuniform float uPulsePhase;\nuniform float uPulseAmp;\n\n// Surface noise\nuniform float uNoiseAmp;\nuniform float uNoiseFreq;\nuniform float uNoiseSpeed;\n\n// Gooey\nuniform float uSmoothK;\nuniform float uMerge; // 0 = quadratic smin, 1 = circular smin (rounder menisci)\n\n// Membrane — domain-warp strength on the FBM edge displacement (0 = plain fbm).\nuniform float uWarpAmp;\n\n// Lit glass surface (W9.b) — gated behind uLit so the flat fill stays default.\nuniform float uLit; // 0 = flat fill (default), 1 = lit droplet\nuniform vec3 uRimColor; // Fresnel rim tint (GAMMA sRGB, via ColorResolver)\nuniform vec3 uLightDir; // normalized light direction (x, y, z)\nuniform float uSpecStrength; // Blinn-Phong specular weight\nuniform float uSpecShininess; // specular exponent (16-64, tight glint)\nuniform float uRimPower; // Fresnel/Schlick exponent (~2-3)\nuniform float uRimStrength; // Fresnel rim weight\n\n// Iridescence + fake subsurface (W11.a) — translucent-gel read.\nuniform float uIridescence; // warm-pearl rim sheen weight (0 = off)\nuniform float uIridHue; // base hue (radians) the cosine palette biases toward (warm)\nuniform float uIridSpeed; // animated-thickness scroll for the iridescent t\nuniform float uSssScale; // fast-SSS back-light weight\nuniform float uSssPower; // fast-SSS exponent\nuniform float uCoreGlow; // thickness-driven inner-luminosity lift\n\n// Color perturbation (perceptually uniform — OKLCh L/C/h)\nuniform float uHueRange; // degrees of hue swing (converted to radians)\nuniform float uSatShift; // OKLCh chroma swing\nuniform float uBrightnessShift; // OKLCh lightness bias\nuniform float uColorNoiseFreq;\nuniform float uColorNoiseSpeed;\n\n// Satellites (max 4)\n#define MAX_SATS 4\nuniform int uSatCount;\nuniform vec2 uSatPos[MAX_SATS];\nuniform float uSatRadius[MAX_SATS];\nuniform float uSatOpacity[MAX_SATS];\n\n// Pointer trail (W10) — a decaying-radius pseudopod toward the cursor. uTrail is a\n// COMPILE-TIME-SIZED array (GLSL ES 3.00 forbids a uniform-sized array) with a\n// DYNAMIC break on uTrailCount, mirroring the satellite loop. Later samples paint\n// smaller metaballs (r *= 1 - i/N) so the trail tapers into a tail.\n#define TRAIL_N 15\nuniform int uTrailCount;\nuniform vec2 uTrailPos[TRAIL_N];\nuniform float uTrailRadius[TRAIL_N];\n\n// Velocity-driven volume-preserving squash-and-stretch (W10).\nuniform vec2 uVelocity; // smoothed pointer velocity (motion direction + speed)\nuniform float uStretch; // squash-stretch magnitude (0 = off)\n\nconst float PI = 3.141592653589793;\n\n" + ie + q + `${o}
|
|
352
424
|
|
|
353
|
-
` +
|
|
425
|
+
` + ae + q + re + q + `
|
|
354
426
|
// --- Color (Ottosson OKLab/OKLCh — value.js EXACT constants, transposed) ---
|
|
355
427
|
//
|
|
356
428
|
// The OETF (srgbToLinear/linearToSrgb) + the four Ottosson matrices + their space
|
|
@@ -359,51 +431,42 @@ var te = "#version 300 es\n\nin vec2 aPosition;\nout vec2 vUv;\n\nvoid main() {\
|
|
|
359
431
|
// ONCE so the OETF can never diverge from aurora's; the line-for-line TS port
|
|
360
432
|
// (__tests__/metaball-color.glsl-port.ts) mirrors that chunk. The gamut-clamp
|
|
361
433
|
// below stays blob-local (aurora has no in-shader OKLCh path).
|
|
362
|
-
${
|
|
363
|
-
${
|
|
434
|
+
${n}
|
|
435
|
+
${t}
|
|
364
436
|
|
|
365
|
-
` + q + J + "\nvoid main() {\n vec2 uv = vUv - 0.5;\n\n // Pointer deformation\n if (uPointerActive > 0.5) {\n vec2 pointerDir = uPointer - uv;\n float pointerDist = length(pointerDir);\n float influence = smoothstep(0.4, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;\n uv -= normalize(pointerDir + 1e-6) * influence;\n }\n\n // Main body with pulsation\n float bodyR = uBodyRadius + sin(uPulsePhase) * uPulseAmp;\n\n // FBM displacement for organic watercolor edge\n float noiseVal = fbm(uv * uNoiseFreq + uTime * uNoiseSpeed, 3);\n float bodyDisplacement = (noiseVal - 0.5) * uNoiseAmp;\n\n float d = sdCircle(uv, vec2(0.0), bodyR + bodyDisplacement);\n\n // Satellites\n for (int i = 0; i < MAX_SATS; i++) {\n if (i >= uSatCount) break;\n float satD = sdCircle(uv, uSatPos[i], uSatRadius[i]);\n satD += (1.0 - uSatOpacity[i]) * 0.3;\n d = smin(d, satD, uSmoothK);\n }\n\n // Edit #1 — fwidth-based anti-aliased edge: derive the smoothstep half-width\n // from the SDF screen-space gradient so the edge stays ~1px regardless of zoom.\n float aa = max(fwidth(d), 1e-6);\n float alpha = 1.0 - smoothstep(-aa, aa, d);\n\n if (alpha < 0.001) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Edit #4 — perceptually-uniform OKLCh variation. Gamma base → linear → OKLab\n // → OKLCh; perturb L/C/h; OKLCh → OKLab → linear; hue-preserving gamut clamp.\n vec3 oklch = oklabToOklch(srgbToOklab(uBaseColor));\n\n float colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);\n oklch.z += (colorNoise - 0.5) * uHueRange * (PI / 180.0); // hue swing, radians\n oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0); // chroma swing\n oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0); // lightness bias\n\n // Subtle inner glow near the edge — lifts OKLCh lightness inward.\n float edgeGlow = smoothstep(0.0, -bodyR * 0.6, d);\n oklch.x = mix(oklch.x, min(oklch.x + 0.06, 1.0), 1.0 - edgeGlow);\n\n oklch = gamutClampOklch(oklch);\n\n vec3 lin = oklabToLinearSrgb(oklchToOklab(oklch));\n vec3 rgb = clamp(linearToSrgb(lin), 0.0, 1.0); // MANDATORY OETF — closes the seam\n\n // Edit #8 — premultiply AFTER the OETF: straight-alpha gamma → premultiplied.\n fragColor = vec4(rgb * alpha, alpha);\n}", X = 4, Z = "[GooBlob]", Q = 1 / 1.6, ne = [
|
|
366
|
-
"uResolution",
|
|
367
|
-
"uTime",
|
|
368
|
-
"uBaseColor",
|
|
369
|
-
"uPointer",
|
|
370
|
-
"uPointerActive",
|
|
371
|
-
"uPointerAttraction",
|
|
372
|
-
"uPointerStrength",
|
|
373
|
-
"uBodyRadius",
|
|
374
|
-
"uPulsePhase",
|
|
375
|
-
"uPulseAmp",
|
|
376
|
-
"uNoiseAmp",
|
|
377
|
-
"uNoiseFreq",
|
|
378
|
-
"uNoiseSpeed",
|
|
379
|
-
"uSmoothK",
|
|
380
|
-
"uHueRange",
|
|
381
|
-
"uSatShift",
|
|
382
|
-
"uBrightnessShift",
|
|
383
|
-
"uColorNoiseFreq",
|
|
384
|
-
"uColorNoiseSpeed",
|
|
385
|
-
"uSatCount"
|
|
386
|
-
];
|
|
437
|
+
` + oe + q + "\n// The composite SDF field — the domain-warped body membrane smin-merged with the\n// satellites. Factored so the lit-surface block (W9.b) can sample the SAME field\n// at a screen-space epsilon to derive the IQ tetrahedron normal: the normal MUST\n// ride the composite distance the alpha is cut from, not a clean circle.\nfloat sceneDist(vec2 uv) {\n // Pulsing body radius.\n float bodyR = uBodyRadius + sin(uPulsePhase) * uPulseAmp;\n\n // Velocity-driven VOLUME-PRESERVING squash-and-stretch (W10). Stretch the body\n // along the motion direction by sa = 1 + |v|*k and squash the PERPENDICULAR\n // axis by EXACTLY 1/sa (NOT 1 - amt, which loses area so the blob SHRINKS at\n // speed). Applied as an anisotropic basis in body space: q = (dot/sa, dot*sa).\n vec2 bodyUv = uv;\n float speed = length(uVelocity);\n if (uStretch > 0.0 && speed > 1e-4) {\n vec2 ax = uVelocity / speed; // motion axis (unit)\n vec2 perp = vec2(-ax.y, ax.x); // perpendicular\n float sa = 1.0 + speed * uStretch; // stretch factor along motion\n bodyUv = vec2(dot(uv, ax) / sa, dot(uv, perp) * sa);\n }\n\n // Domain-warped FBM displacement — the organic marbled watercolor membrane.\n float noiseVal = fbmWarped(bodyUv * uNoiseFreq + uTime * uNoiseSpeed, 3, uWarpAmp);\n float bodyDisplacement = (noiseVal - 0.5) * uNoiseAmp;\n\n float d = sdCircle(bodyUv, vec2(0.0), bodyR + bodyDisplacement);\n\n // Satellites — smin-merged into the body (uMerge selects quadratic/circular).\n for (int i = 0; i < MAX_SATS; i++) {\n if (i >= uSatCount) break;\n float satD = sdCircle(uv, uSatPos[i], uSatRadius[i]);\n satD += (1.0 - uSatOpacity[i]) * 0.3;\n d = smin(d, satD, uSmoothK);\n }\n\n // Pointer trail — a decaying-radius pseudopod reaching toward the cursor,\n // smin-merged so it stretches an elastic limb and snaps back. COMPILE-TIME\n // array, DYNAMIC break (mirrors the satellite loop).\n for (int i = 0; i < TRAIL_N; i++) {\n if (i >= uTrailCount) break;\n float trailD = sdCircle(uv, uTrailPos[i], uTrailRadius[i]);\n d = smin(d, trailD, uSmoothK);\n }\n return d;\n}\n\n// W9.b — the IQ 4-tap tetrahedron gradient of the composite SDF, lifted to a\n// pseudo-3D surface normal so the droplet reads as a rounded bead (flat centre,\n// steep rim) rather than a flat sticker.\n//\n// SCREEN-SPACE epsilon: the smin + domain-warped FBM field is NOT a unit-gradient\n// SDF, so a tiny fixed epsilon shimmers; the tap offset is ~1.5px / uResolution.y\n// so it tracks the rendered pixel size at any zoom. normalize() is guarded with\n// +1e-6 (the gate's |N| ~ 1 assertion holds across the interior).\n//\n// The Z lift: 'interior' is the normalized depth inward from the rim\n// (-d / bodyR, 0 at the edge, ~1 deep inside); the dome height\n// z = sqrt(max(0, 1 - (1 - interior)^2)) is the unit half-sphere profile (flat\n// at the centre, steep at the rim). n3 = normalize(vec3(grad2d * (1 - z), z))\n// tilts the normal outward along the SDF gradient near the rim and points it at\n// the viewer deep inside.\nvec3 surfaceNormal(vec2 uv, float d, float bodyR) {\n const vec2 k = vec2(1.0, -1.0);\n float eps = 1.5 / max(uResolution.y, 1.0);\n vec2 grad2d = normalize(\n k.xy * sceneDist(uv + k.xy * eps) +\n k.yy * sceneDist(uv + k.yy * eps) +\n k.yx * sceneDist(uv + k.yx * eps) +\n k.xx * sceneDist(uv + k.xx * eps) + vec2(1e-6));\n\n float interior = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0);\n float z = sqrt(max(0.0, 1.0 - (1.0 - interior) * (1.0 - interior)));\n return normalize(vec3(grad2d * (1.0 - z), z) + vec3(0.0, 0.0, 1e-6));\n}\n\n// W11.b — sample the multi-stop palette at t in [0,1], interpolating adjacent\n// stops in OKLab with a MIDPOINT CHROMA-BUMP (a linear OKLab mix of a vivid pair\n// dips chroma through grey; the bump lifts it back). Falls back to uBaseColor when\n// uStopCount <= 1. Returns an OKLCh stop [L, C, h(rad)].\nvec3 samplePaletteOklch(float t) {\n if (uStopCount <= 1) return oklabToOklch(srgbToOklab(uBaseColor));\n float n = float(uStopCount);\n float ft = clamp(t, 0.0, 1.0) * (n - 1.0);\n int i0 = int(floor(ft));\n int i1 = min(i0 + 1, uStopCount - 1);\n float f = ft - float(i0);\n // Fetch adjacent stops (uPalette is gamma sRGB) → OKLab.\n vec3 labA = srgbToOklab(uPalette[i0]);\n vec3 labB = srgbToOklab(uPalette[i1]);\n vec3 lab = mix(labA, labB, f);\n vec3 lch = oklabToOklch(lab);\n // Midpoint chroma-bump: a bell (peaks at f=0.5) lifts C off the grey midpoint.\n lch.y += 0.03 * sin(PI * f);\n return lch;\n}\n\nvoid main() {\n vec2 uv = vUv - 0.5;\n\n // Pointer deformation — honor the SIGN of uPointerAttraction (W10): a positive\n // attraction leans the body IN toward the cursor, a negative shies it AWAY. The\n // signed influence flows straight into the UV shift (no hardcoded repulsion).\n if (uPointerActive > 0.5) {\n vec2 pointerDir = uPointer - uv;\n float pointerDist = length(pointerDir);\n float influence = smoothstep(0.4, 0.0, pointerDist) * uPointerAttraction * uPointerStrength;\n uv -= normalize(pointerDir + 1e-6) * influence;\n }\n\n // The pulsing body radius — also reused below for the inner-glow falloff scale.\n float bodyR = uBodyRadius + sin(uPulsePhase) * uPulseAmp;\n\n // Composite domain-warped membrane field.\n float d = sceneDist(uv);\n\n // Edit #1 — fwidth-based anti-aliased edge: derive the smoothstep half-width\n // from the SDF screen-space gradient so the edge stays ~1px regardless of zoom.\n float aa = max(fwidth(d), 1e-6);\n float alpha = 1.0 - smoothstep(-aa, aa, d);\n\n if (alpha < 0.001) {\n fragColor = vec4(0.0);\n return;\n }\n\n // Edit #4 — perceptually-uniform OKLCh variation. Gamma base → linear → OKLab\n // → OKLCh; perturb L/C/h; OKLCh → OKLab → linear; hue-preserving gamut clamp.\n // The base is the multi-stop palette sample (W11.b) — distributed across the\n // body/satellites by the color noise field — or uBaseColor when single-stop.\n float colorNoise = fbm(uv * uColorNoiseFreq + uTime * uColorNoiseSpeed, 3);\n vec3 oklch = samplePaletteOklch(colorNoise);\n\n oklch.z += (colorNoise - 0.5) * uHueRange * (PI / 180.0); // hue swing, radians\n oklch.y = max(oklch.y + (colorNoise - 0.5) * uSatShift, 0.0); // chroma swing\n oklch.x = clamp(oklch.x + uBrightnessShift, 0.0, 1.0); // lightness bias\n\n // Surface normal — computed ONCE here and reused by the iridescence (W11.a),\n // the fake-SSS (W11.a), and the lit glass block (W9.b).\n vec3 N = surfaceNormal(uv, d, bodyR);\n vec3 V = vec3(0.0, 0.0, 1.0);\n float thickness = clamp(-d / max(bodyR, 1e-4), 0.0, 1.0); // 0 at rim, ~1 deep in\n float fres = pow(1.0 - max(dot(N, V), 0.0), 2.5); // rim-weighted angle\n\n // ── W11.a iridescence — warm-biased IQ cosine palette driving OKLCh HUE ──\n //\n // A thin-film-like sheen on the RIM (fres-weighted), NOT the cold-blue default:\n // an IQ cosine palette (a + b*cos(2pi(c*t + d))) maps the Fresnel/edge angle +\n // the FBM color field + an animated thickness onto a HUE OFFSET biased to the\n // warm arc (uIridHue), with the chroma clamped to a warm-pearl band so the rim\n // reads cream/gold (congruent with the warm-cream-glass identity). Mixed into\n // OKLCh BEFORE the gamut clamp. Default LOW.\n if (uIridescence > 0.0) {\n float t = fres + 0.3 * colorNoise + uTime * uIridSpeed;\n // Cosine palette in HUE space, centred on the warm uIridHue (~0.18 turn of\n // warm sweep so the sheen shimmers gold→peach, never swinging to cold blue).\n float iridHue = uIridHue + 0.18 * PI * cos(2.0 * PI * t);\n float w = fres * uIridescence; // rim-weighted blend\n oklch.z = mix(oklch.z, iridHue, w);\n // Warm-pearl chroma cap: lift chroma toward a pale-pearl band, clamped.\n oklch.y = min(oklch.y + 0.04 * w, oklch.y + 0.08);\n oklch.x = min(oklch.x + 0.05 * w, 1.0); // a touch brighter at the sheen\n }\n\n // ── W11.a fake subsurface translucency — thickness inner-glow + back-light ──\n //\n // A bright translucent CORE fading to a light-leaking EDGE (the -d ramp) plus\n // the fast-SSS back-light (light wrapping through the thin rim). Both lift OKLCh\n // L and warm the hue, consuming the W9 normal. In OKLCh before the gamut clamp.\n if (uCoreGlow > 0.0 || uSssScale > 0.0) {\n // Inner-luminosity ramp: brighter where the body is thick.\n oklch.x = min(oklch.x + uCoreGlow * thickness, 1.0);\n // Fast-SSS back-light: light wrapping through the thin (low-thickness) rim.\n vec3 L = normalize(uLightDir + vec3(1e-6));\n float back = pow(clamp(dot(V, -(L + N * thickness)), 0.0, 1.0), uSssPower);\n float sss = back * uSssScale * (1.0 - thickness);\n oklch.x = min(oklch.x + sss, 1.0);\n oklch.z += sss * 0.1; // warm the leaking edge slightly\n }\n\n oklch = gamutClampOklch(oklch);\n\n vec3 lin = oklabToLinearSrgb(oklchToOklab(oklch));\n\n // ── W9.b lit glass surface — Blinn-Phong glint + Fresnel rim, in LINEAR ──\n //\n // The lit terms enter lin in LINEAR space BEFORE the OETF (linearToSrgb)\n // and BEFORE the * alpha premultiply — a post-OETF apply double-gammas the\n // highlight and fringes the premultiplied edge (the named A5/A2 trap). The\n // prior flat inner-glow lift is SUBSUMED by the Fresnel rim (the curvature\n // read now comes from the surface normal, not a flat smoothstep). Gated behind\n // uLit so the flat fill stays the default (zero regression).\n if (uLit > 0.5) {\n // N, V, thickness are already computed in main() (reused by iridescence/SSS).\n vec3 L = normalize(uLightDir + vec3(1e-6)); // light direction\n vec3 H = normalize(L + V); // Blinn-Phong half-vector\n\n // Warm-cream specular glint — a near-white OKLCh TINT (L~0.97, C~0.03,\n // hue~85°) routed through the SAME spliced OKLCh matrices, NOT hardcoded\n // sRGB white (pure white reads cheap-CG). Linearized for the linear add.\n vec3 warmCream = oklabToLinearSrgb(oklchToOklab(vec3(0.97, 0.03, radians(85.0))));\n float spec = pow(max(dot(N, H), 0.0), uSpecShininess) * uSpecStrength;\n\n // Fresnel/Schlick rim — fed uRimColor (the --foreground warm rim via the\n // injected ColorResolver, NOT a cold-blue default). Attenuated where the\n // body is thick so the sheen rides the rim, not the core. The rim Fresnel\n // uses uRimPower (the W9.b knob), distinct from the iridescence's fixed 2.5.\n float rimFres = pow(1.0 - max(dot(N, V), 0.0), uRimPower);\n float rim = rimFres * uRimStrength * (1.0 - 0.6 * thickness);\n vec3 rimLin = srgbToLinear(uRimColor);\n\n // Combine the two warm highlights and add in LINEAR. max(spec, rim*scale)\n // keeps the glint from stacking on the rim into a blown hotspot.\n vec3 highlight = max(warmCream * spec, rimLin * rim);\n lin += highlight;\n }\n\n vec3 rgb = clamp(linearToSrgb(lin), 0.0, 1.0); // MANDATORY OETF — closes the seam\n\n // Edit #8 — premultiply AFTER the OETF: straight-alpha gamma → premultiplied.\n fragColor = vec4(rgb * alpha, alpha);\n}", J = 4, Y = 15, X = 4, Z = "[GooBlob]", Q = 1 / 1.6, ce = /* @__PURE__ */ "uResolution.uTime.uBaseColor.uPointer.uPointerActive.uPointerAttraction.uPointerStrength.uBodyRadius.uPulsePhase.uPulseAmp.uNoiseAmp.uNoiseFreq.uNoiseSpeed.uWarpAmp.uSmoothK.uMerge.uLit.uRimColor.uLightDir.uSpecStrength.uSpecShininess.uRimPower.uRimStrength.uIridescence.uIridHue.uIridSpeed.uSssScale.uSssPower.uCoreGlow.uHueRange.uSatShift.uBrightnessShift.uColorNoiseFreq.uColorNoiseSpeed.uStopCount.uSatCount.uTrailCount.uVelocity.uStretch".split(".");
|
|
387
438
|
function $(e) {
|
|
388
|
-
let { canvasRef: t, color:
|
|
439
|
+
let { canvasRef: t, color: n, mood: o, pointer: l, satellites: u, config: d, colorResolver: f } = e;
|
|
389
440
|
if (typeof f != "function") throw Error("[GooBlob] a `colorResolver` is required. Pass `defaultBlobColorResolver` from `@mkbabb/glass-ui/color` (or your own `ColorResolver`) — the blob resolves its base CSS color through this seam and will not paint without it.");
|
|
390
|
-
let p = 0, m = /* @__PURE__ */ new Map();
|
|
391
|
-
function
|
|
392
|
-
let t =
|
|
441
|
+
let p = 0, m = 0, h = /* @__PURE__ */ new Map();
|
|
442
|
+
function g(e) {
|
|
443
|
+
let t = h.get(e);
|
|
393
444
|
if (t) return t;
|
|
394
445
|
let n = f(e);
|
|
395
|
-
return
|
|
446
|
+
return h.size > 256 && h.clear(), h.set(e, n), n;
|
|
396
447
|
}
|
|
397
|
-
let
|
|
448
|
+
let _ = /* @__PURE__ */ new Map();
|
|
449
|
+
function y(e, t) {
|
|
450
|
+
let n = _.get(e);
|
|
451
|
+
if (n) return n;
|
|
452
|
+
let r = e;
|
|
453
|
+
if (e.includes("var(") && typeof window < "u" && t) {
|
|
454
|
+
let n = t.style.color;
|
|
455
|
+
t.style.color = e, r = getComputedStyle(t).color || e, t.style.color = n;
|
|
456
|
+
}
|
|
457
|
+
let i = f(r);
|
|
458
|
+
return _.size > 64 && _.clear(), _.set(e, i), i;
|
|
459
|
+
}
|
|
460
|
+
let b = null, x = !1;
|
|
398
461
|
c(t, {
|
|
399
|
-
pause: () =>
|
|
400
|
-
resume: () =>
|
|
462
|
+
pause: () => b?.suspend("off-screen"),
|
|
463
|
+
resume: () => b?.resume("off-screen")
|
|
401
464
|
}, {
|
|
402
465
|
rootMargin: "200px",
|
|
403
466
|
pauseWhenHidden: !1
|
|
404
467
|
});
|
|
405
|
-
function
|
|
406
|
-
|
|
468
|
+
function S(e) {
|
|
469
|
+
b = a(e, {
|
|
407
470
|
contextAttrs: {
|
|
408
471
|
alpha: !0,
|
|
409
472
|
premultipliedAlpha: !0,
|
|
@@ -411,12 +474,12 @@ function $(e) {
|
|
|
411
474
|
preserveDrawingBuffer: !1
|
|
412
475
|
},
|
|
413
476
|
setup: (t) => {
|
|
414
|
-
let a = s(t, t.VERTEX_SHADER,
|
|
477
|
+
let a = s(t, t.VERTEX_SHADER, ne, Z), c = s(t, t.FRAGMENT_SHADER, se, Z), f = r(t, a, c, Z);
|
|
415
478
|
t.useProgram(f);
|
|
416
|
-
let
|
|
417
|
-
t.bindVertexArray(
|
|
418
|
-
let
|
|
419
|
-
t.bindBuffer(t.ARRAY_BUFFER,
|
|
479
|
+
let h = t.createVertexArray();
|
|
480
|
+
t.bindVertexArray(h);
|
|
481
|
+
let _ = t.createBuffer();
|
|
482
|
+
t.bindBuffer(t.ARRAY_BUFFER, _), t.bufferData(t.ARRAY_BUFFER, new Float32Array([
|
|
420
483
|
-1,
|
|
421
484
|
-1,
|
|
422
485
|
1,
|
|
@@ -432,60 +495,92 @@ function $(e) {
|
|
|
432
495
|
]), t.STATIC_DRAW);
|
|
433
496
|
let v = t.getAttribLocation(f, "aPosition");
|
|
434
497
|
t.enableVertexAttribArray(v), t.vertexAttribPointer(v, 2, t.FLOAT, !1, 0, 0);
|
|
435
|
-
let
|
|
436
|
-
for (let e of
|
|
437
|
-
let
|
|
438
|
-
for (let e = 0; e <
|
|
498
|
+
let S = {};
|
|
499
|
+
for (let e of ce) S[e] = t.getUniformLocation(f, e);
|
|
500
|
+
let C = [], w = [], E = [];
|
|
501
|
+
for (let e = 0; e < J; e++) C.push(t.getUniformLocation(f, `uSatPos[${e}]`)), w.push(t.getUniformLocation(f, `uSatRadius[${e}]`)), E.push(t.getUniformLocation(f, `uSatOpacity[${e}]`));
|
|
502
|
+
let D = [], O = [];
|
|
503
|
+
for (let e = 0; e < Y; e++) D.push(t.getUniformLocation(f, `uTrailPos[${e}]`)), O.push(t.getUniformLocation(f, `uTrailRadius[${e}]`));
|
|
504
|
+
let k = [];
|
|
505
|
+
for (let e = 0; e < X; e++) k.push(t.getUniformLocation(f, `uPalette[${e}]`));
|
|
439
506
|
t.enable(t.BLEND), t.blendFunc(t.ONE, t.ONE_MINUS_SRC_ALPHA);
|
|
440
|
-
function
|
|
441
|
-
let
|
|
507
|
+
function A() {
|
|
508
|
+
let n = i(), r = e.clientWidth || d.canvasSize, a = e.clientHeight || d.canvasSize, o = Math.round(r * n), s = Math.round(a * n);
|
|
442
509
|
(e.width !== o || e.height !== s) && (e.width = o, e.height = s), t.viewport(0, 0, o, s);
|
|
443
510
|
}
|
|
444
|
-
function
|
|
445
|
-
let
|
|
446
|
-
p =
|
|
447
|
-
let
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
511
|
+
function j(r) {
|
|
512
|
+
let i = p ? (r - p) * 1e3 : 16;
|
|
513
|
+
p = r;
|
|
514
|
+
let a = Math.min(i, 50), s = b?.reducedMotion ?? !1, c = (s || x ? 0 : d.tempo) * a;
|
|
515
|
+
m += c, s || o.update({
|
|
516
|
+
pointerActive: l.active.value,
|
|
517
|
+
clicked: l.consumeClick(),
|
|
518
|
+
idleMs: l.idleMs()
|
|
519
|
+
}), o.tick(c), s ? l.rest() : l.tick(c), u.tick(m, o.params.value);
|
|
520
|
+
let _ = o.params.value, v = g(n.value);
|
|
521
|
+
t.useProgram(f), t.bindVertexArray(h), t.uniform2f(S.uResolution, e.width, e.height), t.uniform1f(S.uTime, m / 1e3), t.uniform3f(S.uBaseColor, v[0], v[1], v[2]);
|
|
522
|
+
let A = d.paletteStops, j = Math.min(A.length, X);
|
|
523
|
+
t.uniform1i(S.uStopCount, j);
|
|
524
|
+
for (let n = 0; n < X; n++) {
|
|
525
|
+
let r = k[n] ?? null, i = A[n];
|
|
526
|
+
if (i) {
|
|
527
|
+
let n = y(i, e);
|
|
528
|
+
t.uniform3f(r, n[0], n[1], n[2]);
|
|
529
|
+
} else t.uniform3f(r, v[0], v[1], v[2]);
|
|
530
|
+
}
|
|
531
|
+
let M = l.pointer.value;
|
|
532
|
+
t.uniform2f(S.uPointer, M.x * .5 * Q, M.y * .5 * Q), t.uniform1f(S.uPointerActive, +!!l.active.value), t.uniform1f(S.uPointerAttraction, d.pointerAttraction + _.pointerAttraction), t.uniform1f(S.uPointerStrength, d.pointerStrength * Q);
|
|
533
|
+
let N = l.velocity.value;
|
|
534
|
+
t.uniform2f(S.uVelocity, N.x * .5 * Q, N.y * .5 * Q), t.uniform1f(S.uStretch, d.stretch);
|
|
535
|
+
let P = l.trailSources(d.satelliteRadius * .7);
|
|
536
|
+
t.uniform1i(S.uTrailCount, P.count);
|
|
537
|
+
for (let e = 0; e < Y; e++) {
|
|
538
|
+
let n = D[e] ?? null, r = O[e] ?? null, i = P.sources[e];
|
|
539
|
+
i ? (t.uniform2f(n, i.x * .5 * Q, i.y * .5 * Q), t.uniform1f(r, i.radius * Q)) : (t.uniform2f(n, 0, 0), t.uniform1f(r, 0));
|
|
540
|
+
}
|
|
541
|
+
t.uniform1f(S.uBodyRadius, d.bodyRadius * Q), t.uniform1f(S.uPulsePhase, r * d.pulseFreq * _.pulseFreq * Math.PI * 2);
|
|
542
|
+
let F = l.pulse.value * d.clickImpulse;
|
|
543
|
+
t.uniform1f(S.uPulseAmp, (d.pulseAmp * _.pulseAmp / .015 + F) * Q), t.uniform1f(S.uNoiseAmp, d.noiseAmp * _.noiseAmp / .025 * Q), t.uniform1f(S.uNoiseFreq, d.noiseFreq), t.uniform1f(S.uNoiseSpeed, d.noiseSpeed), t.uniform1f(S.uWarpAmp, d.warpAmp), t.uniform1f(S.uSmoothK, d.smoothK * (_.smoothK / T.smoothK)), t.uniform1f(S.uMerge, +(d.merge === "circular")), t.uniform1f(S.uHueRange, d.hueRange + _.hueRange), t.uniform1f(S.uSatShift, d.satShift + _.satShift), t.uniform1f(S.uBrightnessShift, d.brightnessShift + _.brightnessShift), t.uniform1f(S.uColorNoiseFreq, d.colorNoiseFreq), t.uniform1f(S.uColorNoiseSpeed, d.colorNoiseSpeed), t.uniform1f(S.uLit, +!!d.lit);
|
|
544
|
+
let I = y(d.rimColor, e);
|
|
545
|
+
t.uniform3f(S.uRimColor, I[0], I[1], I[2]), t.uniform3f(S.uLightDir, d.lightDir[0], d.lightDir[1], d.lightDir[2]), t.uniform1f(S.uSpecStrength, d.specStrength), t.uniform1f(S.uSpecShininess, d.specShininess), t.uniform1f(S.uRimPower, d.rimPower), t.uniform1f(S.uRimStrength, d.rimStrength), t.uniform1f(S.uIridescence, d.iridescence * _.iridScale), t.uniform1f(S.uIridHue, d.iridHue * (Math.PI / 180)), t.uniform1f(S.uIridSpeed, d.iridSpeed), t.uniform1f(S.uSssScale, d.sssScale * _.iridScale), t.uniform1f(S.uSssPower, d.sssPower), t.uniform1f(S.uCoreGlow, d.coreGlow);
|
|
546
|
+
let L = u.sources;
|
|
547
|
+
t.uniform1i(S.uSatCount, L.length);
|
|
548
|
+
for (let e = 0; e < J; e++) {
|
|
549
|
+
let n = C[e] ?? null, r = w[e] ?? null, i = E[e] ?? null, a = L[e];
|
|
455
550
|
a ? (t.uniform2f(n, a.x * Q, a.y * Q), t.uniform1f(r, a.radius * Q), t.uniform1f(i, a.opacity)) : (t.uniform2f(n, 0, 0), t.uniform1f(r, 0), t.uniform1f(i, 0));
|
|
456
551
|
}
|
|
457
552
|
t.clearColor(0, 0, 0, 0), t.clear(t.COLOR_BUFFER_BIT), t.drawArrays(t.TRIANGLES, 0, 6), t.bindVertexArray(null);
|
|
458
553
|
}
|
|
459
|
-
function
|
|
460
|
-
return !
|
|
554
|
+
function M() {
|
|
555
|
+
return !x;
|
|
461
556
|
}
|
|
462
557
|
return {
|
|
463
|
-
frame:
|
|
464
|
-
shouldContinue:
|
|
465
|
-
resize:
|
|
558
|
+
frame: j,
|
|
559
|
+
shouldContinue: M,
|
|
560
|
+
resize: A,
|
|
466
561
|
teardown: () => {
|
|
467
|
-
t.deleteProgram(f), t.deleteShader(a), t.deleteShader(c), t.deleteBuffer(
|
|
562
|
+
t.deleteProgram(f), t.deleteShader(a), t.deleteShader(c), t.deleteBuffer(_), t.deleteVertexArray(h);
|
|
468
563
|
}
|
|
469
564
|
};
|
|
470
565
|
}
|
|
471
|
-
}),
|
|
566
|
+
}), b.arm();
|
|
472
567
|
}
|
|
473
568
|
return C(t, (e) => {
|
|
474
|
-
e && !
|
|
475
|
-
}, { immediate: !0 }), C(
|
|
476
|
-
|
|
569
|
+
e && !b && S(e);
|
|
570
|
+
}, { immediate: !0 }), C(n, () => b?.wake()), v(() => {
|
|
571
|
+
b?.dispose(), b = null;
|
|
477
572
|
}), {
|
|
478
573
|
pause: () => {
|
|
479
|
-
|
|
574
|
+
x = !0, b?.suspend("manual");
|
|
480
575
|
},
|
|
481
576
|
resume: () => {
|
|
482
|
-
|
|
577
|
+
x = !1, b?.resume("manual");
|
|
483
578
|
}
|
|
484
579
|
};
|
|
485
580
|
}
|
|
486
581
|
//#endregion
|
|
487
582
|
//#region src/components/custom/goo-blob/GooBlob.vue
|
|
488
|
-
var
|
|
583
|
+
var le = /* @__PURE__ */ e(/* @__PURE__ */ m({
|
|
489
584
|
__name: "GooBlob",
|
|
490
585
|
props: {
|
|
491
586
|
color: {},
|
|
@@ -495,9 +590,9 @@ var re = /* @__PURE__ */ e(/* @__PURE__ */ m({
|
|
|
495
590
|
},
|
|
496
591
|
emits: ["click"],
|
|
497
592
|
setup(e, { expose: t, emit: n }) {
|
|
498
|
-
let r = n, i = h(
|
|
593
|
+
let r = n, i = h(E, null), a = e.config ?? i;
|
|
499
594
|
if (!a) throw Error("[glass-ui] GooBlob: no blob config. Pass an explicit `config` prop (e.g. BLOB_CONFIG_DEFAULTS) or provide(BLOB_CONFIG_KEY, cfg) from an ancestor. There is no silent defaults synthesis.");
|
|
500
|
-
let o = S("canvasRef"), s = S("wrapperRef"), c =
|
|
595
|
+
let o = S("canvasRef"), s = S("wrapperRef"), c = L(), l = R(s), u = K(a, e.color + e.seed), m = x(e.color);
|
|
501
596
|
function v(e) {
|
|
502
597
|
if (!e.includes("var(")) return e;
|
|
503
598
|
let t = s.value;
|
|
@@ -528,22 +623,29 @@ var re = /* @__PURE__ */ e(/* @__PURE__ */ m({
|
|
|
528
623
|
}), _(() => {
|
|
529
624
|
w?.disconnect(), w = null;
|
|
530
625
|
});
|
|
531
|
-
function
|
|
626
|
+
function T() {
|
|
532
627
|
u.nudge();
|
|
533
628
|
}
|
|
534
629
|
function D(e) {
|
|
535
630
|
c.setMood(e);
|
|
536
631
|
}
|
|
632
|
+
function O() {
|
|
633
|
+
l.click(a.clickImpulse);
|
|
634
|
+
}
|
|
635
|
+
function k() {
|
|
636
|
+
O(), r("click");
|
|
637
|
+
}
|
|
537
638
|
return t({
|
|
538
|
-
nudge:
|
|
639
|
+
nudge: T,
|
|
539
640
|
setMood: D,
|
|
641
|
+
pulse: O,
|
|
540
642
|
currentMood: c.currentMood
|
|
541
643
|
}), (t, n) => (y(), f("div", {
|
|
542
644
|
ref_key: "wrapperRef",
|
|
543
645
|
ref: s,
|
|
544
646
|
class: "goo-blob-wrapper",
|
|
545
647
|
style: g({ "--blob-color": e.color }),
|
|
546
|
-
onClick:
|
|
648
|
+
onClick: k
|
|
547
649
|
}, [p("canvas", {
|
|
548
650
|
ref_key: "canvasRef",
|
|
549
651
|
ref: o,
|
|
@@ -552,6 +654,6 @@ var re = /* @__PURE__ */ e(/* @__PURE__ */ m({
|
|
|
552
654
|
"data-testid": "goo-blob-canvas"
|
|
553
655
|
}, null, 512)], 4));
|
|
554
656
|
}
|
|
555
|
-
}), [["__scopeId", "data-v-
|
|
657
|
+
}), [["__scopeId", "data-v-b71203fd"]]);
|
|
556
658
|
//#endregion
|
|
557
|
-
export {
|
|
659
|
+
export { T as BLOB_CONFIG_DEFAULTS, E as BLOB_CONFIG_KEY, le as GooBlob, L as useBlobMood, R as useBlobPointer, K as useBlobSatellites, $ as useMetaballRenderer };
|