@motionscript/core 0.1.0-alpha.5 → 0.1.0-alpha.6
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/CHANGELOG.md +27 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/{chunk-QG6C23IJ.js.map → chunk-2RIYH36X.js.map} +4 -4
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +7 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +2 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +9 -1
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +41 -0
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +9 -27
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.js +3 -0
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +6 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.js +2 -2
- package/dist/document/placement.js.map +1 -1
- package/dist/document/registry.d.ts +6 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +17 -17
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline.d.ts +27 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +98 -2
- package/dist/document/timeline.js.map +1 -1
- package/dist/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +2 -1
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +3 -0
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/index.d.ts +39 -27
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +16 -30
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/node/node.d.ts +7 -1
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +23 -8
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/root/canvas2d-node.d.ts +2 -1
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -1
- package/dist/nodes/root/canvas2d-node.js +3 -0
- package/dist/nodes/root/canvas2d-node.js.map +1 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +5 -71
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +12 -363
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- package/dist/nodes/three/canvas3d-node.d.ts +3 -1
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +6 -0
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +4 -1
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +17 -3
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +9 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +78 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +6 -7
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +11 -4
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +5 -0
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +35 -14
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +47 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/package.json +6 -1
- package/dist/browser/chunks/chunk-FUZVFT3W.js +0 -18
- package/dist/browser/chunks/chunk-FUZVFT3W.js.map +0 -7
- package/dist/browser/chunks/chunk-QG6C23IJ.js +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three.d.ts","sourceRoot":"","sources":["../../../src/component/builtins/three.ts"],"names":[],"mappings":"AA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+
import { ORBIT_CAMERA_DEFAULTS } from "../../render3d/camera.js";
|
|
2
|
+
import { lerpFill3D } from "../../render3d/fill3d.js";
|
|
3
|
+
import { Graphics3D } from "../../render3d/graphics3d.js";
|
|
4
|
+
import { component3d } from "../../component/component3d.js";
|
|
5
|
+
import { Types } from "../../component/types.js";
|
|
6
|
+
import * as Material from "../../component/modules/material.js";
|
|
7
|
+
import { defined, optional, optionalColor, optionalNumber, optionalVector3, stated } from "../../component/modules/three-entries.js";
|
|
8
|
+
/**
|
|
9
|
+
* The 3D tree: groups, meshes and the other drawables, lights, the camera, fog
|
|
10
|
+
* and the environment. Each draws the `Graphics3D` or scene call its class did.
|
|
11
|
+
*/
|
|
12
|
+
export const Group3D = component3d({ key: "group3d" });
|
|
13
|
+
// ---- meshes -----------------------------------------------------------------
|
|
14
|
+
const mesh = { geometry: optional(), ...Material.state };
|
|
15
|
+
export const Mesh3D = component3d({
|
|
16
|
+
key: "mesh3d",
|
|
17
|
+
state: mesh,
|
|
18
|
+
render: (ctx, s) => ctx.draw(Material.mesh(s, s.geometry)),
|
|
19
|
+
});
|
|
20
|
+
const sweep = { startAngle: optional(), sweep: optional() };
|
|
21
|
+
const SWEEP_KEYS = ["startAngle", "sweep"];
|
|
22
|
+
/** A mesh of one built-in shape: `keys` are the entries its geometry descriptor takes. */
|
|
23
|
+
function shape3d(key, type, own, keys) {
|
|
24
|
+
return component3d({
|
|
25
|
+
key,
|
|
26
|
+
state: { ...mesh, ...own },
|
|
27
|
+
render: (ctx, s) => ctx.draw(Material.mesh(s, stated(type, s, keys))),
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export const Box3D = shape3d("box3d", "box", {
|
|
31
|
+
width: optional(), height: optional(), depth: optional(),
|
|
32
|
+
cornerRadius: optional(), segments: optional(),
|
|
33
|
+
}, ["width", "height", "depth", "cornerRadius", "segments"]);
|
|
34
|
+
export const Sphere3D = shape3d("sphere3d", "sphere", {
|
|
35
|
+
radius: optional(), segments: optional(), ...sweep,
|
|
36
|
+
startLatitude: optional(), latitudeSweep: optional(),
|
|
37
|
+
}, ["radius", "segments", "startLatitude", "latitudeSweep", ...SWEEP_KEYS]);
|
|
38
|
+
export const Plane3D = shape3d("plane3d", "plane", {
|
|
39
|
+
width: optional(), height: optional(), segments: optional(),
|
|
40
|
+
}, ["width", "height", "segments"]);
|
|
41
|
+
export const Cylinder3D = shape3d("cylinder3d", "cylinder", {
|
|
42
|
+
radius: optional(), height: optional(),
|
|
43
|
+
segments: optional(), capped: optional(), ...sweep,
|
|
44
|
+
}, ["radius", "height", "segments", "capped", ...SWEEP_KEYS]);
|
|
45
|
+
export const Cone3D = shape3d("cone3d", "cone", {
|
|
46
|
+
radius: optional(), height: optional(), segments: optional(), capped: optional(), ...sweep,
|
|
47
|
+
}, ["radius", "height", "segments", "capped", ...SWEEP_KEYS]);
|
|
48
|
+
export const Torus3D = shape3d("torus3d", "torus", {
|
|
49
|
+
radius: optional(), thickness: optional(), segments: optional(), ...sweep,
|
|
50
|
+
}, ["radius", "thickness", "segments", ...SWEEP_KEYS]);
|
|
51
|
+
export const TorusKnot3D = shape3d("torus-knot3d", "torusKnot", {
|
|
52
|
+
radius: optional(), thickness: optional(), segments: optional(),
|
|
53
|
+
windings: optional(),
|
|
54
|
+
}, ["radius", "thickness", "segments", "windings"]);
|
|
55
|
+
export const Circle3D = shape3d("circle3d", "circle", {
|
|
56
|
+
radius: optional(), segments: optional(), ...sweep,
|
|
57
|
+
}, ["radius", "segments", ...SWEEP_KEYS]);
|
|
58
|
+
export const Ring3D = shape3d("ring3d", "ring", {
|
|
59
|
+
radius: optional(), innerRadius: optional(), segments: optional(), ...sweep,
|
|
60
|
+
}, ["radius", "innerRadius", "segments", ...SWEEP_KEYS]);
|
|
61
|
+
export const Capsule3D = shape3d("capsule3d", "capsule", {
|
|
62
|
+
radius: optional(), height: optional(), segments: optional(),
|
|
63
|
+
}, ["radius", "height", "segments"]);
|
|
64
|
+
export const Polyhedron3D = component3d({
|
|
65
|
+
key: "polyhedron3d",
|
|
66
|
+
state: { ...mesh, shape: Types.custom("icosahedron"), radius: optional(), segments: optional() },
|
|
67
|
+
render: (ctx, s) => ctx.draw(Material.mesh(s, stated("polyhedron", s, ["shape", "radius", "segments"]))),
|
|
68
|
+
});
|
|
69
|
+
export const Extrude3D = shape3d("extrude3d", "extrude", {
|
|
70
|
+
path: optional(), depth: optional(), segments: optional(), bevel: optional(),
|
|
71
|
+
}, ["path", "depth", "segments", "bevel"]);
|
|
72
|
+
export const Lathe3D = shape3d("lathe3d", "lathe", {
|
|
73
|
+
points: optional(), segments: optional(), ...sweep,
|
|
74
|
+
}, ["points", "segments", ...SWEEP_KEYS]);
|
|
75
|
+
export const Tube3D = shape3d("tube3d", "tube", {
|
|
76
|
+
points: optional(), radius: optional(), segments: optional(), closed: optional(),
|
|
77
|
+
}, ["points", "radius", "segments", "closed"]);
|
|
78
|
+
// ---- other drawables ----------------------------------------------------------
|
|
79
|
+
export const Instances3D = component3d({
|
|
80
|
+
key: "instances3d",
|
|
81
|
+
state: { ...mesh, instances: optional(), colors: optional() },
|
|
82
|
+
render: (ctx, s) => {
|
|
83
|
+
if (!s.geometry || !s.instances?.length)
|
|
84
|
+
return;
|
|
85
|
+
ctx.draw(new Graphics3D().instances(s.geometry, Material.single(s), s.instances, { colors: s.colors }));
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
export const Points3D = component3d({
|
|
89
|
+
key: "points3d",
|
|
90
|
+
state: mesh,
|
|
91
|
+
render: (ctx, s) => {
|
|
92
|
+
if (s.geometry)
|
|
93
|
+
ctx.draw(new Graphics3D().points(s.geometry, Material.points(s)));
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
export const Line3D = component3d({
|
|
97
|
+
key: "line3d",
|
|
98
|
+
state: {
|
|
99
|
+
points: optional(),
|
|
100
|
+
geometry: optional(),
|
|
101
|
+
closed: Types.custom(false),
|
|
102
|
+
segments: Types.custom(false),
|
|
103
|
+
stroke: optional(),
|
|
104
|
+
opacity: optional(),
|
|
105
|
+
material: optional(),
|
|
106
|
+
},
|
|
107
|
+
render: (ctx, s) => {
|
|
108
|
+
if (!s.geometry && !s.points?.length)
|
|
109
|
+
return;
|
|
110
|
+
ctx.draw(new Graphics3D().line({
|
|
111
|
+
points: s.geometry ? undefined : s.points, geometry: s.geometry, closed: s.closed, segments: s.segments,
|
|
112
|
+
stroke: s.stroke, opacity: s.opacity, material: s.material,
|
|
113
|
+
}));
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
export const Sprite3D = component3d({
|
|
117
|
+
key: "sprite3d",
|
|
118
|
+
state: {
|
|
119
|
+
fill: Types.custom(undefined, { lerp: lerpFill3D }),
|
|
120
|
+
opacity: optional(),
|
|
121
|
+
material: optional(),
|
|
122
|
+
},
|
|
123
|
+
render: (ctx, s) => ctx.draw(new Graphics3D().sprite({ fill: s.fill, opacity: s.opacity, material: s.material })),
|
|
124
|
+
});
|
|
125
|
+
export const Model3D = component3d({
|
|
126
|
+
key: "model3d",
|
|
127
|
+
state: {
|
|
128
|
+
src: optional(),
|
|
129
|
+
animation: optional(),
|
|
130
|
+
override: optional(),
|
|
131
|
+
},
|
|
132
|
+
render: (ctx, s) => {
|
|
133
|
+
if (s.src)
|
|
134
|
+
ctx.draw(new Graphics3D().model({ src: s.src, animation: s.animation, override: s.override }));
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
// ---- lights -------------------------------------------------------------------
|
|
138
|
+
/** A light that casts no shadow unless asked: shadow maps cost a render each. */
|
|
139
|
+
const castsNoShadow = { shadow: false };
|
|
140
|
+
export const AmbientLight3D = component3d({
|
|
141
|
+
key: "ambient-light3d",
|
|
142
|
+
state: { color: optionalColor(), intensity: optional() },
|
|
143
|
+
render: (ctx, s) => ctx.light(stated("ambient", s, ["color", "intensity"])),
|
|
144
|
+
});
|
|
145
|
+
export const HemisphereLight3D = component3d({
|
|
146
|
+
key: "hemisphere-light3d",
|
|
147
|
+
state: { sky: optionalColor(), ground: optionalColor(), intensity: optional() },
|
|
148
|
+
render: (ctx, s) => ctx.light(stated("hemisphere", s, ["sky", "ground", "intensity"])),
|
|
149
|
+
});
|
|
150
|
+
export const DirectionalLight3D = component3d({
|
|
151
|
+
key: "directional-light3d",
|
|
152
|
+
state: { color: optionalColor(), intensity: optional(), target: optionalVector3("origin") },
|
|
153
|
+
defaults: castsNoShadow,
|
|
154
|
+
render: (ctx, s) => ctx.light(stated("directional", s, ["color", "intensity", "target", "shadow"])),
|
|
155
|
+
});
|
|
156
|
+
export const PointLight3D = component3d({
|
|
157
|
+
key: "point-light3d",
|
|
158
|
+
state: { color: optionalColor(), intensity: optional(), distance: optional(), decay: optional() },
|
|
159
|
+
defaults: castsNoShadow,
|
|
160
|
+
render: (ctx, s) => ctx.light(stated("point", s, ["color", "intensity", "distance", "decay", "shadow"])),
|
|
161
|
+
});
|
|
162
|
+
export const SpotLight3D = component3d({
|
|
163
|
+
key: "spot-light3d",
|
|
164
|
+
state: {
|
|
165
|
+
color: optionalColor(), intensity: optional(), distance: optional(), angle: optional(),
|
|
166
|
+
penumbra: optional(), decay: optional(), target: optionalVector3("origin"),
|
|
167
|
+
},
|
|
168
|
+
defaults: castsNoShadow,
|
|
169
|
+
render: (ctx, s) => ctx.light(stated("spot", s, ["color", "intensity", "distance", "angle", "penumbra", "decay", "target", "shadow"])),
|
|
170
|
+
});
|
|
171
|
+
export const AreaLight3D = component3d({
|
|
172
|
+
key: "area-light3d",
|
|
173
|
+
state: { color: optionalColor(), intensity: optional(), width: optional(), height: optional() },
|
|
174
|
+
render: (ctx, s) => ctx.light(stated("area", s, ["color", "intensity", "width", "height"])),
|
|
175
|
+
});
|
|
176
|
+
// ---- camera, fog, environment -------------------------------------------------
|
|
177
|
+
const CAMERA_KEYS = ["target", "orbit", "elevation", "distance", "fov", "frustumHeight", "near", "far", "zoom"];
|
|
178
|
+
const ORBIT_KEYS = ["orbit", "elevation", "distance"];
|
|
179
|
+
export const Camera3D = component3d({
|
|
180
|
+
key: "camera3d",
|
|
181
|
+
state: {
|
|
182
|
+
type: Types.custom("perspective"),
|
|
183
|
+
target: optionalVector3("origin"),
|
|
184
|
+
orbit: optional(),
|
|
185
|
+
elevation: optional(),
|
|
186
|
+
distance: optional(),
|
|
187
|
+
fov: optional(),
|
|
188
|
+
frustumHeight: optional(),
|
|
189
|
+
near: optional(),
|
|
190
|
+
far: optional(),
|
|
191
|
+
zoom: optional(),
|
|
192
|
+
},
|
|
193
|
+
commands: {
|
|
194
|
+
/** Only the given angles move, each from where it stands (the orbit default while unset). */
|
|
195
|
+
orbitTo: {
|
|
196
|
+
args: {
|
|
197
|
+
orbit: optionalNumber({ step: 1, unit: "°" }),
|
|
198
|
+
elevation: optionalNumber({ min: -89, max: 89, step: 1, unit: "°" }),
|
|
199
|
+
distance: optionalNumber({ min: 0.01, step: 0.1 }),
|
|
200
|
+
},
|
|
201
|
+
run: (timeline, s) => {
|
|
202
|
+
const from = {
|
|
203
|
+
orbit: s.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,
|
|
204
|
+
elevation: s.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,
|
|
205
|
+
distance: s.distance ?? ORBIT_CAMERA_DEFAULTS.distance,
|
|
206
|
+
};
|
|
207
|
+
return timeline.animate((t) => {
|
|
208
|
+
const out = {};
|
|
209
|
+
for (const key of ORBIT_KEYS) {
|
|
210
|
+
const end = timeline.args[key];
|
|
211
|
+
if (end !== undefined)
|
|
212
|
+
out[key] = from[key] + (end - from[key]) * t;
|
|
213
|
+
}
|
|
214
|
+
return out;
|
|
215
|
+
});
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
lookTo: { args: ["target"] },
|
|
219
|
+
},
|
|
220
|
+
render: (ctx, s) => {
|
|
221
|
+
const data = { type: s.type };
|
|
222
|
+
for (const key of CAMERA_KEYS)
|
|
223
|
+
if (s[key] !== undefined)
|
|
224
|
+
data[key] = s[key];
|
|
225
|
+
ctx.camera(data);
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
export const Fog3D = component3d({
|
|
229
|
+
key: "fog3d",
|
|
230
|
+
state: { color: optionalColor(), near: optional(), far: optional(), density: optional() },
|
|
231
|
+
render: (ctx, s) => {
|
|
232
|
+
const out = {};
|
|
233
|
+
if (s.color !== undefined)
|
|
234
|
+
out.color = s.color;
|
|
235
|
+
if (s.density !== undefined)
|
|
236
|
+
out.density = s.density;
|
|
237
|
+
else {
|
|
238
|
+
if (s.near !== undefined)
|
|
239
|
+
out.near = s.near;
|
|
240
|
+
if (s.far !== undefined)
|
|
241
|
+
out.far = s.far;
|
|
242
|
+
}
|
|
243
|
+
ctx.fog(out);
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
export const Environment3D = component3d({
|
|
247
|
+
key: "environment3d",
|
|
248
|
+
state: {
|
|
249
|
+
src: optional(),
|
|
250
|
+
faces: optional(),
|
|
251
|
+
preset: optional(),
|
|
252
|
+
intensity: optional(),
|
|
253
|
+
background: optional(),
|
|
254
|
+
blur: optional(),
|
|
255
|
+
},
|
|
256
|
+
render: (ctx, s) => {
|
|
257
|
+
if (s.src === undefined && s.faces === undefined && s.preset === undefined)
|
|
258
|
+
return ctx.environment(null);
|
|
259
|
+
const out = defined(s, ["src", "faces", "preset", "intensity", "background", "blur"]);
|
|
260
|
+
if (s.rotationX || s.rotationY || s.rotationZ)
|
|
261
|
+
out.rotation = [s.rotationX, s.rotationY, s.rotationZ];
|
|
262
|
+
ctx.environment(out);
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
//# sourceMappingURL=three.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"three.js","sourceRoot":"","sources":["../../../src/component/builtins/three.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAqB,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAe,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAA4C,MAAM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E,MAAM,CAAC,CAAC,CAAC;QACzG,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS;YAAE,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QACtG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACJ,CAAC,CAAC","sourcesContent":["import type { Color } from \"@/attributes/shape/fill/color/parser\";\r\nimport { ORBIT_CAMERA_DEFAULTS, type CameraData3D } from \"@/render3d/camera\";\r\nimport { lerpFill3D, type Fill3D } from \"@/render3d/fill3d\";\r\nimport type { Geometry3D, PolyhedronGeometry3D } from \"@/render3d/geometry\";\r\nimport { Graphics3D, type LineStroke3D, type ModelAnimation3D } from \"@/render3d/graphics3d\";\r\nimport type { LightData3D } from \"@/render3d/light\";\r\nimport type { Material3D } from \"@/render3d/material\";\r\nimport type { EnvironmentData3D, FogData3D } from \"@/render3d/scene-settings\";\r\nimport type { Segments3D } from \"@/render3d/segments\";\r\nimport type { Transform3D } from \"@/render3d/transform\";\r\nimport type { Vector3Input } from \"@/render3d/vector3\";\r\nimport type { NodeOf } from \"@/component/api\";\r\nimport { component3d } from \"@/component/component3d\";\r\nimport { Types } from \"@/component/types\";\r\nimport * as Material from \"@/component/modules/material\";\r\nimport { defined, optional, optionalColor, optionalNumber, optionalVector3, stated } from \"@/component/modules/three-entries\";\r\n\r\n/**\r\n * The 3D tree: groups, meshes and the other drawables, lights, the camera, fog\r\n * and the environment. Each draws the `Graphics3D` or scene call its class did.\r\n */\r\n\r\nexport const Group3D = component3d({ key: \"group3d\" });\r\nexport type Group3D = NodeOf<typeof Group3D>;\r\n\r\n// ---- meshes -----------------------------------------------------------------\r\n\r\nconst mesh = { geometry: optional<Geometry3D>(), ...Material.state };\r\n\r\nexport const Mesh3D = component3d({\r\n key: \"mesh3d\",\r\n state: mesh,\r\n render: (ctx, s) => ctx.draw(Material.mesh(s, s.geometry)),\r\n});\r\nexport type Mesh3D = NodeOf<typeof Mesh3D>;\r\n\r\nconst sweep = { startAngle: optional<number>(), sweep: optional<number>() };\r\nconst SWEEP_KEYS = [\"startAngle\", \"sweep\"] as const;\r\n\r\n/** A mesh of one built-in shape: `keys` are the entries its geometry descriptor takes. */\r\nfunction shape3d<const K extends string, const S extends Record<string, ReturnType<typeof optional>>>(\r\n key: K, type: Geometry3D[\"type\"], own: S, keys: readonly string[],\r\n) {\r\n return component3d({\r\n key,\r\n state: { ...mesh, ...own },\r\n render: (ctx, s) => ctx.draw(Material.mesh(s as never, stated<Geometry3D>(type, s, keys))),\r\n });\r\n}\r\n\r\nexport const Box3D = shape3d(\"box3d\", \"box\", {\r\n width: optional<number>(), height: optional<number>(), depth: optional<number>(),\r\n cornerRadius: optional<number>(), segments: optional<Segments3D>(),\r\n}, [\"width\", \"height\", \"depth\", \"cornerRadius\", \"segments\"]);\r\nexport type Box3D = NodeOf<typeof Box3D>;\r\n\r\nexport const Sphere3D = shape3d(\"sphere3d\", \"sphere\", {\r\n radius: optional<number>(), segments: optional<Segments3D>(), ...sweep,\r\n startLatitude: optional<number>(), latitudeSweep: optional<number>(),\r\n}, [\"radius\", \"segments\", \"startLatitude\", \"latitudeSweep\", ...SWEEP_KEYS]);\r\nexport type Sphere3D = NodeOf<typeof Sphere3D>;\r\n\r\nexport const Plane3D = shape3d(\"plane3d\", \"plane\", {\r\n width: optional<number>(), height: optional<number>(), segments: optional<Segments3D>(),\r\n}, [\"width\", \"height\", \"segments\"]);\r\nexport type Plane3D = NodeOf<typeof Plane3D>;\r\n\r\nexport const Cylinder3D = shape3d(\"cylinder3d\", \"cylinder\", {\r\n radius: optional<number | readonly [number, number]>(), height: optional<number>(),\r\n segments: optional<Segments3D>(), capped: optional<boolean>(), ...sweep,\r\n}, [\"radius\", \"height\", \"segments\", \"capped\", ...SWEEP_KEYS]);\r\nexport type Cylinder3D = NodeOf<typeof Cylinder3D>;\r\n\r\nexport const Cone3D = shape3d(\"cone3d\", \"cone\", {\r\n radius: optional<number>(), height: optional<number>(), segments: optional<Segments3D>(), capped: optional<boolean>(), ...sweep,\r\n}, [\"radius\", \"height\", \"segments\", \"capped\", ...SWEEP_KEYS]);\r\nexport type Cone3D = NodeOf<typeof Cone3D>;\r\n\r\nexport const Torus3D = shape3d(\"torus3d\", \"torus\", {\r\n radius: optional<number>(), thickness: optional<number>(), segments: optional<Segments3D>(), ...sweep,\r\n}, [\"radius\", \"thickness\", \"segments\", ...SWEEP_KEYS]);\r\nexport type Torus3D = NodeOf<typeof Torus3D>;\r\n\r\nexport const TorusKnot3D = shape3d(\"torus-knot3d\", \"torusKnot\", {\r\n radius: optional<number>(), thickness: optional<number>(), segments: optional<Segments3D>(),\r\n windings: optional<readonly [number, number]>(),\r\n}, [\"radius\", \"thickness\", \"segments\", \"windings\"]);\r\nexport type TorusKnot3D = NodeOf<typeof TorusKnot3D>;\r\n\r\nexport const Circle3D = shape3d(\"circle3d\", \"circle\", {\r\n radius: optional<number>(), segments: optional<Segments3D>(), ...sweep,\r\n}, [\"radius\", \"segments\", ...SWEEP_KEYS]);\r\nexport type Circle3D = NodeOf<typeof Circle3D>;\r\n\r\nexport const Ring3D = shape3d(\"ring3d\", \"ring\", {\r\n radius: optional<number>(), innerRadius: optional<number>(), segments: optional<Segments3D>(), ...sweep,\r\n}, [\"radius\", \"innerRadius\", \"segments\", ...SWEEP_KEYS]);\r\nexport type Ring3D = NodeOf<typeof Ring3D>;\r\n\r\nexport const Capsule3D = shape3d(\"capsule3d\", \"capsule\", {\r\n radius: optional<number>(), height: optional<number>(), segments: optional<Segments3D>(),\r\n}, [\"radius\", \"height\", \"segments\"]);\r\nexport type Capsule3D = NodeOf<typeof Capsule3D>;\r\n\r\nexport const Polyhedron3D = component3d({\r\n key: \"polyhedron3d\",\r\n state: { ...mesh, shape: Types.custom<PolyhedronGeometry3D[\"shape\"]>(\"icosahedron\"), radius: optional<number>(), segments: optional<Segments3D>() },\r\n render: (ctx, s) => ctx.draw(Material.mesh(s, stated<Geometry3D>(\"polyhedron\", s, [\"shape\", \"radius\", \"segments\"]))),\r\n});\r\nexport type Polyhedron3D = NodeOf<typeof Polyhedron3D>;\r\n\r\nexport const Extrude3D = shape3d(\"extrude3d\", \"extrude\", {\r\n path: optional<unknown>(), depth: optional<number>(), segments: optional<Segments3D>(), bevel: optional<unknown>(),\r\n}, [\"path\", \"depth\", \"segments\", \"bevel\"]);\r\nexport type Extrude3D = NodeOf<typeof Extrude3D>;\r\n\r\nexport const Lathe3D = shape3d(\"lathe3d\", \"lathe\", {\r\n points: optional<readonly unknown[]>(), segments: optional<Segments3D>(), ...sweep,\r\n}, [\"points\", \"segments\", ...SWEEP_KEYS]);\r\nexport type Lathe3D = NodeOf<typeof Lathe3D>;\r\n\r\nexport const Tube3D = shape3d(\"tube3d\", \"tube\", {\r\n points: optional<readonly Vector3Input[]>(), radius: optional<number>(), segments: optional<Segments3D>(), closed: optional<boolean>(),\r\n}, [\"points\", \"radius\", \"segments\", \"closed\"]);\r\nexport type Tube3D = NodeOf<typeof Tube3D>;\r\n\r\n// ---- other drawables ----------------------------------------------------------\r\n\r\nexport const Instances3D = component3d({\r\n key: \"instances3d\",\r\n state: { ...mesh, instances: optional<readonly Transform3D[]>(), colors: optional<readonly Color[]>() },\r\n render: (ctx, s) => {\r\n if (!s.geometry || !s.instances?.length) return;\r\n ctx.draw(new Graphics3D().instances(s.geometry, Material.single(s), s.instances, { colors: s.colors }));\r\n },\r\n});\r\nexport type Instances3D = NodeOf<typeof Instances3D>;\r\n\r\nexport const Points3D = component3d({\r\n key: \"points3d\",\r\n state: mesh,\r\n render: (ctx, s) => {\r\n if (s.geometry) ctx.draw(new Graphics3D().points(s.geometry, Material.points(s)));\r\n },\r\n});\r\nexport type Points3D = NodeOf<typeof Points3D>;\r\n\r\nexport const Line3D = component3d({\r\n key: \"line3d\",\r\n state: {\r\n points: optional<readonly Vector3Input[]>(),\r\n geometry: optional<Geometry3D>(),\r\n closed: Types.custom(false),\r\n segments: Types.custom(false),\r\n stroke: optional<LineStroke3D>(),\r\n opacity: optional<number>(),\r\n material: optional<Material3D>(),\r\n },\r\n render: (ctx, s) => {\r\n if (!s.geometry && !s.points?.length) return;\r\n ctx.draw(new Graphics3D().line({\r\n points: s.geometry ? undefined : s.points, geometry: s.geometry, closed: s.closed, segments: s.segments,\r\n stroke: s.stroke, opacity: s.opacity, material: s.material,\r\n }));\r\n },\r\n});\r\nexport type Line3D = NodeOf<typeof Line3D>;\r\n\r\nexport const Sprite3D = component3d({\r\n key: \"sprite3d\",\r\n state: {\r\n fill: Types.custom<Fill3D | undefined>(undefined, { lerp: lerpFill3D as never }),\r\n opacity: optional<number>(),\r\n material: optional<Material3D>(),\r\n },\r\n render: (ctx, s) => ctx.draw(new Graphics3D().sprite({ fill: s.fill as Fill3D, opacity: s.opacity, material: s.material })),\r\n});\r\nexport type Sprite3D = NodeOf<typeof Sprite3D>;\r\n\r\nexport const Model3D = component3d({\r\n key: \"model3d\",\r\n state: {\r\n src: optional<string>(),\r\n animation: optional<readonly ModelAnimation3D[] | ModelAnimation3D>(),\r\n override: optional<Readonly<Record<string, Material3D>>>(),\r\n },\r\n render: (ctx, s) => {\r\n if (s.src) ctx.draw(new Graphics3D().model({ src: s.src, animation: s.animation, override: s.override }));\r\n },\r\n});\r\nexport type Model3D = NodeOf<typeof Model3D>;\r\n\r\n// ---- lights -------------------------------------------------------------------\r\n\r\n/** A light that casts no shadow unless asked: shadow maps cost a render each. */\r\nconst castsNoShadow = { shadow: false } as const;\r\n\r\nexport const AmbientLight3D = component3d({\r\n key: \"ambient-light3d\",\r\n state: { color: optionalColor(), intensity: optional<number>() },\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"ambient\", s, [\"color\", \"intensity\"])),\r\n});\r\nexport type AmbientLight3D = NodeOf<typeof AmbientLight3D>;\r\n\r\nexport const HemisphereLight3D = component3d({\r\n key: \"hemisphere-light3d\",\r\n state: { sky: optionalColor(), ground: optionalColor(), intensity: optional<number>() },\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"hemisphere\", s, [\"sky\", \"ground\", \"intensity\"])),\r\n});\r\nexport type HemisphereLight3D = NodeOf<typeof HemisphereLight3D>;\r\n\r\nexport const DirectionalLight3D = component3d({\r\n key: \"directional-light3d\",\r\n state: { color: optionalColor(), intensity: optional<number>(), target: optionalVector3(\"origin\") },\r\n defaults: castsNoShadow,\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"directional\", s, [\"color\", \"intensity\", \"target\", \"shadow\"])),\r\n});\r\nexport type DirectionalLight3D = NodeOf<typeof DirectionalLight3D>;\r\n\r\nexport const PointLight3D = component3d({\r\n key: \"point-light3d\",\r\n state: { color: optionalColor(), intensity: optional<number>(), distance: optional<number>(), decay: optional<number>() },\r\n defaults: castsNoShadow,\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"point\", s, [\"color\", \"intensity\", \"distance\", \"decay\", \"shadow\"])),\r\n});\r\nexport type PointLight3D = NodeOf<typeof PointLight3D>;\r\n\r\nexport const SpotLight3D = component3d({\r\n key: \"spot-light3d\",\r\n state: {\r\n color: optionalColor(), intensity: optional<number>(), distance: optional<number>(), angle: optional<number>(),\r\n penumbra: optional<number>(), decay: optional<number>(), target: optionalVector3(\"origin\"),\r\n },\r\n defaults: castsNoShadow,\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"spot\", s, [\"color\", \"intensity\", \"distance\", \"angle\", \"penumbra\", \"decay\", \"target\", \"shadow\"])),\r\n});\r\nexport type SpotLight3D = NodeOf<typeof SpotLight3D>;\r\n\r\nexport const AreaLight3D = component3d({\r\n key: \"area-light3d\",\r\n state: { color: optionalColor(), intensity: optional<number>(), width: optional<number>(), height: optional<number>() },\r\n render: (ctx, s) => ctx.light(stated<LightData3D>(\"area\", s, [\"color\", \"intensity\", \"width\", \"height\"])),\r\n});\r\nexport type AreaLight3D = NodeOf<typeof AreaLight3D>;\r\n\r\n// ---- camera, fog, environment -------------------------------------------------\r\n\r\nconst CAMERA_KEYS = [\"target\", \"orbit\", \"elevation\", \"distance\", \"fov\", \"frustumHeight\", \"near\", \"far\", \"zoom\"] as const;\r\nconst ORBIT_KEYS = [\"orbit\", \"elevation\", \"distance\"] as const;\r\n\r\nexport const Camera3D = component3d({\r\n key: \"camera3d\",\r\n state: {\r\n type: Types.custom<CameraData3D[\"type\"]>(\"perspective\"),\r\n target: optionalVector3(\"origin\"),\r\n orbit: optional<number>(),\r\n elevation: optional<number>(),\r\n distance: optional<number>(),\r\n fov: optional<number>(),\r\n frustumHeight: optional<number>(),\r\n near: optional<number>(),\r\n far: optional<number>(),\r\n zoom: optional<number>(),\r\n },\r\n commands: {\r\n /** Only the given angles move, each from where it stands (the orbit default while unset). */\r\n orbitTo: {\r\n args: {\r\n orbit: optionalNumber({ step: 1, unit: \"°\" }),\r\n elevation: optionalNumber({ min: -89, max: 89, step: 1, unit: \"°\" }),\r\n distance: optionalNumber({ min: 0.01, step: 0.1 }),\r\n },\r\n run: (timeline, s) => {\r\n const from = {\r\n orbit: s.orbit ?? ORBIT_CAMERA_DEFAULTS.orbit,\r\n elevation: s.elevation ?? ORBIT_CAMERA_DEFAULTS.elevation,\r\n distance: s.distance ?? ORBIT_CAMERA_DEFAULTS.distance,\r\n };\r\n return timeline.animate((t) => {\r\n const out: Record<string, number> = {};\r\n for (const key of ORBIT_KEYS) {\r\n const end = timeline.args[key];\r\n if (end !== undefined) out[key] = from[key] + (end - from[key]) * t;\r\n }\r\n return out;\r\n });\r\n },\r\n },\r\n lookTo: { args: [\"target\"] },\r\n },\r\n render: (ctx, s) => {\r\n const data: Record<string, unknown> = { type: s.type };\r\n for (const key of CAMERA_KEYS) if (s[key] !== undefined) data[key] = s[key];\r\n ctx.camera(data as unknown as CameraData3D);\r\n },\r\n});\r\nexport type Camera3D = NodeOf<typeof Camera3D>;\r\n\r\nexport const Fog3D = component3d({\r\n key: \"fog3d\",\r\n state: { color: optionalColor(), near: optional<number>(), far: optional<number>(), density: optional<number>() },\r\n render: (ctx, s) => {\r\n const out: FogData3D = {};\r\n if (s.color !== undefined) out.color = s.color as Color;\r\n if (s.density !== undefined) out.density = s.density;\r\n else {\r\n if (s.near !== undefined) out.near = s.near;\r\n if (s.far !== undefined) out.far = s.far;\r\n }\r\n ctx.fog(out);\r\n },\r\n});\r\nexport type Fog3D = NodeOf<typeof Fog3D>;\r\n\r\nexport const Environment3D = component3d({\r\n key: \"environment3d\",\r\n state: {\r\n src: optional<string>(),\r\n faces: optional<readonly string[]>(),\r\n preset: optional<\"studio\">(),\r\n intensity: optional<number>(),\r\n background: optional<boolean>(),\r\n blur: optional<number>(),\r\n },\r\n render: (ctx, s) => {\r\n if (s.src === undefined && s.faces === undefined && s.preset === undefined) return ctx.environment(null);\r\n const out = defined<EnvironmentData3D>(s, [\"src\", \"faces\", \"preset\", \"intensity\", \"background\", \"blur\"]);\r\n if (s.rotationX || s.rotationY || s.rotationZ) out.rotation = [s.rotationX, s.rotationY, s.rotationZ];\r\n ctx.environment(out);\r\n },\r\n});\r\nexport type Environment3D = NodeOf<typeof Environment3D>;\r\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Clip } from "../render/clip.js";
|
|
2
|
+
import type { Graphics2D } from "../render/graphics2d.js";
|
|
3
|
+
/** The outline a shape's ops describe, as a clip: what `clip: true` cuts children to and picking tests against. */
|
|
4
|
+
export declare function clipOf(shape: Graphics2D): Clip;
|
|
5
|
+
//# sourceMappingURL=clip-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip-of.d.ts","sourceRoot":"","sources":["../../src/component/clip-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,mHAAmH;AACnH,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAe9C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Clip } from "../render/clip.js";
|
|
2
|
+
/** The outline a shape's ops describe, as a clip: what `clip: true` cuts children to and picking tests against. */
|
|
3
|
+
export function clipOf(shape) {
|
|
4
|
+
const clip = new Clip();
|
|
5
|
+
for (const op of shape.ops()) {
|
|
6
|
+
switch (op.kind) {
|
|
7
|
+
case "rect":
|
|
8
|
+
clip.rect(op.state);
|
|
9
|
+
break;
|
|
10
|
+
case "ellipse":
|
|
11
|
+
clip.ellipse(op.state);
|
|
12
|
+
break;
|
|
13
|
+
case "path":
|
|
14
|
+
clip.path(op.state);
|
|
15
|
+
break;
|
|
16
|
+
case "line":
|
|
17
|
+
clip.line(op.state);
|
|
18
|
+
break;
|
|
19
|
+
case "polygon":
|
|
20
|
+
clip.polygon(op.state);
|
|
21
|
+
break;
|
|
22
|
+
case "polygram":
|
|
23
|
+
clip.polygram(op.state);
|
|
24
|
+
break;
|
|
25
|
+
case "cut":
|
|
26
|
+
clip.cut();
|
|
27
|
+
break;
|
|
28
|
+
default: break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return clip;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=clip-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip-of.js","sourceRoot":"","sources":["../../src/component/clip-of.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,mHAAmH;AACnH,MAAM,UAAU,MAAM,CAAC,KAAiB;IACpC,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,KAAK,MAAM,EAAE,IAAI,KAAK,CAAC,GAAG,EAAE,EAAE,CAAC;QAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YACxC,KAAK,SAAS;gBAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YAC9C,KAAK,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YACxC,KAAK,MAAM;gBAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YACxC,KAAK,SAAS;gBAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YAC9C,KAAK,UAAU;gBAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;gBAAC,MAAM;YAChD,KAAK,KAAK;gBAAE,IAAI,CAAC,GAAG,EAAE,CAAC;gBAAC,MAAM;YAC9B,OAAO,CAAC,CAAC,MAAM;QACnB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { Clip } from \"@/render/clip\";\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\n\r\n/** The outline a shape's ops describe, as a clip: what `clip: true` cuts children to and picking tests against. */\r\nexport function clipOf(shape: Graphics2D): Clip {\r\n const clip = new Clip();\r\n for (const op of shape.ops()) {\r\n switch (op.kind) {\r\n case \"rect\": clip.rect(op.state); break;\r\n case \"ellipse\": clip.ellipse(op.state); break;\r\n case \"path\": clip.path(op.state); break;\r\n case \"line\": clip.line(op.state); break;\r\n case \"polygon\": clip.polygon(op.state); break;\r\n case \"polygram\": clip.polygram(op.state); break;\r\n case \"cut\": clip.cut(); break;\r\n default: break;\r\n }\r\n }\r\n return clip;\r\n}\r\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CommandsSpec, Kids, Piece, StateSpec, Values } from "../component/api.js";
|
|
2
|
+
/**
|
|
3
|
+
* A command as a module exports it: checked against the module's own state
|
|
4
|
+
* where it is written, then loose about the state it is run with, so it fits
|
|
5
|
+
* any component that spreads the module's state in.
|
|
6
|
+
*/
|
|
7
|
+
type Portable<A> = A extends readonly unknown[] ? {
|
|
8
|
+
readonly args: A;
|
|
9
|
+
readonly run?: undefined;
|
|
10
|
+
} : unknown extends A ? (timeline: any, state: any, children: any) => Piece : {
|
|
11
|
+
readonly args: A;
|
|
12
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
13
|
+
};
|
|
14
|
+
/** A module's commands, typed against the state it exports. */
|
|
15
|
+
export declare function commandsFor<const S extends StateSpec, const C>(state: S, commands: CommandsSpec<C, S, Values<S>, Kids>): {
|
|
16
|
+
readonly [N in keyof C]: Portable<C[N]>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=commands-for.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands-for.d.ts","sourceRoot":"","sources":["../../src/component/commands-for.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEpF;;;;GAIG;AACH,KAAK,QAAQ,CAAC,CAAC,IACX,CAAC,SAAS,SAAS,OAAO,EAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GAC3E,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,KAAK,GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,KAAK,CAAA;CAAE,CAAC;AAEjF,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,CAAC,CAAC,EAC1D,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAC9C;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAE7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands-for.js","sourceRoot":"","sources":["../../src/component/commands-for.ts"],"names":[],"mappings":"AAYA,+DAA+D;AAC/D,MAAM,UAAU,WAAW,CACvB,KAAQ,EACR,QAA6C;IAE7C,OAAO,QAAiB,CAAC;AAC7B,CAAC","sourcesContent":["import type { CommandsSpec, Kids, Piece, StateSpec, Values } from \"@/component/api\";\r\n\r\n/**\r\n * A command as a module exports it: checked against the module's own state\r\n * where it is written, then loose about the state it is run with, so it fits\r\n * any component that spreads the module's state in.\r\n */\r\ntype Portable<A> =\r\n A extends readonly unknown[] ? { readonly args: A; readonly run?: undefined }\r\n : unknown extends A ? (timeline: any, state: any, children: any) => Piece\r\n : { readonly args: A; run(timeline: any, state: any, children: any): Piece };\r\n\r\n/** A module's commands, typed against the state it exports. */\r\nexport function commandsFor<const S extends StateSpec, const C>(\r\n state: S,\r\n commands: CommandsSpec<C, S, Values<S>, Kids>,\r\n): { readonly [N in keyof C]: Portable<C[N]> } {\r\n return commands as never;\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NodeAudio } from "../nodes/audio/node-audio.js";
|
|
2
|
+
import type { Allowed, BoxAudioState, Component, Element, Merge, SpecAudio, StateSpec, TreeCallProps } from "../component/api.js";
|
|
3
|
+
/**
|
|
4
|
+
* An audio component: a sound, or a bus mixing the sounds in it. Lowers onto a
|
|
5
|
+
* generated `NodeAudio` subclass. It has no audio field: what it plays comes
|
|
6
|
+
* from its commands' `timeline.sound`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function componentAudio<const K extends string, const S extends StateSpec = {}, const C = {}, const A extends Allowed = null, const B extends Element = never>(spec: SpecAudio<K, Merge<BoxAudioState, S>, S, C, A, B>): Component<K, Merge<BoxAudioState, S>, C, A, NodeAudio, TreeCallProps<Merge<BoxAudioState, S>>>;
|
|
9
|
+
//# sourceMappingURL=component-audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-audio.d.ts","sourceRoot":"","sources":["../../src/component/component-audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAa,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIzI;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,EAAE,EAC9B,KAAK,CAAC,CAAC,GAAG,EAAE,EACZ,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI,EAC9B,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACjC,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,aAAa,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,CAUzJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeAudio } from "../nodes/audio/node-audio.js";
|
|
2
|
+
import { componentBase, finishComponent, lowering } from "../component/factory.js";
|
|
3
|
+
import { childView } from "../component/views.js";
|
|
4
|
+
/**
|
|
5
|
+
* An audio component: a sound, or a bus mixing the sounds in it. Lowers onto a
|
|
6
|
+
* generated `NodeAudio` subclass. It has no audio field: what it plays comes
|
|
7
|
+
* from its commands' `timeline.sound`.
|
|
8
|
+
*/
|
|
9
|
+
export function componentAudio(spec) {
|
|
10
|
+
const l = lowering(spec, NodeAudio);
|
|
11
|
+
class Generated extends componentBase(NodeAudio, l) {
|
|
12
|
+
_commandChildren() {
|
|
13
|
+
return this.childrenAudio.map(childView);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return finishComponent(Generated, l);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=component-audio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-audio.js","sourceRoot":"","sources":["../../src/component/component-audio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAM5B,IAAuD;IACrD,MAAM,CAAC,GAAG,QAAQ,CAAC,IAA2B,EAAE,SAAS,CAAC,CAAC;IAE3D,MAAM,SAAU,SAAQ,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC;QACtC,gBAAgB;YACrB,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC;KACJ;IAED,OAAO,eAAe,CAAC,SAAS,EAAE,CAAC,CAAU,CAAC;AAClD,CAAC","sourcesContent":["import { NodeAudio } from \"@/nodes/audio/node-audio\";\r\nimport type { Allowed, BoxAudioState, ChildView, Component, Element, Merge, SpecAudio, StateSpec, TreeCallProps } from \"@/component/api\";\r\nimport { componentBase, finishComponent, lowering, type CoreSpec } from \"@/component/factory\";\r\nimport { childView } from \"@/component/views\";\r\n\r\n/**\r\n * An audio component: a sound, or a bus mixing the sounds in it. Lowers onto a\r\n * generated `NodeAudio` subclass. It has no audio field: what it plays comes\r\n * from its commands' `timeline.sound`.\r\n */\r\nexport function componentAudio<\r\n const K extends string,\r\n const S extends StateSpec = {},\r\n const C = {},\r\n const A extends Allowed = null,\r\n const B extends Element = never,\r\n>(spec: SpecAudio<K, Merge<BoxAudioState, S>, S, C, A, B>): Component<K, Merge<BoxAudioState, S>, C, A, NodeAudio, TreeCallProps<Merge<BoxAudioState, S>>> {\r\n const l = lowering(spec as unknown as CoreSpec, NodeAudio);\r\n\r\n class Generated extends componentBase(NodeAudio, l) {\r\n override _commandChildren(): readonly ChildView[] {\r\n return this.childrenAudio.map(childView);\r\n }\r\n }\r\n\r\n return finishComponent(Generated, l) as never;\r\n}\r\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Allowed, Box2DState, Component, Element, Merge, Spec2D, StateSpec } from "../component/api.js";
|
|
2
|
+
export { componentValue } from "../component/factory.js";
|
|
3
|
+
/**
|
|
4
|
+
* A 2D component: laid out in a box, drawn with `Graphics2D`. Lowers the spec
|
|
5
|
+
* onto a generated `Node2D` subclass, so a registry, a document and a host see
|
|
6
|
+
* an ordinary node type.
|
|
7
|
+
*/
|
|
8
|
+
export declare function component2d<const K extends string, const S extends StateSpec = {}, const C = {}, const A extends Allowed = null, const B extends Element = never>(spec: Spec2D<K, Merge<Box2DState, S>, S, C, A, B>): Component<K, Merge<Box2DState, S>, C, A>;
|
|
9
|
+
//# sourceMappingURL=component2d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component2d.d.ts","sourceRoot":"","sources":["../../src/component/component2d.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAa,SAAS,EAAE,OAAO,EAAa,KAAK,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAY5I,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAkBrD;;;;GAIG;AACH,wBAAgB,WAAW,CACvB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,EAAE,EAC9B,KAAK,CAAC,CAAC,GAAG,EAAE,EACZ,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,IAAI,EAC9B,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,KAAK,EACjC,IAAI,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAiO7F"}
|