@hjmds/design-contracts 1.7.0 → 1.9.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/THIRD_PARTY_NOTICES.md +58 -0
- package/dist/affix.d.ts +8 -0
- package/dist/affix.d.ts.map +1 -0
- package/dist/affix.js +7 -0
- package/dist/affix.js.map +1 -0
- package/dist/agreement.d.ts +3 -3
- package/dist/agreement.js +1 -1
- package/dist/agreement.js.map +1 -1
- package/dist/asset.d.ts +1 -1
- package/dist/asset.js +1 -1
- package/dist/asset.js.map +1 -1
- package/dist/base-recipes.d.ts +12 -12
- package/dist/base-recipes.d.ts.map +1 -1
- package/dist/base-recipes.js +15 -14
- package/dist/base-recipes.js.map +1 -1
- package/dist/behaviors.d.ts +1 -1
- package/dist/catalog.d.ts +445 -651
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +149 -101
- package/dist/catalog.js.map +1 -1
- package/dist/color-picker.d.ts +11 -0
- package/dist/color-picker.d.ts.map +1 -0
- package/dist/color-picker.js +20 -0
- package/dist/color-picker.js.map +1 -0
- package/dist/command-palette.d.ts +3 -3
- package/dist/component-contracts.d.ts +4 -4
- package/dist/component-contracts.d.ts.map +1 -1
- package/dist/component-contracts.js +5 -4
- package/dist/component-contracts.js.map +1 -1
- package/dist/component-definitions.d.ts +1 -9
- package/dist/component-definitions.d.ts.map +1 -1
- package/dist/component-definitions.js +1 -9
- package/dist/component-definitions.js.map +1 -1
- package/dist/component-recipes.d.ts +76 -83
- package/dist/component-recipes.d.ts.map +1 -1
- package/dist/component-recipes.js +29 -49
- package/dist/component-recipes.js.map +1 -1
- package/dist/component-references.d.ts +10 -25
- package/dist/component-references.d.ts.map +1 -1
- package/dist/component-references.js +5 -8
- package/dist/component-references.js.map +1 -1
- package/dist/data-table.d.ts +3 -3
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/date-picker.d.ts +2 -2
- package/dist/icon-button-recipe.d.ts +2 -2
- package/dist/icon-button-recipe.js +1 -1
- package/dist/icon-button-recipe.js.map +1 -1
- package/dist/image.d.ts +2 -2
- package/dist/image.js +2 -2
- package/dist/image.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interaction-adapters.d.ts +53 -0
- package/dist/interaction-adapters.d.ts.map +1 -0
- package/dist/interaction-adapters.js +45 -0
- package/dist/interaction-adapters.js.map +1 -0
- package/dist/internal/thinking-orb/braid.d.ts +3 -0
- package/dist/internal/thinking-orb/braid.d.ts.map +1 -0
- package/dist/internal/thinking-orb/braid.js +47 -0
- package/dist/internal/thinking-orb/braid.js.map +1 -0
- package/dist/internal/thinking-orb/core.d.ts +60 -0
- package/dist/internal/thinking-orb/core.d.ts.map +1 -0
- package/dist/internal/thinking-orb/core.js +86 -0
- package/dist/internal/thinking-orb/core.js.map +1 -0
- package/dist/internal/thinking-orb/lattice.d.ts +5 -0
- package/dist/internal/thinking-orb/lattice.d.ts.map +1 -0
- package/dist/internal/thinking-orb/lattice.js +187 -0
- package/dist/internal/thinking-orb/lattice.js.map +1 -0
- package/dist/internal/thinking-orb/morph.d.ts +3 -0
- package/dist/internal/thinking-orb/morph.d.ts.map +1 -0
- package/dist/internal/thinking-orb/morph.js +127 -0
- package/dist/internal/thinking-orb/morph.js.map +1 -0
- package/dist/internal/thinking-orb/orbits.d.ts +3 -0
- package/dist/internal/thinking-orb/orbits.d.ts.map +1 -0
- package/dist/internal/thinking-orb/orbits.js +68 -0
- package/dist/internal/thinking-orb/orbits.js.map +1 -0
- package/dist/internal/thinking-orb/presets.d.ts +21 -0
- package/dist/internal/thinking-orb/presets.d.ts.map +1 -0
- package/dist/internal/thinking-orb/presets.js +77 -0
- package/dist/internal/thinking-orb/presets.js.map +1 -0
- package/dist/internal/thinking-orb/profiles.d.ts +8 -0
- package/dist/internal/thinking-orb/profiles.d.ts.map +1 -0
- package/dist/internal/thinking-orb/profiles.js +158 -0
- package/dist/internal/thinking-orb/profiles.js.map +1 -0
- package/dist/internal/thinking-orb/registry.d.ts +9 -0
- package/dist/internal/thinking-orb/registry.d.ts.map +1 -0
- package/dist/internal/thinking-orb/registry.js +27 -0
- package/dist/internal/thinking-orb/registry.js.map +1 -0
- package/dist/internal/thinking-orb/ribbon.d.ts +3 -0
- package/dist/internal/thinking-orb/ribbon.d.ts.map +1 -0
- package/dist/internal/thinking-orb/ribbon.js +87 -0
- package/dist/internal/thinking-orb/ribbon.js.map +1 -0
- package/dist/internal/thinking-orb/types.d.ts +15 -0
- package/dist/internal/thinking-orb/types.d.ts.map +1 -0
- package/dist/internal/thinking-orb/types.js +4 -0
- package/dist/internal/thinking-orb/types.js.map +1 -0
- package/dist/internal/thinking-orb/web.d.ts +3 -0
- package/dist/internal/thinking-orb/web.d.ts.map +1 -0
- package/dist/internal/thinking-orb/web.js +92 -0
- package/dist/internal/thinking-orb/web.js.map +1 -0
- package/dist/masonry.d.ts +17 -0
- package/dist/masonry.d.ts.map +1 -0
- package/dist/masonry.js +18 -0
- package/dist/masonry.js.map +1 -0
- package/dist/menubar.d.ts +3 -3
- package/dist/menubar.js +1 -1
- package/dist/menubar.js.map +1 -1
- package/dist/number-field.d.ts +2 -2
- package/dist/otp-field.d.ts +1 -1
- package/dist/password-field.d.ts +2 -2
- package/dist/popover.d.ts +7 -8
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +2 -0
- package/dist/popover.js.map +1 -1
- package/dist/qr-code-recipe.d.ts +7 -0
- package/dist/qr-code-recipe.d.ts.map +1 -0
- package/dist/qr-code-recipe.js +2 -0
- package/dist/qr-code-recipe.js.map +1 -0
- package/dist/qr-code.d.ts +16 -0
- package/dist/qr-code.d.ts.map +1 -0
- package/dist/qr-code.js +37 -0
- package/dist/qr-code.js.map +1 -0
- package/dist/semantic-colors.d.ts +1 -1
- package/dist/semantic-colors.js +1 -1
- package/dist/semantic-colors.js.map +1 -1
- package/dist/showcase.d.ts +5 -1
- package/dist/showcase.d.ts.map +1 -1
- package/dist/showcase.js +53 -12
- package/dist/showcase.js.map +1 -1
- package/dist/sidebar.d.ts +3 -3
- package/dist/sidebar.js +1 -1
- package/dist/sidebar.js.map +1 -1
- package/dist/tag.d.ts +4 -4
- package/dist/tag.js +3 -3
- package/dist/tag.js.map +1 -1
- package/dist/tags-input.d.ts +3 -3
- package/dist/tags-input.js +1 -1
- package/dist/tags-input.js.map +1 -1
- package/dist/text-formats.d.ts +2 -2
- package/dist/text-formats.js +2 -2
- package/dist/text-formats.js.map +1 -1
- package/dist/thinking-orb-recipe.d.ts +15 -0
- package/dist/thinking-orb-recipe.d.ts.map +1 -0
- package/dist/thinking-orb-recipe.js +9 -0
- package/dist/thinking-orb-recipe.js.map +1 -0
- package/dist/thinking-orb.d.ts +25 -0
- package/dist/thinking-orb.d.ts.map +1 -0
- package/dist/thinking-orb.js +40 -0
- package/dist/thinking-orb.js.map +1 -0
- package/dist/toast-liquid.d.ts +116 -0
- package/dist/toast-liquid.d.ts.map +1 -0
- package/dist/toast-liquid.js +103 -0
- package/dist/toast-liquid.js.map +1 -0
- package/dist/toast.d.ts +7 -1
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +5 -0
- package/dist/toast.js.map +1 -1
- package/dist/toggle-group.d.ts +2 -2
- package/dist/toggle-group.js +3 -3
- package/dist/toggle-group.js.map +1 -1
- package/dist/transfer-list.d.ts +3 -3
- package/dist/transfer-list.js +1 -1
- package/dist/transfer-list.js.map +1 -1
- package/dist/tree.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/virtual-list.d.ts +13 -0
- package/dist/virtual-list.d.ts.map +1 -0
- package/dist/virtual-list.js +13 -0
- package/dist/virtual-list.js.map +1 -0
- package/dist/watermark.d.ts +15 -0
- package/dist/watermark.d.ts.map +1 -0
- package/dist/watermark.js +11 -0
- package/dist/watermark.js.map +1 -0
- package/docs/affix.md +27 -63
- package/docs/anchor.md +5 -4
- package/docs/ant-design-coverage.md +8 -12
- package/docs/architecture.md +6 -2
- package/docs/authoring-brief.md +3 -2
- package/docs/bottom-navigation.md +7 -6
- package/docs/breadcrumb.md +5 -2
- package/docs/calendar.md +6 -3
- package/docs/carousel.md +2 -2
- package/docs/cascader.md +11 -0
- package/docs/catalog-cleanup.md +7 -0
- package/docs/catalog-decision-status.md +8 -3
- package/docs/catalog-freeze.json +9 -7
- package/docs/collapsible.md +12 -0
- package/docs/color-picker.md +30 -72
- package/docs/command-palette.md +5 -3
- package/docs/confirm-popover.md +5 -0
- package/docs/consumer-policy.md +29 -12
- package/docs/context-menu.md +12 -2
- package/docs/data-table.md +11 -6
- package/docs/date-picker.md +6 -4
- package/docs/date-range.md +4 -2
- package/docs/description-list.md +8 -9
- package/docs/dialog.md +39 -0
- package/docs/expansion-roadmap.md +11 -7
- package/docs/file-picker.md +5 -3
- package/docs/form.md +16 -4
- package/docs/generated/component-maturity.md +91 -99
- package/docs/generated/renderer-evidence.json +2043 -1059
- package/docs/generated/renderer-evidence.md +156 -145
- package/docs/generated/showcase-manifest.json +476 -625
- package/docs/layout.md +8 -9
- package/docs/library-gap-analysis.md +1 -1
- package/docs/masonry.md +11 -0
- package/docs/mentions.md +14 -7
- package/docs/optional-adapters.md +126 -0
- package/docs/otp-field.md +2 -1
- package/docs/pagination.md +4 -1
- package/docs/password-field.md +2 -1
- package/docs/popover.md +9 -6
- package/docs/promotion-candidates.md +2 -1
- package/docs/qr-code.md +11 -65
- package/docs/rating.md +5 -0
- package/docs/react-native-completion.md +1 -1
- package/docs/result.md +8 -5
- package/docs/screen-chrome.md +2 -1
- package/docs/sheet.md +8 -2
- package/docs/showcase.md +10 -2
- package/docs/side-panel.md +12 -6
- package/docs/sidebar.md +3 -0
- package/docs/splitter.md +6 -6
- package/docs/stable-core.md +92 -0
- package/docs/stable-promotion.md +47 -43
- package/docs/tags-input.md +5 -2
- package/docs/theme-palette.md +27 -0
- package/docs/thinking-orb.md +124 -0
- package/docs/time-picker.md +5 -0
- package/docs/timeline.md +2 -3
- package/docs/toast.md +6 -0
- package/docs/tooltip.md +2 -1
- package/docs/tour.md +14 -8
- package/docs/transfer-list.md +24 -21
- package/docs/tree-select.md +7 -1
- package/docs/tree.md +12 -7
- package/docs/upload-item.md +7 -3
- package/docs/virtual-list.md +10 -67
- package/docs/watermark.md +26 -58
- package/package.json +54 -3
- package/docs/app-provider.md +0 -50
- package/docs/border-beam.md +0 -66
- package/docs/chart.md +0 -33
- package/docs/utility.md +0 -53
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Indexed reads are bounded by the populated array length or modulo; assertions preserve upstream geometry.
|
|
2
|
+
// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.
|
|
3
|
+
// The sphere-lattice modes: globe (searching), rubik (solving) and
|
|
4
|
+
// wave (listening). All draw a lat/long dot field with mode-specific
|
|
5
|
+
// motion, then hand off to the shared z-sorted painter.
|
|
6
|
+
import { angleDelta, finalizeFrame, hashD, makeProj, radiusScale } from './core.js';
|
|
7
|
+
function solveCycle(time, count, slotDur, rest) {
|
|
8
|
+
const cyc = 2 * count * slotDur + rest;
|
|
9
|
+
const tc = time % cyc;
|
|
10
|
+
const amount = new Array(count).fill(0);
|
|
11
|
+
let active = -1;
|
|
12
|
+
if (tc < 2 * count * slotDur) {
|
|
13
|
+
const slot = Math.floor(tc / slotDur);
|
|
14
|
+
const p = (tc - slot * slotDur) / slotDur;
|
|
15
|
+
const cl = Math.min(1, p / 0.7);
|
|
16
|
+
const ep = 1 - (1 - cl) ** 3; // machine ease-out
|
|
17
|
+
if (slot < count) {
|
|
18
|
+
for (let i = 0; i < slot; i++)
|
|
19
|
+
amount[i] = 1;
|
|
20
|
+
amount[slot] = ep;
|
|
21
|
+
active = slot;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
const u = 2 * count - 1 - slot;
|
|
25
|
+
for (let i = 0; i < u; i++)
|
|
26
|
+
amount[i] = 1;
|
|
27
|
+
amount[u] = 1 - ep;
|
|
28
|
+
active = u;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return { amount, active };
|
|
32
|
+
}
|
|
33
|
+
function applyMoves(pt3, moves, sc) {
|
|
34
|
+
let [x, y, z] = pt3;
|
|
35
|
+
let inActive = false;
|
|
36
|
+
for (let i = 0; i < moves.length; i++) {
|
|
37
|
+
if (sc.amount[i] <= 0)
|
|
38
|
+
continue;
|
|
39
|
+
const mv = moves[i];
|
|
40
|
+
const coord = mv.axis === 0 ? x : mv.axis === 1 ? y : z;
|
|
41
|
+
if (coord < mv.lo || coord >= mv.hi)
|
|
42
|
+
continue;
|
|
43
|
+
if (i === sc.active)
|
|
44
|
+
inActive = true;
|
|
45
|
+
const a = mv.ang * sc.amount[i];
|
|
46
|
+
const ca = Math.cos(a);
|
|
47
|
+
const sa = Math.sin(a);
|
|
48
|
+
if (mv.axis === 0) {
|
|
49
|
+
const y2 = y * ca - z * sa;
|
|
50
|
+
z = y * sa + z * ca;
|
|
51
|
+
y = y2;
|
|
52
|
+
}
|
|
53
|
+
else if (mv.axis === 1) {
|
|
54
|
+
const x2 = x * ca + z * sa;
|
|
55
|
+
z = -x * sa + z * ca;
|
|
56
|
+
x = x2;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const x2 = x * ca - y * sa;
|
|
60
|
+
y = x * sa + y * ca;
|
|
61
|
+
x = x2;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return [x, y, z, inActive];
|
|
65
|
+
}
|
|
66
|
+
function makeMoves(count) {
|
|
67
|
+
const moves = [];
|
|
68
|
+
for (let i = 0; i < count; i++) {
|
|
69
|
+
const axis = Math.min(2, Math.floor(hashD(i, 2.3) * 3));
|
|
70
|
+
const lo = -1.0 + 0.5 * Math.min(3, Math.floor(hashD(i, 5.9) * 4));
|
|
71
|
+
const dir = hashD(i, 7.7) < 0.5 ? 1 : -1;
|
|
72
|
+
moves.push({ axis, lo, hi: lo + 0.5, ang: (dir * Math.PI) / 2 });
|
|
73
|
+
}
|
|
74
|
+
return moves;
|
|
75
|
+
}
|
|
76
|
+
// --- Globe: lat/long field, a scan meridian sweeps — searching --------
|
|
77
|
+
export const frameGlobe = (size, t, o) => {
|
|
78
|
+
const spin = 0.5;
|
|
79
|
+
const cx = size / 2;
|
|
80
|
+
const cy = size / 2;
|
|
81
|
+
const radius = (size / 2) * 0.82;
|
|
82
|
+
const tilt = 0.4 + 0.06 * Math.sin(t * 0.35);
|
|
83
|
+
const pt = makeProj(t * spin, tilt, cx, cy, radius);
|
|
84
|
+
// scan sweeps relative to the spin; scanMul scales that relative rate
|
|
85
|
+
const scan = t * (spin + (1.7 - spin) * (o.scanMul ?? 1));
|
|
86
|
+
const rs = radiusScale(size, o.rsPow ?? 0.6);
|
|
87
|
+
const dimBase = o.dimBase ?? 1;
|
|
88
|
+
const dots = [];
|
|
89
|
+
const latRings = o.latRings ?? 17;
|
|
90
|
+
const lonDensity = o.lonDensity ?? 44;
|
|
91
|
+
for (let li = 0; li <= latRings; li++) {
|
|
92
|
+
const lat = -Math.PI / 2 + (li / latRings) * Math.PI;
|
|
93
|
+
const cosLat = Math.cos(lat);
|
|
94
|
+
const sinLat = Math.sin(lat);
|
|
95
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
96
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
97
|
+
const lon = (lj / lonCount) * 2 * Math.PI;
|
|
98
|
+
const [px, py, z] = pt(cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon));
|
|
99
|
+
const depth = (z + 1) / 2;
|
|
100
|
+
// the scan: a moving meridian read as a size ripple, not a shine
|
|
101
|
+
const d = angleDelta(lon + t * spin, scan);
|
|
102
|
+
const boost = Math.exp(-(d * d) / 0.18) * Math.max(0, z);
|
|
103
|
+
dots.push({
|
|
104
|
+
x: px,
|
|
105
|
+
y: py,
|
|
106
|
+
z,
|
|
107
|
+
r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth + (o.rBoost ?? 1) * boost) * rs,
|
|
108
|
+
white: (o.inkFar ?? 0.62) - (o.inkSpan ?? 0.54) * depth,
|
|
109
|
+
// dimBase < 1 fades un-scanned dots so the meridian reads clearly
|
|
110
|
+
a: dimBase + (1 - dimBase) * Math.min(1, boost)
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return finalizeFrame(dots, [], o.rMin);
|
|
115
|
+
};
|
|
116
|
+
// --- Rubik: bands twist in quarter turns, scramble → solve — solving --
|
|
117
|
+
export const frameRubik = (size, t, o) => {
|
|
118
|
+
const cx = size / 2;
|
|
119
|
+
const cy = size / 2;
|
|
120
|
+
const R = (size / 2) * 0.82;
|
|
121
|
+
const pt = makeProj(t * 0.55, 0.35 + 0.1 * Math.sin(t * 0.9), cx, cy, R);
|
|
122
|
+
const rs = radiusScale(size, o.rsPow ?? 0.6);
|
|
123
|
+
const moveCount = o.moveCount ?? 14;
|
|
124
|
+
const moves = makeMoves(moveCount);
|
|
125
|
+
const sc = solveCycle(t, moveCount, 0.42, 1.2);
|
|
126
|
+
const dots = [];
|
|
127
|
+
const latRings = o.latRings ?? 15;
|
|
128
|
+
const lonDensity = o.lonDensity ?? 40;
|
|
129
|
+
for (let li = 0; li <= latRings; li++) {
|
|
130
|
+
const lat = -Math.PI / 2 + (li / latRings) * Math.PI;
|
|
131
|
+
const cosLat = Math.cos(lat);
|
|
132
|
+
const sinLat = Math.sin(lat);
|
|
133
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
134
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
135
|
+
const lon = (lj / lonCount) * 2 * Math.PI;
|
|
136
|
+
const [x, y, z, inActive] = applyMoves([cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon)], moves, sc);
|
|
137
|
+
const [px, py, zr] = pt(x, y, z);
|
|
138
|
+
const depth = (zr + 1) / 2;
|
|
139
|
+
// the band being turned inks a touch darker — the "hand"
|
|
140
|
+
dots.push({
|
|
141
|
+
x: px,
|
|
142
|
+
y: py,
|
|
143
|
+
z: zr,
|
|
144
|
+
r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth + (inActive ? (o.rActive ?? 0.3) : 0)) * rs,
|
|
145
|
+
white: (o.inkFar ?? 0.62) - (o.inkSpan ?? 0.54) * depth - (inActive ? 0.14 : 0)
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return finalizeFrame(dots, [], o.rMin);
|
|
150
|
+
};
|
|
151
|
+
// --- Wave: a waveform rolls through the rings — listening -------------
|
|
152
|
+
export const frameWave = (size, t, o) => {
|
|
153
|
+
const cx = size / 2;
|
|
154
|
+
const cy = size / 2;
|
|
155
|
+
// 0.76 base × 1.15 — the undulation pulls the sphere inward, so wave read
|
|
156
|
+
// ~15% smaller than the other lattice modes; scaled up to match them
|
|
157
|
+
const R = (size / 2) * 0.874;
|
|
158
|
+
const pt = makeProj(t * 0.18, 0.38, cx, cy, 1);
|
|
159
|
+
const rs = radiusScale(size, o.rsPow ?? 0.6);
|
|
160
|
+
const dots = [];
|
|
161
|
+
const rings = o.rings ?? 15;
|
|
162
|
+
const lonDensity = o.lonDensity ?? 40;
|
|
163
|
+
for (let ri = 0; ri <= rings; ri++) {
|
|
164
|
+
const lat = -Math.PI / 2 + (ri / rings) * Math.PI;
|
|
165
|
+
const cosLat = Math.cos(lat);
|
|
166
|
+
const sinLat = Math.sin(lat);
|
|
167
|
+
// two waves, different tempi — organic, never quite repeating
|
|
168
|
+
const w = 0.62 * Math.sin(t * 2.1 - ri * 0.52) + 0.38 * Math.sin(t * 1.27 + ri * 0.83);
|
|
169
|
+
const rr = R * (0.88 + 0.105 * w);
|
|
170
|
+
const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));
|
|
171
|
+
for (let lj = 0; lj < lonCount; lj++) {
|
|
172
|
+
const lon = (lj / lonCount) * 2 * Math.PI;
|
|
173
|
+
const [px, py, z] = pt(cosLat * Math.cos(lon) * rr, sinLat * rr, cosLat * Math.sin(lon) * rr);
|
|
174
|
+
const depth = (z / R + 1) / 2;
|
|
175
|
+
const crest = Math.max(0, w);
|
|
176
|
+
dots.push({
|
|
177
|
+
x: px,
|
|
178
|
+
y: py,
|
|
179
|
+
z,
|
|
180
|
+
r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth) * (1 + 0.4 * crest) * rs,
|
|
181
|
+
white: 0.66 - 0.56 * depth - 0.1 * crest
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return finalizeFrame(dots, [], o.rMin);
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=lattice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lattice.js","sourceRoot":"","sources":["../../../src/internal/thinking-orb/lattice.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,wEAAwE;AACxE,mEAAmE;AACnE,qEAAqE;AACrE,wDAAwD;AAGxD,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAapF,SAAS,UAAU,CAAC,IAAY,EAAE,KAAa,EAAE,OAAe,EAAE,IAAY;IAC5E,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC;IACvC,MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,CAAC;IACtB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAS,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChD,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,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AC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAC9B,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC;gBACR,CAAC,EAAE,EAAE;gBACL,CAAC,EAAE,EAAE;gBACL,CAAC;gBACD,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE;gBAC1E,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK;aACzC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["// Indexed reads are bounded by the populated array length or modulo; assertions preserve upstream geometry.\n// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.\n// The sphere-lattice modes: globe (searching), rubik (solving) and\n// wave (listening). All draw a lat/long dot field with mode-specific\n// motion, then hand off to the shared z-sorted painter.\n\nimport type { Dot, ModeFrame } from './types.js';\nimport { angleDelta, finalizeFrame, hashD, makeProj, radiusScale } from './core.js';\n\n// --- the shared solver heartbeat (rubik) ------------------------------\n// Rapid eased moves scramble, then replay in reverse (palindrome) so\n// everything clicks back to solved, rests, repeats.\n\ninterface Move {\n axis: 0 | 1 | 2;\n lo: number;\n hi: number;\n ang: number;\n}\n\nfunction solveCycle(time: number, count: number, slotDur: number, rest: number) {\n const cyc = 2 * count * slotDur + rest;\n const tc = time % cyc;\n const amount = new Array<number>(count).fill(0);\n let active = -1;\n if (tc < 2 * count * slotDur) {\n const slot = Math.floor(tc / slotDur);\n const p = (tc - slot * slotDur) / slotDur;\n const cl = Math.min(1, p / 0.7);\n const ep = 1 - (1 - cl) ** 3; // machine ease-out\n if (slot < count) {\n for (let i = 0; i < slot; i++) amount[i] = 1;\n amount[slot] = ep;\n active = slot;\n } else {\n const u = 2 * count - 1 - slot;\n for (let i = 0; i < u; i++) amount[i] = 1;\n amount[u] = 1 - ep;\n active = u;\n }\n }\n return { amount, active };\n}\n\nfunction applyMoves(\n pt3: [number, number, number],\n moves: Move[],\n sc: { amount: number[]; active: number }\n): [number, number, number, boolean] {\n let [x, y, z] = pt3;\n let inActive = false;\n for (let i = 0; i < moves.length; i++) {\n if (sc.amount[i]! <= 0) continue;\n const mv = moves[i]!;\n const coord = mv.axis === 0 ? x : mv.axis === 1 ? y : z;\n if (coord < mv.lo || coord >= mv.hi) continue;\n if (i === sc.active) inActive = true;\n const a = mv.ang * sc.amount[i]!;\n const ca = Math.cos(a);\n const sa = Math.sin(a);\n if (mv.axis === 0) {\n const y2 = y * ca - z * sa;\n z = y * sa + z * ca;\n y = y2;\n } else if (mv.axis === 1) {\n const x2 = x * ca + z * sa;\n z = -x * sa + z * ca;\n x = x2;\n } else {\n const x2 = x * ca - y * sa;\n y = x * sa + y * ca;\n x = x2;\n }\n }\n return [x, y, z, inActive];\n}\n\nfunction makeMoves(count: number): Move[] {\n const moves: Move[] = [];\n for (let i = 0; i < count; i++) {\n const axis = Math.min(2, Math.floor(hashD(i, 2.3) * 3)) as 0 | 1 | 2;\n const lo = -1.0 + 0.5 * Math.min(3, Math.floor(hashD(i, 5.9) * 4));\n const dir = hashD(i, 7.7) < 0.5 ? 1 : -1;\n moves.push({ axis, lo, hi: lo + 0.5, ang: (dir * Math.PI) / 2 });\n }\n return moves;\n}\n\n// --- Globe: lat/long field, a scan meridian sweeps — searching --------\n\nexport const frameGlobe: ModeFrame = (size, t, o) => {\n const spin = 0.5;\n const cx = size / 2;\n const cy = size / 2;\n const radius = (size / 2) * 0.82;\n const tilt = 0.4 + 0.06 * Math.sin(t * 0.35);\n const pt = makeProj(t * spin, tilt, cx, cy, radius);\n // scan sweeps relative to the spin; scanMul scales that relative rate\n const scan = t * (spin + (1.7 - spin) * (o.scanMul ?? 1));\n const rs = radiusScale(size, o.rsPow ?? 0.6);\n const dimBase = o.dimBase ?? 1;\n\n const dots: Dot[] = [];\n const latRings = o.latRings ?? 17;\n const lonDensity = o.lonDensity ?? 44;\n for (let li = 0; li <= latRings; li++) {\n const lat = -Math.PI / 2 + (li / latRings) * Math.PI;\n const cosLat = Math.cos(lat);\n const sinLat = Math.sin(lat);\n const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));\n for (let lj = 0; lj < lonCount; lj++) {\n const lon = (lj / lonCount) * 2 * Math.PI;\n const [px, py, z] = pt(cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon));\n const depth = (z + 1) / 2;\n // the scan: a moving meridian read as a size ripple, not a shine\n const d = angleDelta(lon + t * spin, scan);\n const boost = Math.exp(-(d * d) / 0.18) * Math.max(0, z);\n dots.push({\n x: px,\n y: py,\n z,\n r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth + (o.rBoost ?? 1) * boost) * rs,\n white: (o.inkFar ?? 0.62) - (o.inkSpan ?? 0.54) * depth,\n // dimBase < 1 fades un-scanned dots so the meridian reads clearly\n a: dimBase + (1 - dimBase) * Math.min(1, boost)\n });\n }\n }\n return finalizeFrame(dots, [], o.rMin);\n};\n\n// --- Rubik: bands twist in quarter turns, scramble → solve — solving --\n\nexport const frameRubik: ModeFrame = (size, t, o) => {\n const cx = size / 2;\n const cy = size / 2;\n const R = (size / 2) * 0.82;\n const pt = makeProj(t * 0.55, 0.35 + 0.1 * Math.sin(t * 0.9), cx, cy, R);\n const rs = radiusScale(size, o.rsPow ?? 0.6);\n const moveCount = o.moveCount ?? 14;\n const moves = makeMoves(moveCount);\n const sc = solveCycle(t, moveCount, 0.42, 1.2);\n\n const dots: Dot[] = [];\n const latRings = o.latRings ?? 15;\n const lonDensity = o.lonDensity ?? 40;\n for (let li = 0; li <= latRings; li++) {\n const lat = -Math.PI / 2 + (li / latRings) * Math.PI;\n const cosLat = Math.cos(lat);\n const sinLat = Math.sin(lat);\n const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));\n for (let lj = 0; lj < lonCount; lj++) {\n const lon = (lj / lonCount) * 2 * Math.PI;\n const [x, y, z, inActive] = applyMoves([cosLat * Math.cos(lon), sinLat, cosLat * Math.sin(lon)], moves, sc);\n const [px, py, zr] = pt(x, y, z);\n const depth = (zr + 1) / 2;\n // the band being turned inks a touch darker — the \"hand\"\n dots.push({\n x: px,\n y: py,\n z: zr,\n r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth + (inActive ? (o.rActive ?? 0.3) : 0)) * rs,\n white: (o.inkFar ?? 0.62) - (o.inkSpan ?? 0.54) * depth - (inActive ? 0.14 : 0)\n });\n }\n }\n return finalizeFrame(dots, [], o.rMin);\n};\n\n// --- Wave: a waveform rolls through the rings — listening -------------\n\nexport const frameWave: ModeFrame = (size, t, o) => {\n const cx = size / 2;\n const cy = size / 2;\n // 0.76 base × 1.15 — the undulation pulls the sphere inward, so wave read\n // ~15% smaller than the other lattice modes; scaled up to match them\n const R = (size / 2) * 0.874;\n const pt = makeProj(t * 0.18, 0.38, cx, cy, 1);\n const rs = radiusScale(size, o.rsPow ?? 0.6);\n\n const dots: Dot[] = [];\n const rings = o.rings ?? 15;\n const lonDensity = o.lonDensity ?? 40;\n for (let ri = 0; ri <= rings; ri++) {\n const lat = -Math.PI / 2 + (ri / rings) * Math.PI;\n const cosLat = Math.cos(lat);\n const sinLat = Math.sin(lat);\n // two waves, different tempi — organic, never quite repeating\n const w = 0.62 * Math.sin(t * 2.1 - ri * 0.52) + 0.38 * Math.sin(t * 1.27 + ri * 0.83);\n const rr = R * (0.88 + 0.105 * w);\n const lonCount = Math.max(1, Math.round(Math.abs(cosLat) * lonDensity));\n for (let lj = 0; lj < lonCount; lj++) {\n const lon = (lj / lonCount) * 2 * Math.PI;\n const [px, py, z] = pt(cosLat * Math.cos(lon) * rr, sinLat * rr, cosLat * Math.sin(lon) * rr);\n const depth = (z / R + 1) / 2;\n const crest = Math.max(0, w);\n dots.push({\n x: px,\n y: py,\n z,\n r: ((o.rBase ?? 0.6) + (o.rDepth ?? 1.7) * depth) * (1 + 0.4 * crest) * rs,\n white: 0.66 - 0.56 * depth - 0.1 * crest\n });\n }\n }\n return finalizeFrame(dots, [], o.rMin);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../src/internal/thinking-orb/morph.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,YAAY,CAAC;AAsEjD,eAAO,MAAM,UAAU,EAAE,SA2DxB,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Indexed reads are bounded by the populated array length or modulo; assertions preserve upstream geometry.
|
|
2
|
+
// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.
|
|
3
|
+
// Morph: a dotted outline cycling circle → triangle → square → circle —
|
|
4
|
+
// the "shaping" state. Each shape is a continuous closed path
|
|
5
|
+
// parameterised by arc length (top-centre start, clockwise). Every
|
|
6
|
+
// frame the engine blends the two neighbouring paths, then lays the
|
|
7
|
+
// dots EVENLY along the blended outline — spacing stays uniform at
|
|
8
|
+
// every instant of the morph, holds and transitions alike. Plain
|
|
9
|
+
// circle fills only: no canvas/SVG filters, fully cross-browser.
|
|
10
|
+
import { finalizeFrame } from './core.js';
|
|
11
|
+
function smoothE(x) {
|
|
12
|
+
return x * x * (3 - 2 * x);
|
|
13
|
+
}
|
|
14
|
+
function polyPath(verts) {
|
|
15
|
+
const V = verts.length;
|
|
16
|
+
const L = [];
|
|
17
|
+
let total = 0;
|
|
18
|
+
for (let i = 0; i < V; i++) {
|
|
19
|
+
const a = verts[i];
|
|
20
|
+
const b = verts[(i + 1) % V];
|
|
21
|
+
const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
22
|
+
L.push(l);
|
|
23
|
+
total += l;
|
|
24
|
+
}
|
|
25
|
+
return (f) => {
|
|
26
|
+
let target = f * total;
|
|
27
|
+
let i = 0;
|
|
28
|
+
while (target > L[i] && i < V - 1) {
|
|
29
|
+
target -= L[i];
|
|
30
|
+
i++;
|
|
31
|
+
}
|
|
32
|
+
const a = verts[i];
|
|
33
|
+
const b = verts[(i + 1) % V];
|
|
34
|
+
const ff = L[i] ? Math.min(1, target / L[i]) : 0;
|
|
35
|
+
return [a[0] + (b[0] - a[0]) * ff, a[1] + (b[1] - a[1]) * ff];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const CIRCLE = (f) => {
|
|
39
|
+
const a = -Math.PI / 2 + f * 2 * Math.PI;
|
|
40
|
+
return [Math.cos(a) * 0.24, Math.sin(a) * 0.24];
|
|
41
|
+
};
|
|
42
|
+
const TRIANGLE = polyPath([
|
|
43
|
+
[0.0, -0.26],
|
|
44
|
+
[0.24, 0.16],
|
|
45
|
+
[-0.24, 0.16]
|
|
46
|
+
]);
|
|
47
|
+
// 5-vertex walk so the path STARTS at top-centre like the other shapes
|
|
48
|
+
const SQUARE = polyPath([
|
|
49
|
+
[0, -0.2],
|
|
50
|
+
[0.2, -0.2],
|
|
51
|
+
[0.2, 0.2],
|
|
52
|
+
[-0.2, 0.2],
|
|
53
|
+
[-0.2, -0.2]
|
|
54
|
+
]);
|
|
55
|
+
const CYCLE = [CIRCLE, TRIANGLE, SQUARE];
|
|
56
|
+
// low floor keeps sparse outlines possible while never degenerating
|
|
57
|
+
function morphN(d) {
|
|
58
|
+
return Math.max(6, Math.round(34 * d));
|
|
59
|
+
}
|
|
60
|
+
const HOLD = 1.4;
|
|
61
|
+
const MORPH = 0.9;
|
|
62
|
+
const SEG = HOLD + MORPH;
|
|
63
|
+
// This state was tuned in inkform, which paints it through a blur +
|
|
64
|
+
// threshold "goo" filter; we draw plain circles instead, since `ctx.filter`
|
|
65
|
+
// and SVG filter refs are not safe to rely on across Chrome / Safari /
|
|
66
|
+
// Firefox. The dot GEOMETRY is identical either way — the threshold just
|
|
67
|
+
// yields a hard edge where a plain fill has an antialiased one, so these
|
|
68
|
+
// dots read a touch softer than inkform's. Don't "correct" for that by
|
|
69
|
+
// shrinking the radius: it makes the mark genuinely smaller than the tuning.
|
|
70
|
+
export const frameMorph = (size, t, o) => {
|
|
71
|
+
const K = CYCLE.length;
|
|
72
|
+
const tc = t % (SEG * K);
|
|
73
|
+
const k = Math.floor(tc / SEG);
|
|
74
|
+
const local = tc - k * SEG;
|
|
75
|
+
const m = local > HOLD ? smoothE((local - HOLD) / MORPH) : 0;
|
|
76
|
+
const sprd = o.spread ?? 1;
|
|
77
|
+
// blend the two shape PATHS at m, then measure the blended outline
|
|
78
|
+
const pA = CYCLE[k];
|
|
79
|
+
const pB = CYCLE[(k + 1) % K];
|
|
80
|
+
const M = 160;
|
|
81
|
+
const pts = [];
|
|
82
|
+
for (let i = 0; i < M; i++) {
|
|
83
|
+
const f = i / M;
|
|
84
|
+
const a = pA(f);
|
|
85
|
+
const b = pB(f);
|
|
86
|
+
pts.push([(a[0] + (b[0] - a[0]) * m) * sprd, (a[1] + (b[1] - a[1]) * m) * sprd]);
|
|
87
|
+
}
|
|
88
|
+
const L = [];
|
|
89
|
+
let total = 0;
|
|
90
|
+
for (let i = 0; i < M; i++) {
|
|
91
|
+
const a = pts[i];
|
|
92
|
+
const b = pts[(i + 1) % M];
|
|
93
|
+
const l = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
94
|
+
L.push(l);
|
|
95
|
+
total += l;
|
|
96
|
+
}
|
|
97
|
+
// dot radius depends ONLY on rDot (the size knob); the count sets the
|
|
98
|
+
// gaps. Formed shapes breathe a little (uniform pulse).
|
|
99
|
+
const n = morphN(o.iconD ?? 1);
|
|
100
|
+
const re = (o.rDot ?? 0.021) * 1.35 * sprd;
|
|
101
|
+
const pulse = 1 + 0.02 * Math.sin(local * 3.1);
|
|
102
|
+
const dots = [];
|
|
103
|
+
const c2 = size / 2;
|
|
104
|
+
let seg = 0;
|
|
105
|
+
let acc = 0;
|
|
106
|
+
for (let k2 = 0; k2 < n; k2++) {
|
|
107
|
+
const target = (k2 / n) * total;
|
|
108
|
+
while (acc + L[seg] < target && seg < M - 1) {
|
|
109
|
+
acc += L[seg];
|
|
110
|
+
seg++;
|
|
111
|
+
}
|
|
112
|
+
const a = pts[seg];
|
|
113
|
+
const b = pts[(seg + 1) % M];
|
|
114
|
+
const f = L[seg] ? Math.min(1, (target - acc) / L[seg]) : 0;
|
|
115
|
+
const x = (a[0] + (b[0] - a[0]) * f) * pulse;
|
|
116
|
+
const y = (a[1] + (b[1] - a[1]) * f) * pulse;
|
|
117
|
+
dots.push({
|
|
118
|
+
x: c2 + x * size,
|
|
119
|
+
y: c2 + y * size,
|
|
120
|
+
z: 0,
|
|
121
|
+
r: Math.max(0.35, re * size),
|
|
122
|
+
white: 0.1
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return finalizeFrame(dots, [], o.rMin);
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=morph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../src/internal/thinking-orb/morph.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,wEAAwE;AACxE,wEAAwE;AACxE,8DAA8D;AAC9D,mEAAmE;AACnE,oEAAoE;AACpE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,QAAQ,CAAC,KAA+C;IAC/D,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,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C;YACR,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI;YAChB,CAAC,EAAE,EAAE,GAAG,CAAC,GAAG,IAAI;YAChB,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC;YAC5B,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;IACL,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["// Indexed reads are bounded by the populated array length or modulo; assertions preserve upstream geometry.\n// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.\n// Morph: a dotted outline cycling circle → triangle → square → circle —\n// the \"shaping\" state. Each shape is a continuous closed path\n// parameterised by arc length (top-centre start, clockwise). Every\n// frame the engine blends the two neighbouring paths, then lays the\n// dots EVENLY along the blended outline — spacing stays uniform at\n// every instant of the morph, holds and transitions alike. Plain\n// circle fills only: no canvas/SVG filters, fully cross-browser.\n\nimport type { Dot, ModeFrame } from './types.js';\nimport { finalizeFrame } from './core.js';\n\ntype Path = (f: number) => [number, number];\n\nfunction smoothE(x: number): number {\n return x * x * (3 - 2 * x);\n}\n\nfunction polyPath(verts: ReadonlyArray<readonly [number, number]>): Path {\n const V = verts.length;\n const L: number[] = [];\n let total = 0;\n for (let i = 0; i < V; i++) {\n const a = verts[i]!;\n const b = verts[(i + 1) % V]!;\n const l = Math.hypot(b[0] - a[0], b[1] - a[1]);\n L.push(l);\n total += l;\n }\n return (f) => {\n let target = f * total;\n let i = 0;\n while (target > L[i]! && i < V - 1) {\n target -= L[i]!;\n i++;\n }\n const a = verts[i]!;\n const b = verts[(i + 1) % V]!;\n const ff = L[i]! ? Math.min(1, target / L[i]!) : 0;\n return [a[0] + (b[0] - a[0]) * ff, a[1] + (b[1] - a[1]) * ff];\n };\n}\n\nconst CIRCLE: Path = (f) => {\n const a = -Math.PI / 2 + f * 2 * Math.PI;\n return [Math.cos(a) * 0.24, Math.sin(a) * 0.24];\n};\nconst TRIANGLE = polyPath([\n [0.0, -0.26],\n [0.24, 0.16],\n [-0.24, 0.16]\n]);\n// 5-vertex walk so the path STARTS at top-centre like the other shapes\nconst SQUARE = polyPath([\n [0, -0.2],\n [0.2, -0.2],\n [0.2, 0.2],\n [-0.2, 0.2],\n [-0.2, -0.2]\n]);\nconst CYCLE: Path[] = [CIRCLE, TRIANGLE, SQUARE];\n\n// low floor keeps sparse outlines possible while never degenerating\nfunction morphN(d: number): number {\n return Math.max(6, Math.round(34 * d));\n}\n\nconst HOLD = 1.4;\nconst MORPH = 0.9;\nconst SEG = HOLD + MORPH;\n\n// This state was tuned in inkform, which paints it through a blur +\n// threshold \"goo\" filter; we draw plain circles instead, since `ctx.filter`\n// and SVG filter refs are not safe to rely on across Chrome / Safari /\n// Firefox. The dot GEOMETRY is identical either way — the threshold just\n// yields a hard edge where a plain fill has an antialiased one, so these\n// dots read a touch softer than inkform's. Don't \"correct\" for that by\n// shrinking the radius: it makes the mark genuinely smaller than the tuning.\n\nexport const frameMorph: ModeFrame = (size, t, o) => {\n const K = CYCLE.length;\n const tc = t % (SEG * K);\n const k = Math.floor(tc / SEG);\n const local = tc - k * SEG;\n const m = local > HOLD ? smoothE((local - HOLD) / MORPH) : 0;\n const sprd = o.spread ?? 1;\n\n // blend the two shape PATHS at m, then measure the blended outline\n const pA = CYCLE[k]!;\n const pB = CYCLE[(k + 1) % K]!;\n const M = 160;\n const pts: Array<[number, number]> = [];\n for (let i = 0; i < M; i++) {\n const f = i / M;\n const a = pA(f);\n const b = pB(f);\n pts.push([(a[0] + (b[0] - a[0]) * m) * sprd, (a[1] + (b[1] - a[1]) * m) * sprd]);\n }\n const L: number[] = [];\n let total = 0;\n for (let i = 0; i < M; i++) {\n const a = pts[i]!;\n const b = pts[(i + 1) % M]!;\n const l = Math.hypot(b[0] - a[0], b[1] - a[1]);\n L.push(l);\n total += l;\n }\n\n // dot radius depends ONLY on rDot (the size knob); the count sets the\n // gaps. Formed shapes breathe a little (uniform pulse).\n const n = morphN(o.iconD ?? 1);\n const re = (o.rDot ?? 0.021) * 1.35 * sprd;\n const pulse = 1 + 0.02 * Math.sin(local * 3.1);\n\n const dots: Dot[] = [];\n const c2 = size / 2;\n let seg = 0;\n let acc = 0;\n for (let k2 = 0; k2 < n; k2++) {\n const target = (k2 / n) * total;\n while (acc + L[seg]! < target && seg < M - 1) {\n acc += L[seg]!;\n seg++;\n }\n const a = pts[seg]!;\n const b = pts[(seg + 1) % M]!;\n const f = L[seg]! ? Math.min(1, (target - acc) / L[seg]!) : 0;\n const x = (a[0] + (b[0] - a[0]) * f) * pulse;\n const y = (a[1] + (b[1] - a[1]) * f) * pulse;\n dots.push({\n x: c2 + x * size,\n y: c2 + y * size,\n z: 0,\n r: Math.max(0.35, re * size),\n white: 0.1\n });\n }\n return finalizeFrame(dots, [], o.rMin);\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orbits.d.ts","sourceRoot":"","sources":["../../../src/internal/thinking-orb/orbits.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAO,SAAS,EAAE,MAAM,YAAY,CAAC;AAGjD,eAAO,MAAM,WAAW,EAAE,SAwEzB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.
|
|
2
|
+
// Orbits: particles on tilted orbits — the "working" state. No nucleus
|
|
3
|
+
// (the tuned preset runs coreless): just ghost paths and the particles
|
|
4
|
+
// doing the work.
|
|
5
|
+
import { finalizeFrame, hashD, makeProj, radiusScale } from './core.js';
|
|
6
|
+
export const frameOrbits = (size, t, o) => {
|
|
7
|
+
const cx = size / 2;
|
|
8
|
+
const cy = size / 2;
|
|
9
|
+
const R = (size / 2) * 0.82;
|
|
10
|
+
const pt = makeProj(t * 0.12, 0.3, cx, cy, 1);
|
|
11
|
+
const rs = radiusScale(size, o.rsPow ?? 0.6);
|
|
12
|
+
const dots = [];
|
|
13
|
+
const orbitN = o.orbitN ?? 12;
|
|
14
|
+
const ghostN = o.ghostN ?? 40;
|
|
15
|
+
const particles = o.particles ?? 3;
|
|
16
|
+
// orbits: each a tilted circle — a ghost path + running particles
|
|
17
|
+
for (let orb = 0; orb < orbitN; orb++) {
|
|
18
|
+
const h1 = hashD(orb, 1.7);
|
|
19
|
+
const h2 = hashD(orb, 5.2);
|
|
20
|
+
const h3 = hashD(orb, 8.9);
|
|
21
|
+
const ro = R * (0.45 + 0.52 * h1);
|
|
22
|
+
const th = h1 * 2 * Math.PI;
|
|
23
|
+
const phi = Math.acos(2 * h2 - 1);
|
|
24
|
+
// orbit plane basis (u, v ⟂ normal n)
|
|
25
|
+
const nx = Math.sin(phi) * Math.cos(th);
|
|
26
|
+
const ny = Math.cos(phi);
|
|
27
|
+
const nz = Math.sin(phi) * Math.sin(th);
|
|
28
|
+
let ux = -ny;
|
|
29
|
+
let uy = nx;
|
|
30
|
+
const uz = 0;
|
|
31
|
+
const ul = Math.max(1e-6, Math.sqrt(ux * ux + uy * uy));
|
|
32
|
+
ux /= ul;
|
|
33
|
+
uy /= ul;
|
|
34
|
+
const vx = ny * uz - nz * uy;
|
|
35
|
+
const vy = nz * ux - nx * uz;
|
|
36
|
+
const vz = nx * uy - ny * ux;
|
|
37
|
+
const speed = (0.25 + 0.55 * h3) * (h3 > 0.5 ? 1 : -1);
|
|
38
|
+
// ghost path
|
|
39
|
+
for (let k = 0; k < ghostN; k++) {
|
|
40
|
+
const a = (k / ghostN) * 2 * Math.PI;
|
|
41
|
+
const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
|
|
42
|
+
const depth = (z / ro + 1) / 2;
|
|
43
|
+
dots.push({
|
|
44
|
+
x: px,
|
|
45
|
+
y: py,
|
|
46
|
+
z,
|
|
47
|
+
r: (o.ghostR ?? 0.9) * rs,
|
|
48
|
+
white: 0.72,
|
|
49
|
+
a: (o.ghostA ?? 0.5) * (0.4 + 0.6 * depth)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// the particles doing the work
|
|
53
|
+
for (let m = 0; m < particles; m++) {
|
|
54
|
+
const a = t * speed + (m / particles) * 2 * Math.PI + h2 * 6;
|
|
55
|
+
const [px, py, z] = pt((ux * Math.cos(a) + vx * Math.sin(a)) * ro, (uy * Math.cos(a) + vy * Math.sin(a)) * ro, (uz * Math.cos(a) + vz * Math.sin(a)) * ro);
|
|
56
|
+
const depth = (z / ro + 1) / 2;
|
|
57
|
+
dots.push({
|
|
58
|
+
x: px,
|
|
59
|
+
y: py,
|
|
60
|
+
z,
|
|
61
|
+
r: ((o.partR ?? 1.2) + (o.partRDepth ?? 1.6) * depth) * rs,
|
|
62
|
+
white: 0.3 - 0.22 * depth
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return finalizeFrame(dots, [], o.rMin);
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=orbits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orbits.js","sourceRoot":"","sources":["../../../src/internal/thinking-orb/orbits.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,uEAAuE;AACvE,uEAAuE;AACvE,kBAAkB;AAGlB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExE,MAAM,CAAC,MAAM,WAAW,GAAc,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;IACnD,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;IACpB,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,CAAC;IACpB,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,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,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAC3C,CAAC;YACF,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC;gBACR,CAAC,EAAE,EAAE;gBACL,CAAC,EAAE,EAAE;gBACL,CAAC;gBACD,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,IAAI,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE;gBAC1D,KAAK,EAAE,GAAG,GAAG,IAAI,GAAG,KAAK;aAC1B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC","sourcesContent":["// Adapted from Thinking Orbs de85557 (MIT); see THIRD_PARTY_NOTICES.md.\n// Orbits: particles on tilted orbits — the \"working\" state. No nucleus\n// (the tuned preset runs coreless): just ghost paths and the particles\n// doing the work.\n\nimport type { Dot, ModeFrame } from './types.js';\nimport { finalizeFrame, hashD, makeProj, radiusScale } from './core.js';\n\nexport const frameOrbits: ModeFrame = (size, t, o) => {\n const cx = size / 2;\n const cy = size / 2;\n const R = (size / 2) * 0.82;\n const pt = makeProj(t * 0.12, 0.3, cx, cy, 1);\n const rs = radiusScale(size, o.rsPow ?? 0.6);\n\n const dots: Dot[] = [];\n const orbitN = o.orbitN ?? 12;\n const ghostN = o.ghostN ?? 40;\n const particles = o.particles ?? 3;\n\n // orbits: each a tilted circle — a ghost path + running particles\n for (let orb = 0; orb < orbitN; orb++) {\n const h1 = hashD(orb, 1.7);\n const h2 = hashD(orb, 5.2);\n const h3 = hashD(orb, 8.9);\n const ro = R * (0.45 + 0.52 * h1);\n const th = h1 * 2 * Math.PI;\n const phi = Math.acos(2 * h2 - 1);\n // orbit plane basis (u, v ⟂ normal n)\n const nx = Math.sin(phi) * Math.cos(th);\n const ny = Math.cos(phi);\n const nz = Math.sin(phi) * Math.sin(th);\n let ux = -ny;\n let uy = nx;\n const uz = 0;\n const ul = Math.max(1e-6, Math.sqrt(ux * ux + uy * uy));\n ux /= ul;\n uy /= ul;\n const vx = ny * uz - nz * uy;\n const vy = nz * ux - nx * uz;\n const vz = nx * uy - ny * ux;\n const speed = (0.25 + 0.55 * h3) * (h3 > 0.5 ? 1 : -1);\n\n // ghost path\n for (let k = 0; k < ghostN; k++) {\n const a = (k / ghostN) * 2 * Math.PI;\n const [px, py, z] = pt(\n (ux * Math.cos(a) + vx * Math.sin(a)) * ro,\n (uy * Math.cos(a) + vy * Math.sin(a)) * ro,\n (uz * Math.cos(a) + vz * Math.sin(a)) * ro\n );\n const depth = (z / ro + 1) / 2;\n dots.push({\n x: px,\n y: py,\n z,\n r: (o.ghostR ?? 0.9) * rs,\n white: 0.72,\n a: (o.ghostA ?? 0.5) * (0.4 + 0.6 * depth)\n });\n }\n // the particles doing the work\n for (let m = 0; m < particles; m++) {\n const a = t * speed + (m / particles) * 2 * Math.PI + h2 * 6;\n const [px, py, z] = pt(\n (ux * Math.cos(a) + vx * Math.sin(a)) * ro,\n (uy * Math.cos(a) + vy * Math.sin(a)) * ro,\n (uz * Math.cos(a) + vz * Math.sin(a)) * ro\n );\n const depth = (z / ro + 1) / 2;\n dots.push({\n x: px,\n y: py,\n z,\n r: ((o.partR ?? 1.2) + (o.partRDepth ?? 1.6) * depth) * rs,\n white: 0.3 - 0.22 * depth\n });\n }\n }\n return finalizeFrame(dots, [], o.rMin);\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ModeOpts } from './profiles.js';
|
|
2
|
+
import type { OrbSize, OrbState } from './types.js';
|
|
3
|
+
export type ModeKey = 'orbits' | 'globe' | 'rubik' | 'wave' | 'web' | 'braid' | 'ribbon' | 'ring' | 'morph';
|
|
4
|
+
export declare const STATE_TO_MODE: Record<OrbState, ModeKey>;
|
|
5
|
+
export interface Preset {
|
|
6
|
+
speed: number;
|
|
7
|
+
count: number;
|
|
8
|
+
size: number;
|
|
9
|
+
/** Extra mode opts merged verbatim after scaling. */
|
|
10
|
+
extra?: ModeOpts;
|
|
11
|
+
}
|
|
12
|
+
/** Exported so `scripts/extract-spec.ts` can emit them for the native ports. */
|
|
13
|
+
export declare const PRESETS: Record<ModeKey, Record<OrbSize, Preset>>;
|
|
14
|
+
export interface Resolved {
|
|
15
|
+
mode: ModeKey;
|
|
16
|
+
speed: number;
|
|
17
|
+
opts: ModeOpts;
|
|
18
|
+
}
|
|
19
|
+
/** Resolve a (state, size) pair to its mode + fully-scaled draw options. */
|
|
20
|
+
export declare function resolvePreset(state: OrbState, size: OrbSize): Resolved;
|
|
21
|
+
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.d.ts","sourceRoot":"","sources":["../../../src/internal/thinking-orb/presets.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpD,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,OAAO,GACP,OAAO,GACP,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,CAAC;AAEZ,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAUnD,CAAC;AAEF,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,gFAAgF;AAChF,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAqC5D,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB;AAID,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,CAetE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Upstream tuning retained for visual fidelity; see THIRD_PARTY_NOTICES.md.
|
|
2
|
+
// The shipped tunings: nine states × two sizes, baked from the inkform
|
|
3
|
+
// mini-page tuning session. `count`/`size` are multipliers over the base
|
|
4
|
+
// fine profiles; `speed` multiplies the shared clock. Resolved once per
|
|
5
|
+
// (state, size) pair and cached — the render loop sees plain numbers.
|
|
6
|
+
import { BASE_PROFILES, scaleCounts, scaleRadii } from './profiles.js';
|
|
7
|
+
export const STATE_TO_MODE = {
|
|
8
|
+
working: 'orbits',
|
|
9
|
+
searching: 'globe',
|
|
10
|
+
solving: 'rubik',
|
|
11
|
+
listening: 'wave',
|
|
12
|
+
connecting: 'web',
|
|
13
|
+
weaving: 'braid',
|
|
14
|
+
composing: 'ribbon',
|
|
15
|
+
breathing: 'ring',
|
|
16
|
+
shaping: 'morph'
|
|
17
|
+
};
|
|
18
|
+
/** Exported so `scripts/extract-spec.ts` can emit them for the native ports. */
|
|
19
|
+
export const PRESETS = {
|
|
20
|
+
orbits: {
|
|
21
|
+
64: { speed: 1.885, count: 1, size: 1 },
|
|
22
|
+
20: { speed: 3.9, count: 0.238, size: 2.4 }
|
|
23
|
+
},
|
|
24
|
+
globe: {
|
|
25
|
+
64: { speed: 2.015, count: 0.42, size: 1.15, extra: { scanMul: 4.08, dimBase: 0.45 } },
|
|
26
|
+
20: { speed: 2.665, count: 0.105, size: 1.75, extra: { scanMul: 4.335, dimBase: 0.45 } }
|
|
27
|
+
},
|
|
28
|
+
rubik: {
|
|
29
|
+
64: { speed: 1.82, count: 0.35, size: 1.05 },
|
|
30
|
+
20: { speed: 1.95, count: 0.088, size: 1.9 }
|
|
31
|
+
},
|
|
32
|
+
wave: {
|
|
33
|
+
64: { speed: 4.388, count: 0.341, size: 1 },
|
|
34
|
+
20: { speed: 3.998, count: 0.105, size: 1.6 }
|
|
35
|
+
},
|
|
36
|
+
web: {
|
|
37
|
+
64: { speed: 3.315, count: 1.35, size: 0.95 },
|
|
38
|
+
20: { speed: 6.63, count: 0.25, size: 1.52 }
|
|
39
|
+
},
|
|
40
|
+
braid: {
|
|
41
|
+
64: { speed: 1.625, count: 0.5, size: 1 },
|
|
42
|
+
20: { speed: 2.75, count: 0.1125, size: 1.36 }
|
|
43
|
+
},
|
|
44
|
+
ribbon: {
|
|
45
|
+
64: { speed: 2.34, count: 0.25, size: 0.85, extra: { spin: 0, bandMul: 3.9, wobMul: 1 } },
|
|
46
|
+
20: { speed: 3.12, count: 0.051, size: 1.073, extra: { spin: 0, bandMul: 4.94, wobMul: 1 } }
|
|
47
|
+
},
|
|
48
|
+
ring: {
|
|
49
|
+
64: { speed: 3.24, count: 0.25, size: 0.956, extra: { spin: 0, bandMul: 3.627, wobMul: 0.368 } },
|
|
50
|
+
20: { speed: 3.78, count: 0.028, size: 1.622, extra: { spin: 0, bandMul: 3.968, wobMul: 0.565 } }
|
|
51
|
+
},
|
|
52
|
+
morph: {
|
|
53
|
+
64: { speed: 2.405, count: 0.702, size: 0.395, extra: { spread: 1.45 } },
|
|
54
|
+
20: { speed: 2.08, count: 0.53, size: 1.011, extra: { spread: 1.45 } }
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const cache = new Map();
|
|
58
|
+
/** Resolve a (state, size) pair to its mode + fully-scaled draw options. */
|
|
59
|
+
export function resolvePreset(state, size) {
|
|
60
|
+
const key = `${state}-${size}`;
|
|
61
|
+
const hit = cache.get(key);
|
|
62
|
+
if (hit)
|
|
63
|
+
return hit;
|
|
64
|
+
const mode = STATE_TO_MODE[state];
|
|
65
|
+
const preset = PRESETS[mode][size];
|
|
66
|
+
let opts = { ...BASE_PROFILES[mode] };
|
|
67
|
+
if (preset.count !== 1)
|
|
68
|
+
opts = scaleCounts(opts, preset.count);
|
|
69
|
+
if (preset.size !== 1)
|
|
70
|
+
opts = scaleRadii(opts, preset.size);
|
|
71
|
+
if (preset.extra)
|
|
72
|
+
opts = { ...opts, ...preset.extra };
|
|
73
|
+
const resolved = { mode, speed: preset.speed, opts };
|
|
74
|
+
cache.set(key, resolved);
|
|
75
|
+
return resolved;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presets.js","sourceRoot":"","sources":["../../../src/internal/thinking-orb/presets.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AAGtE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAcvE,MAAM,CAAC,MAAM,aAAa,GAA8B;IACtD,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,OAAO;IAClB,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,KAAK;IACjB,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC;AAUF,gFAAgF;AAChF,MAAM,CAAC,MAAM,OAAO,GAA6C;IAC/D,MAAM,EAAE;QACN,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;QACvC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE;KAC5C;I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AAE,IAAa;IAC1D,MAAM,GAAG,GAAG,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC;IAC/B,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC;IAEpB,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,GAAa,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC;IAChD,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC;QAAE,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/D,IAAI,MAAM,CAAC,IAAI,KAAK,CAAC;QAAE,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,MAAM,CAAC,KAAK;QAAE,IAAI,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAEtD,MAAM,QAAQ,GAAa,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IAC/D,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;IACzB,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Upstream tuning retained for visual fidelity; see THIRD_PARTY_NOTICES.md.\n// The shipped tunings: nine states × two sizes, baked from the inkform\n// mini-page tuning session. `count`/`size` are multipliers over the base\n// fine profiles; `speed` multiplies the shared clock. Resolved once per\n// (state, size) pair and cached — the render loop sees plain numbers.\n\nimport type { ModeOpts } from './profiles.js';\nimport { BASE_PROFILES, scaleCounts, scaleRadii } from './profiles.js';\nimport type { OrbSize, OrbState } from './types.js';\n\nexport type ModeKey =\n | 'orbits'\n | 'globe'\n | 'rubik'\n | 'wave'\n | 'web'\n | 'braid'\n | 'ribbon'\n | 'ring'\n | 'morph';\n\nexport const STATE_TO_MODE: Record<OrbState, ModeKey> = {\n working: 'orbits',\n searching: 'globe',\n solving: 'rubik',\n listening: 'wave',\n connecting: 'web',\n weaving: 'braid',\n composing: 'ribbon',\n breathing: 'ring',\n shaping: 'morph'\n};\n\nexport interface Preset {\n speed: number;\n count: number;\n size: number;\n /** Extra mode opts merged verbatim after scaling. */\n extra?: ModeOpts;\n}\n\n/** Exported so `scripts/extract-spec.ts` can emit them for the native ports. */\nexport const PRESETS: Record<ModeKey, Record<OrbSize, Preset>> = {\n orbits: {\n 64: { speed: 1.885, count: 1, size: 1 },\n 20: { speed: 3.9, count: 0.238, size: 2.4 }\n },\n globe: {\n 64: { speed: 2.015, count: 0.42, size: 1.15, extra: { scanMul: 4.08, dimBase: 0.45 } },\n 20: { speed: 2.665, count: 0.105, size: 1.75, extra: { scanMul: 4.335, dimBase: 0.45 } }\n },\n rubik: {\n 64: { speed: 1.82, count: 0.35, size: 1.05 },\n 20: { speed: 1.95, count: 0.088, size: 1.9 }\n },\n wave: {\n 64: { speed: 4.388, count: 0.341, size: 1 },\n 20: { speed: 3.998, count: 0.105, size: 1.6 }\n },\n web: {\n 64: { speed: 3.315, count: 1.35, size: 0.95 },\n 20: { speed: 6.63, count: 0.25, size: 1.52 }\n },\n braid: {\n 64: { speed: 1.625, count: 0.5, size: 1 },\n 20: { speed: 2.75, count: 0.1125, size: 1.36 }\n },\n ribbon: {\n 64: { speed: 2.34, count: 0.25, size: 0.85, extra: { spin: 0, bandMul: 3.9, wobMul: 1 } },\n 20: { speed: 3.12, count: 0.051, size: 1.073, extra: { spin: 0, bandMul: 4.94, wobMul: 1 } }\n },\n ring: {\n 64: { speed: 3.24, count: 0.25, size: 0.956, extra: { spin: 0, bandMul: 3.627, wobMul: 0.368 } },\n 20: { speed: 3.78, count: 0.028, size: 1.622, extra: { spin: 0, bandMul: 3.968, wobMul: 0.565 } }\n },\n morph: {\n 64: { speed: 2.405, count: 0.702, size: 0.395, extra: { spread: 1.45 } },\n 20: { speed: 2.08, count: 0.53, size: 1.011, extra: { spread: 1.45 } }\n }\n};\n\nexport interface Resolved {\n mode: ModeKey;\n speed: number;\n opts: ModeOpts;\n}\n\nconst cache = new Map<string, Resolved>();\n\n/** Resolve a (state, size) pair to its mode + fully-scaled draw options. */\nexport function resolvePreset(state: OrbState, size: OrbSize): Resolved {\n const key = `${state}-${size}`;\n const hit = cache.get(key);\n if (hit) return hit;\n\n const mode = STATE_TO_MODE[state];\n const preset = PRESETS[mode][size];\n let opts: ModeOpts = { ...BASE_PROFILES[mode] };\n if (preset.count !== 1) opts = scaleCounts(opts, preset.count);\n if (preset.size !== 1) opts = scaleRadii(opts, preset.size);\n if (preset.extra) opts = { ...opts, ...preset.extra };\n\n const resolved: Resolved = { mode, speed: preset.speed, opts };\n cache.set(key, resolved);\n return resolved;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface ModeOpts {
|
|
2
|
+
[key: string]: number | undefined;
|
|
3
|
+
}
|
|
4
|
+
export declare function scaleCounts(opts: ModeOpts, scale: number): ModeOpts;
|
|
5
|
+
export declare function scaleRadii(opts: ModeOpts, scale: number): ModeOpts;
|
|
6
|
+
/** Base (fine) profiles per mode, before preset multipliers. */
|
|
7
|
+
export declare const BASE_PROFILES: Record<string, ModeOpts>;
|
|
8
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../../src/internal/thinking-orb/profiles.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,QAAQ;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AA2BD,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAyBnE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAUlE;AAED,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAwFlD,CAAC"}
|