@blackbelt-technology/pi-dashboard-deck3d 0.0.0-stage → 0.8.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/.pi/skills/deck3d/SKILL.md +227 -0
- package/.pi/skills/deck3d/examples/deck.json +388 -0
- package/.pi/skills/deck3d/examples/fixture.md +18 -0
- package/.pi/skills/deck3d/examples/snapshot-after.png +0 -0
- package/.pi/skills/deck3d/examples/snapshot-before.png +0 -0
- package/.pi/skills/deck3d/reference/effects.agent.md +78 -0
- package/.pi/skills/deck3d/reference/effects.md +1217 -0
- package/.pi/skills/deck3d/reference/ir-fields.agent.md +30 -0
- package/.pi/skills/deck3d/reference/ir-fields.md +246 -0
- package/README.md +177 -2
- package/assets/LICENSE-Poppins.txt +99 -0
- package/assets/Poppins-Bold.ttf +0 -0
- package/assets/props/LICENSES.txt +4 -0
- package/assets/props/brain.glb +0 -0
- package/assets/props/cloud.glb +0 -0
- package/assets/props/cube.glb +0 -0
- package/assets/props/database.glb +0 -0
- package/assets/props/laptop.glb +0 -0
- package/assets/props/manifest.json +119 -0
- package/assets/props/robot.glb +0 -0
- package/assets/props/server.glb +0 -0
- package/assets/props/shield.glb +0 -0
- package/bin/deck3d +49 -0
- package/dist/cli.js +10228 -0
- package/dist/harvest/harness.js +185718 -0
- package/dist/runtime.js +64597 -0
- package/fixtures/business-2031/build-deck.mjs +60 -0
- package/fixtures/business-2031/build-overrides.mjs +154 -0
- package/fixtures/business-2031/deck.json +4220 -0
- package/fixtures/business-2031/deck.md +470 -0
- package/fixtures/business-2031/fx/closing-mark.js +43 -0
- package/fixtures/business-2031/fx/closing-mark.meta.json +26 -0
- package/fixtures/business-2031/overrides.json +903 -0
- package/fixtures/harvest.md +23 -0
- package/fixtures/strategy-lab.json +891 -0
- package/fixtures/strategy-lab.md +85 -0
- package/package.json +80 -4
- package/scripts/build-cli.mjs +29 -0
- package/scripts/build-harvest.ts +8 -0
- package/scripts/build-runtime.mjs +22 -0
- package/scripts/gen-effects.ts +14 -0
- package/scripts/gen-ir-fields.ts +34 -0
- package/src/check/index.ts +315 -0
- package/src/check/rules.ts +393 -0
- package/src/cli-io.ts +23 -0
- package/src/cli.ts +823 -0
- package/src/fx/accent-cycle.meta.json +26 -0
- package/src/fx/accent-cycle.ts +8 -0
- package/src/fx/agent-depth.meta.json +42 -0
- package/src/fx/agent-depth.ts +62 -0
- package/src/fx/ascii.meta.json +35 -0
- package/src/fx/ascii.ts +4 -0
- package/src/fx/aurora.meta.json +26 -0
- package/src/fx/aurora.ts +18 -0
- package/src/fx/billboards.meta.json +34 -0
- package/src/fx/billboards.ts +67 -0
- package/src/fx/bloom.meta.json +26 -0
- package/src/fx/bloom.ts +4 -0
- package/src/fx/camera-drift.meta.json +26 -0
- package/src/fx/camera-drift.ts +8 -0
- package/src/fx/capital-flows.meta.json +30 -0
- package/src/fx/capital-flows.ts +64 -0
- package/src/fx/catalogue.ts +89 -0
- package/src/fx/chromatic-aberration.meta.json +32 -0
- package/src/fx/chromatic-aberration.ts +4 -0
- package/src/fx/city-grid.meta.json +37 -0
- package/src/fx/city-grid.ts +51 -0
- package/src/fx/clipped-solids.meta.json +49 -0
- package/src/fx/clipped-solids.ts +171 -0
- package/src/fx/cohort-grid.meta.json +48 -0
- package/src/fx/cohort-grid.ts +63 -0
- package/src/fx/compose.ts +114 -0
- package/src/fx/constellation.meta.json +51 -0
- package/src/fx/constellation.ts +103 -0
- package/src/fx/curve-flow.meta.json +40 -0
- package/src/fx/curve-flow.ts +63 -0
- package/src/fx/dashed-flow.meta.json +27 -0
- package/src/fx/dashed-flow.ts +8 -0
- package/src/fx/data-columns.meta.json +30 -0
- package/src/fx/data-columns.ts +18 -0
- package/src/fx/defaults.ts +92 -0
- package/src/fx/depth-of-field.meta.json +40 -0
- package/src/fx/depth-of-field.ts +4 -0
- package/src/fx/dolly.meta.json +26 -0
- package/src/fx/dolly.ts +4 -0
- package/src/fx/dot-screen.meta.json +35 -0
- package/src/fx/dot-screen.ts +4 -0
- package/src/fx/dynamic-instances.meta.json +40 -0
- package/src/fx/dynamic-instances.ts +57 -0
- package/src/fx/emissive.meta.json +26 -0
- package/src/fx/emissive.ts +8 -0
- package/src/fx/extruded-shapes.meta.json +62 -0
- package/src/fx/extruded-shapes.ts +133 -0
- package/src/fx/fab-wafer.meta.json +42 -0
- package/src/fx/fab-wafer.ts +72 -0
- package/src/fx/fade.meta.json +26 -0
- package/src/fx/fade.ts +4 -0
- package/src/fx/film.meta.json +26 -0
- package/src/fx/film.ts +4 -0
- package/src/fx/float.meta.json +26 -0
- package/src/fx/float.ts +8 -0
- package/src/fx/flythrough.meta.json +26 -0
- package/src/fx/flythrough.ts +4 -0
- package/src/fx/fog.meta.json +26 -0
- package/src/fx/fog.ts +8 -0
- package/src/fx/geo-fragments.meta.json +48 -0
- package/src/fx/geo-fragments.ts +59 -0
- package/src/fx/glass.meta.json +26 -0
- package/src/fx/glass.ts +8 -0
- package/src/fx/globe-arcs.meta.json +36 -0
- package/src/fx/globe-arcs.ts +67 -0
- package/src/fx/glow-tube.meta.json +26 -0
- package/src/fx/glow-tube.ts +8 -0
- package/src/fx/glyph-rain.meta.json +30 -0
- package/src/fx/glyph-rain.ts +18 -0
- package/src/fx/god-rays.meta.json +40 -0
- package/src/fx/god-rays.ts +4 -0
- package/src/fx/grid-horizon.meta.json +30 -0
- package/src/fx/grid-horizon.ts +18 -0
- package/src/fx/hex-grid.meta.json +29 -0
- package/src/fx/hex-grid.ts +18 -0
- package/src/fx/holo-fresnel.meta.json +26 -0
- package/src/fx/holo-fresnel.ts +8 -0
- package/src/fx/horizon-gates.meta.json +36 -0
- package/src/fx/horizon-gates.ts +60 -0
- package/src/fx/index.ts +258 -0
- package/src/fx/iridescent.meta.json +26 -0
- package/src/fx/iridescent.ts +8 -0
- package/src/fx/iris.meta.json +26 -0
- package/src/fx/iris.ts +4 -0
- package/src/fx/lightformers.meta.json +26 -0
- package/src/fx/lightformers.ts +8 -0
- package/src/fx/local.ts +200 -0
- package/src/fx/market-tape.meta.json +53 -0
- package/src/fx/market-tape.ts +97 -0
- package/src/fx/matcap.meta.json +26 -0
- package/src/fx/matcap.ts +8 -0
- package/src/fx/meta.schema.json +49 -0
- package/src/fx/metal.meta.json +26 -0
- package/src/fx/metal.ts +8 -0
- package/src/fx/mirror-floor.meta.json +26 -0
- package/src/fx/mirror-floor.ts +8 -0
- package/src/fx/neural-mesh.meta.json +54 -0
- package/src/fx/neural-mesh.ts +110 -0
- package/src/fx/orbit-agents.meta.json +36 -0
- package/src/fx/orbit-agents.ts +63 -0
- package/src/fx/orbit.meta.json +27 -0
- package/src/fx/orbit.ts +8 -0
- package/src/fx/outline.meta.json +43 -0
- package/src/fx/outline.ts +4 -0
- package/src/fx/paper-stack.meta.json +36 -0
- package/src/fx/paper-stack.ts +61 -0
- package/src/fx/particle-stream.meta.json +27 -0
- package/src/fx/particle-stream.ts +8 -0
- package/src/fx/particles.meta.json +26 -0
- package/src/fx/particles.ts +8 -0
- package/src/fx/pixelate.meta.json +28 -0
- package/src/fx/pixelate.ts +4 -0
- package/src/fx/points-on-geometry.meta.json +61 -0
- package/src/fx/points-on-geometry.ts +71 -0
- package/src/fx/proof-gate.meta.json +30 -0
- package/src/fx/proof-gate.ts +67 -0
- package/src/fx/rings.meta.json +27 -0
- package/src/fx/rings.ts +8 -0
- package/src/fx/room-ibl.meta.json +26 -0
- package/src/fx/room-ibl.ts +8 -0
- package/src/fx/sao.meta.json +32 -0
- package/src/fx/sao.ts +4 -0
- package/src/fx/scaffold.ts +172 -0
- package/src/fx/scatter.meta.json +49 -0
- package/src/fx/scatter.ts +74 -0
- package/src/fx/selective-bloom.meta.json +36 -0
- package/src/fx/selective-bloom.ts +4 -0
- package/src/fx/server-racks.meta.json +36 -0
- package/src/fx/server-racks.ts +54 -0
- package/src/fx/shader-particles.meta.json +46 -0
- package/src/fx/shader-particles.ts +75 -0
- package/src/fx/signal-pulse.meta.json +27 -0
- package/src/fx/signal-pulse.ts +8 -0
- package/src/fx/smaa.meta.json +19 -0
- package/src/fx/smaa.ts +4 -0
- package/src/fx/sobel.meta.json +24 -0
- package/src/fx/sobel.ts +4 -0
- package/src/fx/soft-shadows.meta.json +26 -0
- package/src/fx/soft-shadows.ts +8 -0
- package/src/fx/sprites.meta.json +40 -0
- package/src/fx/sprites.ts +57 -0
- package/src/fx/stagger-reveal.meta.json +26 -0
- package/src/fx/stagger-reveal.ts +8 -0
- package/src/fx/starfield.meta.json +32 -0
- package/src/fx/starfield.ts +18 -0
- package/src/fx/swarm.meta.json +27 -0
- package/src/fx/swarm.ts +8 -0
- package/src/fx/tessellate.meta.json +39 -0
- package/src/fx/tessellate.ts +79 -0
- package/src/fx/tokens.meta.json +27 -0
- package/src/fx/tokens.ts +8 -0
- package/src/fx/trail.meta.json +27 -0
- package/src/fx/trail.ts +8 -0
- package/src/fx/trust-ledger.meta.json +30 -0
- package/src/fx/trust-ledger.ts +47 -0
- package/src/fx/types.ts +83 -0
- package/src/fx/util.ts +108 -0
- package/src/fx/vault-glyphs.meta.json +37 -0
- package/src/fx/vault-glyphs.ts +55 -0
- package/src/fx/video-screen.meta.json +57 -0
- package/src/fx/video-screen.ts +99 -0
- package/src/fx/vignette.meta.json +32 -0
- package/src/fx/vignette.ts +4 -0
- package/src/fx/volume-cloud.meta.json +58 -0
- package/src/fx/volume-cloud.ts +87 -0
- package/src/fx/volume-perlin.meta.json +46 -0
- package/src/fx/volume-perlin.ts +82 -0
- package/src/fx/volumetric-spot.meta.json +26 -0
- package/src/fx/volumetric-spot.ts +8 -0
- package/src/fx/wireframe-overlay.meta.json +27 -0
- package/src/fx/wireframe-overlay.ts +8 -0
- package/src/ir/defaults.ts +62 -0
- package/src/ir/field-reference.ts +96 -0
- package/src/ir/hash.ts +34 -0
- package/src/ir/ids.ts +65 -0
- package/src/ir/merge.ts +155 -0
- package/src/ir/schema.json +1211 -0
- package/src/ir/types.ts +333 -0
- package/src/ir/validate.ts +196 -0
- package/src/parse/derive.ts +205 -0
- package/src/parse/harvest/bundle.ts +56 -0
- package/src/parse/harvest/harness.html +22 -0
- package/src/parse/harvest/harness.ts +191 -0
- package/src/parse/harvest/index.ts +169 -0
- package/src/parse/harvest/shapes.ts +75 -0
- package/src/parse/markdown.ts +215 -0
- package/src/props/embed.ts +92 -0
- package/src/props/fetch.ts +97 -0
- package/src/props/generate.ts +152 -0
- package/src/props/key.ts +13 -0
- package/src/props/search.ts +180 -0
- package/src/render/embed-video.ts +80 -0
- package/src/render/font.ts +86 -0
- package/src/render/index.ts +149 -0
- package/src/render/template.html +87 -0
- package/src/runtime/backgrounds.ts +146 -0
- package/src/runtime/builders.ts +808 -0
- package/src/runtime/camera.ts +73 -0
- package/src/runtime/hud.ts +887 -0
- package/src/runtime/index.ts +1168 -0
- package/src/runtime/local-fx.ts +151 -0
- package/src/runtime/materials.ts +136 -0
- package/src/runtime/measure.ts +73 -0
- package/src/runtime/node-geometry.ts +26 -0
- package/src/runtime/palette.ts +111 -0
- package/src/runtime/post.ts +649 -0
- package/src/runtime/props.ts +292 -0
- package/src/runtime/quality.ts +20 -0
- package/src/runtime/rng.ts +8 -0
- package/src/runtime/scene.ts +644 -0
- package/src/runtime/text.ts +174 -0
- package/src/runtime/types.ts +118 -0
- package/src/serve/index.ts +376 -0
- package/src/util/paths.ts +35 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { SVGLoader } from "three/examples/jsm/loaders/SVGLoader.js";
|
|
2
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
3
|
+
import { countFor, num, str } from "./util.js";
|
|
4
|
+
|
|
5
|
+
type T3 = typeof import("three");
|
|
6
|
+
|
|
7
|
+
/** Built-in parametric outlines (three `webgl_geometry_shapes`); each is a "path as a function". */
|
|
8
|
+
function builtin(THREE: T3, name: string, lobes: number): THREE.Shape {
|
|
9
|
+
const s = new THREE.Shape();
|
|
10
|
+
const polar = (r: (a: number) => number, steps = 128) => {
|
|
11
|
+
for (let i = 0; i <= steps; i++) {
|
|
12
|
+
const a = (i / steps) * Math.PI * 2;
|
|
13
|
+
const rr = r(a);
|
|
14
|
+
if (i === 0) s.moveTo(Math.cos(a) * rr, Math.sin(a) * rr);
|
|
15
|
+
else s.lineTo(Math.cos(a) * rr, Math.sin(a) * rr);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
switch (name) {
|
|
19
|
+
case "gear":
|
|
20
|
+
polar((a) => 0.8 + 0.2 * Math.sign(Math.sin(a * lobes)), lobes * 8);
|
|
21
|
+
break;
|
|
22
|
+
case "rose":
|
|
23
|
+
polar((a) => 0.35 + 0.65 * Math.abs(Math.cos((lobes / 2) * a)));
|
|
24
|
+
break;
|
|
25
|
+
case "superformula": {
|
|
26
|
+
const m = lobes;
|
|
27
|
+
const n1 = 0.3;
|
|
28
|
+
polar((a) => (Math.abs(Math.cos((m * a) / 4)) ** 8 + Math.abs(Math.sin((m * a) / 4)) ** 8) ** (-1 / n1) * 0.9);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case "heart":
|
|
32
|
+
s.moveTo(0.25, 0.25);
|
|
33
|
+
s.bezierCurveTo(0.25, 0.25, 0.2, 0, 0, 0);
|
|
34
|
+
s.bezierCurveTo(-0.3, 0, -0.3, 0.35, -0.3, 0.35);
|
|
35
|
+
s.bezierCurveTo(-0.3, 0.55, -0.1, 0.77, 0.25, 0.95);
|
|
36
|
+
s.bezierCurveTo(0.6, 0.77, 0.8, 0.55, 0.8, 0.35);
|
|
37
|
+
s.bezierCurveTo(0.8, 0.35, 0.8, 0, 0.5, 0);
|
|
38
|
+
s.bezierCurveTo(0.35, 0, 0.25, 0.25, 0.25, 0.25);
|
|
39
|
+
break;
|
|
40
|
+
case "arrow":
|
|
41
|
+
s.moveTo(-0.9, -0.25);
|
|
42
|
+
s.lineTo(0.2, -0.25);
|
|
43
|
+
s.lineTo(0.2, -0.6);
|
|
44
|
+
s.lineTo(0.9, 0);
|
|
45
|
+
s.lineTo(0.2, 0.6);
|
|
46
|
+
s.lineTo(0.2, 0.25);
|
|
47
|
+
s.lineTo(-0.9, 0.25);
|
|
48
|
+
s.closePath();
|
|
49
|
+
break;
|
|
50
|
+
default: // star
|
|
51
|
+
polar((a) => (Math.round((a / Math.PI) * lobes) % 2 === 0 ? 1 : 0.45), lobes * 2);
|
|
52
|
+
}
|
|
53
|
+
return s;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Shapes from an SVG `<path d>` string; empty on any parse failure (the caller falls back). */
|
|
57
|
+
function fromSvgPath(THREE: T3, d: string): THREE.Shape[] {
|
|
58
|
+
try {
|
|
59
|
+
const parsed = new SVGLoader().parse(`<svg xmlns="http://www.w3.org/2000/svg"><path d="${d.replace(/"/g, "")}"/></svg>`);
|
|
60
|
+
const shapes = parsed.paths.flatMap((p) => SVGLoader.createShapes(p));
|
|
61
|
+
return shapes.filter((sh) => sh.getPoints(8).length > 2);
|
|
62
|
+
} catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Fit a set of shapes into a unit box: SVG data arrives in arbitrary pixel units. */
|
|
68
|
+
function normalised(THREE: T3, shapes: THREE.Shape[]): { shapes: THREE.Shape[]; scale: number; centre: THREE.Vector2 } {
|
|
69
|
+
const box = new THREE.Box2();
|
|
70
|
+
for (const sh of shapes) for (const p of sh.getPoints(12)) box.expandByPoint(p);
|
|
71
|
+
const size = new THREE.Vector2();
|
|
72
|
+
box.getSize(size);
|
|
73
|
+
const scale = 2 / Math.max(size.x, size.y, 1e-6);
|
|
74
|
+
const centre = new THREE.Vector2();
|
|
75
|
+
box.getCenter(centre);
|
|
76
|
+
return { shapes, scale, centre };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Extruded outlines drifting in depth (three `webgl_geometry_extrude_shapes`).
|
|
81
|
+
* `shape` picks a built-in parametric path; `svgPath` = an SVG `<path d>`
|
|
82
|
+
* string wins when it parses (paste it from the file — the module is offline).
|
|
83
|
+
*/
|
|
84
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
85
|
+
const { THREE, palette, rng } = ctx;
|
|
86
|
+
const count = countFor(ctx, 110, num(params, "density", 1), 4);
|
|
87
|
+
const depth = num(params, "depth", 0.35);
|
|
88
|
+
const spin = num(params, "spin", 1);
|
|
89
|
+
const lobes = Math.max(3, Math.round(num(params, "lobes", 5)));
|
|
90
|
+
const svgPath = str(params, "svgPath", "");
|
|
91
|
+
|
|
92
|
+
let shapes = svgPath ? fromSvgPath(THREE, svgPath) : [];
|
|
93
|
+
if (!shapes.length) shapes = [builtin(THREE, str(params, "shape", "star"), lobes)];
|
|
94
|
+
const fit = normalised(THREE, shapes);
|
|
95
|
+
const geo = new THREE.ExtrudeGeometry(fit.shapes, { depth, bevelEnabled: true, bevelThickness: depth * 0.25, bevelSize: 0.05, bevelSegments: 2, curveSegments: 24 });
|
|
96
|
+
geo.translate(-fit.centre.x, -fit.centre.y, 0);
|
|
97
|
+
geo.scale(fit.scale, -fit.scale, 1); // SVG y is down
|
|
98
|
+
geo.computeVertexNormals();
|
|
99
|
+
|
|
100
|
+
const mats = [
|
|
101
|
+
new THREE.MeshStandardMaterial({ color: palette.accent, metalness: 0.5, roughness: 0.35 }),
|
|
102
|
+
new THREE.MeshStandardMaterial({ color: palette.second, metalness: 0.5, roughness: 0.35 }),
|
|
103
|
+
];
|
|
104
|
+
const group = new THREE.Group();
|
|
105
|
+
const items: THREE.Mesh[] = [];
|
|
106
|
+
for (let i = 0; i < count; i++) {
|
|
107
|
+
const m = new THREE.Mesh(geo, mats[i % 2]);
|
|
108
|
+
const s = 0.5 + rng() * 1.1;
|
|
109
|
+
m.scale.setScalar(s);
|
|
110
|
+
m.position.set((rng() - 0.5) * 22, (rng() - 0.5) * 9, -(1 + rng() * 9));
|
|
111
|
+
m.userData.phase = rng() * 6.28;
|
|
112
|
+
m.userData.rate = 0.15 + rng() * 0.35;
|
|
113
|
+
m.userData.baseY = m.position.y;
|
|
114
|
+
group.add(m);
|
|
115
|
+
items.push(m);
|
|
116
|
+
}
|
|
117
|
+
const holder = new THREE.Group();
|
|
118
|
+
holder.add(group);
|
|
119
|
+
holder.userData.count = count;
|
|
120
|
+
return {
|
|
121
|
+
object: holder,
|
|
122
|
+
tick: (t) => {
|
|
123
|
+
for (const m of items) {
|
|
124
|
+
m.rotation.set(t * m.userData.rate * spin, t * 0.7 * m.userData.rate * spin + m.userData.phase, 0);
|
|
125
|
+
m.position.y = m.userData.baseY + Math.sin(t * 0.5 + m.userData.phase) * 0.25;
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
dispose: () => {
|
|
129
|
+
geo.dispose();
|
|
130
|
+
for (const m of mats) m.dispose();
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "fab-wafer",
|
|
3
|
+
"kind": "background",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"technical",
|
|
7
|
+
"precise"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"supply-chain",
|
|
11
|
+
"silicon"
|
|
12
|
+
],
|
|
13
|
+
"topic": [
|
|
14
|
+
"compute"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"cost": 3,
|
|
18
|
+
"modes": "both",
|
|
19
|
+
"params": {
|
|
20
|
+
"density": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"default": 1,
|
|
23
|
+
"minimum": 0.2,
|
|
24
|
+
"maximum": 3
|
|
25
|
+
},
|
|
26
|
+
"wave": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"default": 1,
|
|
29
|
+
"minimum": 0,
|
|
30
|
+
"maximum": 2
|
|
31
|
+
},
|
|
32
|
+
"waveSpeed": {
|
|
33
|
+
"type": "number",
|
|
34
|
+
"default": 1.1,
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"maximum": 3
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"conflicts": [],
|
|
40
|
+
"source": "https://github.com/BlackBeltTechnology/pi-agent-dashboard",
|
|
41
|
+
"licence": "MIT"
|
|
42
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// fab-wafer — a single wafer of dies feeding outward lanes (topic: compute). Licence: MIT.
|
|
2
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
3
|
+
|
|
4
|
+
export const create: FxFactory = function (ctx: FxContext, params: FxParams): FxHandle {
|
|
5
|
+
const { THREE, palette, quality, rng } = ctx;
|
|
6
|
+
const density = typeof params.density === "number" ? params.density : 1;
|
|
7
|
+
const wave = typeof params.wave === "number" ? params.wave : 1;
|
|
8
|
+
const waveSpeed = typeof params.waveSpeed === "number" ? params.waveSpeed : 1.1;
|
|
9
|
+
const count = Math.max(24, Math.round((quality.particles / 12) * density));
|
|
10
|
+
|
|
11
|
+
const group = new THREE.Group();
|
|
12
|
+
const wafer = new THREE.Mesh(
|
|
13
|
+
new THREE.CylinderGeometry(6, 6, 0.12, 64),
|
|
14
|
+
new THREE.MeshStandardMaterial({ color: palette.second, metalness: 0.85, roughness: 0.2, transparent: true, opacity: 0.4 }),
|
|
15
|
+
);
|
|
16
|
+
wafer.rotation.x = Math.PI / 2.2;
|
|
17
|
+
group.add(wafer);
|
|
18
|
+
|
|
19
|
+
const dieGeo = new THREE.BoxGeometry(0.6, 0.6, 0.08);
|
|
20
|
+
const dieMat = new THREE.MeshStandardMaterial({ color: palette.accent, metalness: 0.7, roughness: 0.3 });
|
|
21
|
+
const dies = new THREE.InstancedMesh(dieGeo, dieMat, count);
|
|
22
|
+
const side = Math.ceil(Math.sqrt(count));
|
|
23
|
+
const m = new THREE.Matrix4();
|
|
24
|
+
const phases: number[] = [];
|
|
25
|
+
const cells: Array<Record<string, number>> = [];
|
|
26
|
+
for (let i = 0; i < count; i++) {
|
|
27
|
+
const x = ((i % side) - side / 2) * 0.78;
|
|
28
|
+
const y = (Math.floor(i / side) - side / 2) * 0.78;
|
|
29
|
+
cells.push({ x: x, y: y, ph: rng() * 6.283 });
|
|
30
|
+
m.makeTranslation(x, y, 0.1);
|
|
31
|
+
dies.setMatrixAt(i, m);
|
|
32
|
+
phases.push(rng() * 6.283);
|
|
33
|
+
}
|
|
34
|
+
dies.instanceMatrix.needsUpdate = true;
|
|
35
|
+
|
|
36
|
+
const v = new THREE.Vector3();
|
|
37
|
+
const q = new THREE.Quaternion();
|
|
38
|
+
const sc = new THREE.Vector3();
|
|
39
|
+
// Die height rides a wave radiating out from the wafer centre — the dies
|
|
40
|
+
// grow OUT of the wafer (z), which is the axis the box is flat on.
|
|
41
|
+
const place = function (t: number) {
|
|
42
|
+
for (let i = 0; i < count; i++) {
|
|
43
|
+
const c = cells[i];
|
|
44
|
+
const rad = Math.sqrt(c.x * c.x + c.y * c.y);
|
|
45
|
+
// The wafer sits nearly edge-on, so its normal is almost horizontal on
|
|
46
|
+
// screen: a tall extrusion smears sideways instead of reading as height.
|
|
47
|
+
const h = 1 + (Math.sin(t * waveSpeed - rad * 0.55 + c.ph * 0.3) * 0.5 + 0.5) * 2.2 * wave;
|
|
48
|
+
v.set(c.x, c.y, 0.1 + h * 0.04);
|
|
49
|
+
sc.set(1, 1, h);
|
|
50
|
+
dies.setMatrixAt(i, m.compose(v, q, sc));
|
|
51
|
+
}
|
|
52
|
+
dies.instanceMatrix.needsUpdate = true;
|
|
53
|
+
};
|
|
54
|
+
place(0);
|
|
55
|
+
wafer.add(dies);
|
|
56
|
+
|
|
57
|
+
group.position.set(0, 0, -14);
|
|
58
|
+
const holder = new THREE.Group();
|
|
59
|
+
holder.add(group);
|
|
60
|
+
holder.userData.count = count;
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
object: holder,
|
|
64
|
+
tick: function (t) {
|
|
65
|
+
place(t);
|
|
66
|
+
wafer.rotation.z = t * 0.06;
|
|
67
|
+
dieMat.opacity = 0.7 + Math.sin(t * 1.1 + phases[0]) * 0.25;
|
|
68
|
+
dieMat.transparent = true;
|
|
69
|
+
},
|
|
70
|
+
dispose: function () { dieGeo.dispose(); dieMat.dispose(); },
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "fade",
|
|
3
|
+
"kind": "transition",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"calm",
|
|
7
|
+
"cinematic"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"motion"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 1,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"intensity": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 1,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://threejs.org/examples/",
|
|
25
|
+
"licence": "MIT"
|
|
26
|
+
}
|
package/src/fx/fade.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "film",
|
|
3
|
+
"kind": "post",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"retro",
|
|
7
|
+
"calm"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"texture"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 1,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"intensity": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 0.5,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://github.com/pmndrs/postprocessing",
|
|
25
|
+
"licence": "Zlib"
|
|
26
|
+
}
|
package/src/fx/film.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "float",
|
|
3
|
+
"kind": "motion",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"calm",
|
|
7
|
+
"ambient"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"motion"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 1,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"amplitude": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 0.2,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 1
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://threejs.org/examples/",
|
|
25
|
+
"licence": "MIT"
|
|
26
|
+
}
|
package/src/fx/float.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/** Motion preset applied to a slide's diagram group. */
|
|
4
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
5
|
+
const group = new ctx.THREE.Group();
|
|
6
|
+
const amplitude = typeof params.amplitude === "number" ? params.amplitude : 0.2;
|
|
7
|
+
return { object: group, tick: (t) => { group.rotation.y = Math.sin(t * 0.3) * amplitude; }, dispose: () => {} };
|
|
8
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "flythrough",
|
|
3
|
+
"kind": "transition",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"cinematic",
|
|
7
|
+
"dramatic"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"motion"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 3,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"intensity": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 1,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://threejs.org/examples/",
|
|
25
|
+
"licence": "MIT"
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "fog",
|
|
3
|
+
"kind": "light",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"calm",
|
|
7
|
+
"mysterious"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"depth"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 1,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"intensity": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 1,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://threejs.org/examples/",
|
|
25
|
+
"licence": "MIT"
|
|
26
|
+
}
|
package/src/fx/fog.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/** Permissive port of a three.js example. */
|
|
4
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
5
|
+
const light = new ctx.THREE.PointLight(ctx.palette.accent, 1, 30);
|
|
6
|
+
void params;
|
|
7
|
+
return { object: light, dispose: () => light.dispose?.() };
|
|
8
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "geo-fragments",
|
|
3
|
+
"kind": "background",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"unsettled",
|
|
7
|
+
"wide"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"geography",
|
|
11
|
+
"fragmentation"
|
|
12
|
+
],
|
|
13
|
+
"topic": [
|
|
14
|
+
"geo"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"cost": 2,
|
|
18
|
+
"modes": "both",
|
|
19
|
+
"params": {
|
|
20
|
+
"density": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"default": 1,
|
|
23
|
+
"minimum": 0.2,
|
|
24
|
+
"maximum": 3
|
|
25
|
+
},
|
|
26
|
+
"activity": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"default": 1,
|
|
29
|
+
"minimum": 0,
|
|
30
|
+
"maximum": 3
|
|
31
|
+
},
|
|
32
|
+
"spin": {
|
|
33
|
+
"type": "number",
|
|
34
|
+
"default": 0.35,
|
|
35
|
+
"minimum": 0,
|
|
36
|
+
"maximum": 2
|
|
37
|
+
},
|
|
38
|
+
"breathe": {
|
|
39
|
+
"type": "number",
|
|
40
|
+
"default": 0.18,
|
|
41
|
+
"minimum": 0,
|
|
42
|
+
"maximum": 1
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"conflicts": [],
|
|
46
|
+
"source": "https://github.com/BlackBeltTechnology/pi-agent-dashboard",
|
|
47
|
+
"licence": "MIT"
|
|
48
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// geo-fragments — drifting continental plates pulling apart (topic: geo). Licence: MIT.
|
|
2
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
3
|
+
|
|
4
|
+
export const create: FxFactory = function (ctx: FxContext, params: FxParams): FxHandle {
|
|
5
|
+
const { THREE, palette, quality, rng } = ctx;
|
|
6
|
+
const density = typeof params.density === "number" ? params.density : 1;
|
|
7
|
+
const activity = typeof params.activity === "number" ? params.activity : 1;
|
|
8
|
+
const spin = typeof params.spin === "number" ? params.spin : 0.35;
|
|
9
|
+
const breathe = typeof params.breathe === "number" ? params.breathe : 0.18;
|
|
10
|
+
const count = Math.max(10, Math.round((quality.particles / 36) * density));
|
|
11
|
+
|
|
12
|
+
const geo = new THREE.CircleGeometry(1, 6);
|
|
13
|
+
const mat = new THREE.MeshStandardMaterial({
|
|
14
|
+
color: palette.second, metalness: 0.3, roughness: 0.7,
|
|
15
|
+
// depthWrite off: translucent plates that overlap must blend, not fight.
|
|
16
|
+
transparent: true, opacity: 0.5, side: THREE.DoubleSide, depthWrite: false,
|
|
17
|
+
});
|
|
18
|
+
const plates = new THREE.InstancedMesh(geo, mat, count);
|
|
19
|
+
const seeds: Array<Record<string, number>> = [];
|
|
20
|
+
for (let i = 0; i < count; i++) {
|
|
21
|
+
const a = rng() * Math.PI * 2;
|
|
22
|
+
const r = 3 + rng() * 9;
|
|
23
|
+
seeds.push({ a: a, r: r, s: 0.6 + rng() * 2.2, drift: 0.2 + rng() * 0.5, ph: rng() * 6.283, sp: (rng() < 0.5 ? -1 : 1) * (0.3 + rng() * 0.8) });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const group = new THREE.Group();
|
|
27
|
+
group.add(plates);
|
|
28
|
+
group.rotation.x = -Math.PI / 2.6;
|
|
29
|
+
const holder = new THREE.Group();
|
|
30
|
+
holder.add(group);
|
|
31
|
+
holder.userData.count = count;
|
|
32
|
+
|
|
33
|
+
const m = new THREE.Matrix4();
|
|
34
|
+
const AXIS_Z = new THREE.Vector3(0, 0, 1);
|
|
35
|
+
const q = new THREE.Quaternion();
|
|
36
|
+
const v = new THREE.Vector3();
|
|
37
|
+
const scale = new THREE.Vector3();
|
|
38
|
+
const place = function (t: number) {
|
|
39
|
+
for (let i = 0; i < count; i++) {
|
|
40
|
+
const s = seeds[i];
|
|
41
|
+
// The drift is the point: the map keeps coming apart, never back together.
|
|
42
|
+
const r = s.r + Math.sin(t * 0.15 * s.drift * activity) * 1.6 + t * 0.02 * s.drift;
|
|
43
|
+
// Each plate also creeps around the ring and turns on its own axis, so
|
|
44
|
+
// the map keeps rearranging instead of only breathing in and out.
|
|
45
|
+
const a2 = s.a + Math.sin(t * 0.08 * s.sp * activity) * 0.25 * activity;
|
|
46
|
+
const puff = 1 + Math.sin(t * 0.6 * activity + s.ph) * breathe;
|
|
47
|
+
// Every plate used to sit at exactly z=0, so overlapping pairs z-fought
|
|
48
|
+
// and the hexagons shimmered as they drifted. Stratify them in depth.
|
|
49
|
+
v.set(Math.cos(a2) * r, Math.sin(a2) * r, i * 0.004);
|
|
50
|
+
q.setFromAxisAngle(AXIS_Z, a2 + t * spin * s.sp * 0.35);
|
|
51
|
+
scale.set(s.s * puff, s.s * puff, s.s * puff);
|
|
52
|
+
plates.setMatrixAt(i, m.compose(v, q, scale));
|
|
53
|
+
}
|
|
54
|
+
plates.instanceMatrix.needsUpdate = true;
|
|
55
|
+
};
|
|
56
|
+
place(0);
|
|
57
|
+
|
|
58
|
+
return { object: holder, tick: place, dispose: function () { geo.dispose(); mat.dispose(); } };
|
|
59
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "glass",
|
|
3
|
+
"kind": "material",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"premium",
|
|
7
|
+
"clean"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"surface"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"cost": 2,
|
|
14
|
+
"modes": "both",
|
|
15
|
+
"params": {
|
|
16
|
+
"intensity": {
|
|
17
|
+
"type": "number",
|
|
18
|
+
"default": 1,
|
|
19
|
+
"minimum": 0,
|
|
20
|
+
"maximum": 2
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"conflicts": [],
|
|
24
|
+
"source": "https://threejs.org/examples/",
|
|
25
|
+
"licence": "MIT"
|
|
26
|
+
}
|
package/src/fx/glass.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/** Permissive port of a three.js example. */
|
|
4
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
5
|
+
const mat = new ctx.THREE.MeshStandardMaterial({ color: ctx.palette.accent, metalness: 0.8, roughness: 0.3 });
|
|
6
|
+
void params;
|
|
7
|
+
return { material: mat, dispose: () => mat.dispose() };
|
|
8
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "globe-arcs",
|
|
3
|
+
"kind": "background",
|
|
4
|
+
"tags": {
|
|
5
|
+
"mood": [
|
|
6
|
+
"expansive",
|
|
7
|
+
"calm"
|
|
8
|
+
],
|
|
9
|
+
"content": [
|
|
10
|
+
"network",
|
|
11
|
+
"geography"
|
|
12
|
+
],
|
|
13
|
+
"topic": [
|
|
14
|
+
"geo"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"cost": 3,
|
|
18
|
+
"modes": "both",
|
|
19
|
+
"params": {
|
|
20
|
+
"density": {
|
|
21
|
+
"type": "number",
|
|
22
|
+
"default": 1,
|
|
23
|
+
"minimum": 0.2,
|
|
24
|
+
"maximum": 3
|
|
25
|
+
},
|
|
26
|
+
"speed": {
|
|
27
|
+
"type": "number",
|
|
28
|
+
"default": 1,
|
|
29
|
+
"minimum": 0,
|
|
30
|
+
"maximum": 3
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"conflicts": [],
|
|
34
|
+
"source": "https://threejs.org/examples/#webgl_geometry_shapes",
|
|
35
|
+
"licence": "MIT"
|
|
36
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { FxContext, FxFactory, FxHandle, FxParams } from "./types.js";
|
|
2
|
+
|
|
3
|
+
/** Wire globe with great-circle arcs between seeded cities (topic: geo). */
|
|
4
|
+
export const create: FxFactory = (ctx: FxContext, params: FxParams): FxHandle => {
|
|
5
|
+
const { THREE, palette, quality, rng } = ctx;
|
|
6
|
+
const density = typeof params.density === "number" ? params.density : 1;
|
|
7
|
+
const speed = typeof params.speed === "number" ? params.speed : 1;
|
|
8
|
+
const arcs = Math.max(4, Math.round((quality.particles / 60) * density));
|
|
9
|
+
|
|
10
|
+
const group = new THREE.Group();
|
|
11
|
+
const geometries: Array<{ dispose: () => void }> = [];
|
|
12
|
+
// Far enough back that the whole sphere reads as a globe, not a tangle.
|
|
13
|
+
const R = 6;
|
|
14
|
+
|
|
15
|
+
const sphere = new THREE.SphereGeometry(R, 28, 18);
|
|
16
|
+
geometries.push(sphere);
|
|
17
|
+
group.add(
|
|
18
|
+
new THREE.Mesh(sphere, new THREE.MeshBasicMaterial({ color: palette.second, wireframe: true, transparent: true, opacity: 0.22 })),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const onSphere = (): THREE.Vector3 => {
|
|
22
|
+
const u = rng() * Math.PI * 2;
|
|
23
|
+
const v = Math.acos(2 * rng() - 1);
|
|
24
|
+
return new THREE.Vector3(Math.sin(v) * Math.cos(u), Math.cos(v), Math.sin(v) * Math.sin(u)).multiplyScalar(R);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const arcMat = new THREE.MeshBasicMaterial({ color: palette.accent, transparent: true, opacity: 0.55 });
|
|
28
|
+
const travellers: Array<{ m: THREE.Mesh; curve: THREE.QuadraticBezierCurve3; off: number }> = [];
|
|
29
|
+
const dot = new THREE.SphereGeometry(0.12, 8, 8);
|
|
30
|
+
geometries.push(dot);
|
|
31
|
+
|
|
32
|
+
for (let i = 0; i < arcs; i++) {
|
|
33
|
+
const a = onSphere();
|
|
34
|
+
const b = onSphere();
|
|
35
|
+
const mid = a.clone().add(b).normalize().multiplyScalar(R * 1.45);
|
|
36
|
+
const curve = new THREE.QuadraticBezierCurve3(a, mid, b);
|
|
37
|
+
const tube = new THREE.TubeGeometry(curve, 24, 0.035, 6, false);
|
|
38
|
+
geometries.push(tube);
|
|
39
|
+
group.add(new THREE.Mesh(tube, arcMat));
|
|
40
|
+
const m = new THREE.Mesh(dot, new THREE.MeshBasicMaterial({ color: palette.accent }));
|
|
41
|
+
group.add(m);
|
|
42
|
+
travellers.push({ m, curve, off: rng() });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const holder = new THREE.Group();
|
|
46
|
+
group.position.set(0, 0, -10);
|
|
47
|
+
holder.add(group);
|
|
48
|
+
holder.userData.count = arcs;
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
object: holder,
|
|
52
|
+
tick: (t) => {
|
|
53
|
+
group.rotation.y = t * 0.06 * speed;
|
|
54
|
+
for (const tr of travellers) {
|
|
55
|
+
const k = (t * 0.12 * speed + tr.off) % 1;
|
|
56
|
+
tr.m.position.copy(tr.curve.getPoint(k));
|
|
57
|
+
// Scale in at the start of the arc and out at its end: a traveller
|
|
58
|
+
// used to disappear the instant it reached the far anchor.
|
|
59
|
+
tr.m.scale.setScalar(Math.min(1, k / 0.15, (1 - k) / 0.15));
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
dispose: () => {
|
|
63
|
+
for (const g of geometries) g.dispose();
|
|
64
|
+
arcMat.dispose();
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|