@motionscript/math 0.0.0-stage → 0.1.0-alpha.10
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 +144 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +389 -2
- package/dist/annotate/angle-mark.d.ts +96 -0
- package/dist/annotate/angle-mark.d.ts.map +1 -0
- package/dist/annotate/angle-mark.js +97 -0
- package/dist/annotate/angle-mark.js.map +1 -0
- package/dist/annotate/curly-brace.d.ts +115 -0
- package/dist/annotate/curly-brace.d.ts.map +1 -0
- package/dist/annotate/curly-brace.js +99 -0
- package/dist/annotate/curly-brace.js.map +1 -0
- package/dist/annotate/emphasis-mark.d.ts +80 -0
- package/dist/annotate/emphasis-mark.d.ts.map +1 -0
- package/dist/annotate/emphasis-mark.js +80 -0
- package/dist/annotate/emphasis-mark.js.map +1 -0
- package/dist/browser/THIRD_PARTY_LICENSES.txt +420 -0
- package/dist/browser/chunks/chunk-IRZCG6PM.js +2 -0
- package/dist/browser/chunks/chunk-IRZCG6PM.js.map +7 -0
- package/dist/browser/chunks/chunk-WMVW6ZIV.js +2 -0
- package/dist/browser/chunks/chunk-WMVW6ZIV.js.map +7 -0
- package/dist/browser/chunks/mathjax-WV55AC2P.js +61 -0
- package/dist/browser/chunks/mathjax-WV55AC2P.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +30 -0
- package/dist/browser/tex.js +2 -0
- package/dist/browser/tex.js.map +7 -0
- package/dist/engine.d.ts +71 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +45 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/brace.d.ts +8 -0
- package/dist/kit/brace.d.ts.map +1 -0
- package/dist/kit/brace.js +36 -0
- package/dist/kit/brace.js.map +1 -0
- package/dist/kit/cache.d.ts +30 -0
- package/dist/kit/cache.d.ts.map +1 -0
- package/dist/kit/cache.js +53 -0
- package/dist/kit/cache.js.map +1 -0
- package/dist/kit/component.d.ts +51 -0
- package/dist/kit/component.d.ts.map +1 -0
- package/dist/kit/component.js +30 -0
- package/dist/kit/component.js.map +1 -0
- package/dist/kit/contour.d.ts +8 -0
- package/dist/kit/contour.d.ts.map +1 -0
- package/dist/kit/contour.js +93 -0
- package/dist/kit/contour.js.map +1 -0
- package/dist/kit/coords.d.ts +69 -0
- package/dist/kit/coords.d.ts.map +1 -0
- package/dist/kit/coords.js +224 -0
- package/dist/kit/coords.js.map +1 -0
- package/dist/kit/curve.d.ts +28 -0
- package/dist/kit/curve.d.ts.map +1 -0
- package/dist/kit/curve.js +29 -0
- package/dist/kit/curve.js.map +1 -0
- package/dist/kit/equation.d.ts +61 -0
- package/dist/kit/equation.d.ts.map +1 -0
- package/dist/kit/equation.js +168 -0
- package/dist/kit/equation.js.map +1 -0
- package/dist/kit/equation3d.d.ts +50 -0
- package/dist/kit/equation3d.d.ts.map +1 -0
- package/dist/kit/equation3d.js +103 -0
- package/dist/kit/equation3d.js.map +1 -0
- package/dist/kit/expression.d.ts +35 -0
- package/dist/kit/expression.d.ts.map +1 -0
- package/dist/kit/expression.js +124 -0
- package/dist/kit/expression.js.map +1 -0
- package/dist/kit/field-mark.d.ts +79 -0
- package/dist/kit/field-mark.d.ts.map +1 -0
- package/dist/kit/field-mark.js +109 -0
- package/dist/kit/field-mark.js.map +1 -0
- package/dist/kit/field.d.ts +14 -0
- package/dist/kit/field.d.ts.map +1 -0
- package/dist/kit/field.js +46 -0
- package/dist/kit/field.js.map +1 -0
- package/dist/kit/follow.d.ts +109 -0
- package/dist/kit/follow.d.ts.map +1 -0
- package/dist/kit/follow.js +163 -0
- package/dist/kit/follow.js.map +1 -0
- package/dist/kit/furniture.d.ts +32 -0
- package/dist/kit/furniture.d.ts.map +1 -0
- package/dist/kit/furniture.js +92 -0
- package/dist/kit/furniture.js.map +1 -0
- package/dist/kit/geometry.d.ts +13 -0
- package/dist/kit/geometry.d.ts.map +1 -0
- package/dist/kit/geometry.js +54 -0
- package/dist/kit/geometry.js.map +1 -0
- package/dist/kit/graph.d.ts +46 -0
- package/dist/kit/graph.d.ts.map +1 -0
- package/dist/kit/graph.js +90 -0
- package/dist/kit/graph.js.map +1 -0
- package/dist/kit/mark.d.ts +72 -0
- package/dist/kit/mark.d.ts.map +1 -0
- package/dist/kit/mark.js +87 -0
- package/dist/kit/mark.js.map +1 -0
- package/dist/kit/part-fills.d.ts +23 -0
- package/dist/kit/part-fills.d.ts.map +1 -0
- package/dist/kit/part-fills.js +46 -0
- package/dist/kit/part-fills.js.map +1 -0
- package/dist/kit/place.d.ts +20 -0
- package/dist/kit/place.d.ts.map +1 -0
- package/dist/kit/place.js +66 -0
- package/dist/kit/place.js.map +1 -0
- package/dist/kit/sampler.d.ts +17 -0
- package/dist/kit/sampler.d.ts.map +1 -0
- package/dist/kit/sampler.js +250 -0
- package/dist/kit/sampler.js.map +1 -0
- package/dist/kit/scale.d.ts +12 -0
- package/dist/kit/scale.d.ts.map +1 -0
- package/dist/kit/scale.js +37 -0
- package/dist/kit/scale.js.map +1 -0
- package/dist/kit/source.d.ts +22 -0
- package/dist/kit/source.d.ts.map +1 -0
- package/dist/kit/source.js +45 -0
- package/dist/kit/source.js.map +1 -0
- package/dist/kit/system.d.ts +31 -0
- package/dist/kit/system.d.ts.map +1 -0
- package/dist/kit/system.js +71 -0
- package/dist/kit/system.js.map +1 -0
- package/dist/kit/ticks.d.ts +19 -0
- package/dist/kit/ticks.d.ts.map +1 -0
- package/dist/kit/ticks.js +78 -0
- package/dist/kit/ticks.js.map +1 -0
- package/dist/kit/withdrawn.d.ts +9 -0
- package/dist/kit/withdrawn.d.ts.map +1 -0
- package/dist/kit/withdrawn.js +9 -0
- package/dist/kit/withdrawn.js.map +1 -0
- package/dist/marks/curve-area.d.ts +51 -0
- package/dist/marks/curve-area.d.ts.map +1 -0
- package/dist/marks/curve-area.js +59 -0
- package/dist/marks/curve-area.js.map +1 -0
- package/dist/marks/drop-lines.d.ts +57 -0
- package/dist/marks/drop-lines.d.ts.map +1 -0
- package/dist/marks/drop-lines.js +43 -0
- package/dist/marks/drop-lines.js.map +1 -0
- package/dist/marks/plot-point.d.ts +71 -0
- package/dist/marks/plot-point.d.ts.map +1 -0
- package/dist/marks/plot-point.js +71 -0
- package/dist/marks/plot-point.js.map +1 -0
- package/dist/marks/riemann-sum.d.ts +58 -0
- package/dist/marks/riemann-sum.d.ts.map +1 -0
- package/dist/marks/riemann-sum.js +63 -0
- package/dist/marks/riemann-sum.js.map +1 -0
- package/dist/marks/tangent-line.d.ts +71 -0
- package/dist/marks/tangent-line.d.ts.map +1 -0
- package/dist/marks/tangent-line.js +89 -0
- package/dist/marks/tangent-line.js.map +1 -0
- package/dist/marks/vector-arrow.d.ts +60 -0
- package/dist/marks/vector-arrow.d.ts.map +1 -0
- package/dist/marks/vector-arrow.js +67 -0
- package/dist/marks/vector-arrow.js.map +1 -0
- package/dist/nodes.d.ts +43 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +57 -0
- package/dist/nodes.js.map +1 -0
- package/dist/plots/function-plot.d.ts +159 -0
- package/dist/plots/function-plot.d.ts.map +1 -0
- package/dist/plots/function-plot.js +184 -0
- package/dist/plots/function-plot.js.map +1 -0
- package/dist/plots/points-plot.d.ts +64 -0
- package/dist/plots/points-plot.d.ts.map +1 -0
- package/dist/plots/points-plot.js +72 -0
- package/dist/plots/points-plot.js.map +1 -0
- package/dist/plots/stream-lines.d.ts +76 -0
- package/dist/plots/stream-lines.d.ts.map +1 -0
- package/dist/plots/stream-lines.js +122 -0
- package/dist/plots/stream-lines.js.map +1 -0
- package/dist/plots/traced-path.d.ts +70 -0
- package/dist/plots/traced-path.d.ts.map +1 -0
- package/dist/plots/traced-path.js +41 -0
- package/dist/plots/traced-path.js.map +1 -0
- package/dist/plots/vector-field.d.ts +60 -0
- package/dist/plots/vector-field.d.ts.map +1 -0
- package/dist/plots/vector-field.js +77 -0
- package/dist/plots/vector-field.js.map +1 -0
- package/dist/structures/graph-layout.d.ts +11 -0
- package/dist/structures/graph-layout.d.ts.map +1 -0
- package/dist/structures/graph-layout.js +135 -0
- package/dist/structures/graph-layout.js.map +1 -0
- package/dist/structures/network-graph.d.ts +174 -0
- package/dist/structures/network-graph.d.ts.map +1 -0
- package/dist/structures/network-graph.js +240 -0
- package/dist/structures/network-graph.js.map +1 -0
- package/dist/structures/sample-space.d.ts +114 -0
- package/dist/structures/sample-space.d.ts.map +1 -0
- package/dist/structures/sample-space.js +161 -0
- package/dist/structures/sample-space.js.map +1 -0
- package/dist/systems/axes2d.d.ts +197 -0
- package/dist/systems/axes2d.d.ts.map +1 -0
- package/dist/systems/axes2d.js +157 -0
- package/dist/systems/axes2d.js.map +1 -0
- package/dist/systems/number-line.d.ts +101 -0
- package/dist/systems/number-line.d.ts.map +1 -0
- package/dist/systems/number-line.js +91 -0
- package/dist/systems/number-line.js.map +1 -0
- package/dist/systems/number-plane.d.ts +168 -0
- package/dist/systems/number-plane.d.ts.map +1 -0
- package/dist/systems/number-plane.js +186 -0
- package/dist/systems/number-plane.js.map +1 -0
- package/dist/systems/polar-plane.d.ts +98 -0
- package/dist/systems/polar-plane.d.ts.map +1 -0
- package/dist/systems/polar-plane.js +139 -0
- package/dist/systems/polar-plane.js.map +1 -0
- package/dist/tex/geometry.d.ts +85 -0
- package/dist/tex/geometry.d.ts.map +1 -0
- package/dist/tex/geometry.js +632 -0
- package/dist/tex/geometry.js.map +1 -0
- package/dist/tex/index.d.ts +11 -0
- package/dist/tex/index.d.ts.map +1 -0
- package/dist/tex/index.js +10 -0
- package/dist/tex/index.js.map +1 -0
- package/dist/tex/mathjax.d.ts +33 -0
- package/dist/tex/mathjax.d.ts.map +1 -0
- package/dist/tex/mathjax.js +74 -0
- package/dist/tex/mathjax.js.map +1 -0
- package/dist/tex/matrix.d.ts +101 -0
- package/dist/tex/matrix.d.ts.map +1 -0
- package/dist/tex/matrix.js +56 -0
- package/dist/tex/matrix.js.map +1 -0
- package/dist/tex/node.d.ts +98 -0
- package/dist/tex/node.d.ts.map +1 -0
- package/dist/tex/node.js +25 -0
- package/dist/tex/node.js.map +1 -0
- package/dist/tex/tween.d.ts +50 -0
- package/dist/tex/tween.d.ts.map +1 -0
- package/dist/tex/tween.js +253 -0
- package/dist/tex/tween.js.map +1 -0
- package/dist/tex/typeset.d.ts +133 -0
- package/dist/tex/typeset.d.ts.map +1 -0
- package/dist/tex/typeset.js +403 -0
- package/dist/tex/typeset.js.map +1 -0
- package/dist/three/axes3d.d.ts +247 -0
- package/dist/three/axes3d.d.ts.map +1 -0
- package/dist/three/axes3d.js +187 -0
- package/dist/three/axes3d.js.map +1 -0
- package/dist/three/curve-plot3d.d.ts +126 -0
- package/dist/three/curve-plot3d.d.ts.map +1 -0
- package/dist/three/curve-plot3d.js +109 -0
- package/dist/three/curve-plot3d.js.map +1 -0
- package/dist/three/entries.d.ts +17 -0
- package/dist/three/entries.d.ts.map +1 -0
- package/dist/three/entries.js +15 -0
- package/dist/three/entries.js.map +1 -0
- package/dist/three/label3d.d.ts +11 -0
- package/dist/three/label3d.d.ts.map +1 -0
- package/dist/three/label3d.js +42 -0
- package/dist/three/label3d.js.map +1 -0
- package/dist/three/plot-point3d.d.ts +99 -0
- package/dist/three/plot-point3d.d.ts.map +1 -0
- package/dist/three/plot-point3d.js +34 -0
- package/dist/three/plot-point3d.js.map +1 -0
- package/dist/three/space.d.ts +43 -0
- package/dist/three/space.d.ts.map +1 -0
- package/dist/three/space.js +58 -0
- package/dist/three/space.js.map +1 -0
- package/dist/three/surface-plot3d.d.ts +207 -0
- package/dist/three/surface-plot3d.d.ts.map +1 -0
- package/dist/three/surface-plot3d.js +261 -0
- package/dist/three/surface-plot3d.js.map +1 -0
- package/dist/three/vector-arrow3d.d.ts +96 -0
- package/dist/three/vector-arrow3d.d.ts.map +1 -0
- package/dist/three/vector-arrow3d.js +53 -0
- package/dist/three/vector-arrow3d.js.map +1 -0
- package/package.json +80 -3
- package/registry.json +251 -0
- package/src/annotate/angle-mark.ts +137 -0
- package/src/annotate/curly-brace.ts +148 -0
- package/src/annotate/emphasis-mark.ts +118 -0
- package/src/engine.ts +86 -0
- package/src/index.ts +29 -0
- package/src/kit/brace.ts +37 -0
- package/src/kit/cache.ts +61 -0
- package/src/kit/component.ts +57 -0
- package/src/kit/contour.ts +94 -0
- package/src/kit/coords.ts +278 -0
- package/src/kit/curve.ts +47 -0
- package/src/kit/equation.ts +181 -0
- package/src/kit/equation3d.ts +137 -0
- package/src/kit/expression.ts +159 -0
- package/src/kit/field-mark.ts +171 -0
- package/src/kit/field.ts +50 -0
- package/src/kit/follow.ts +229 -0
- package/src/kit/furniture.ts +113 -0
- package/src/kit/geometry.ts +49 -0
- package/src/kit/graph.ts +116 -0
- package/src/kit/mark.ts +152 -0
- package/src/kit/part-fills.ts +61 -0
- package/src/kit/place.ts +77 -0
- package/src/kit/sampler.ts +281 -0
- package/src/kit/scale.ts +39 -0
- package/src/kit/source.ts +57 -0
- package/src/kit/system.ts +105 -0
- package/src/kit/ticks.ts +85 -0
- package/src/kit/withdrawn.ts +8 -0
- package/src/marks/curve-area.ts +89 -0
- package/src/marks/drop-lines.ts +71 -0
- package/src/marks/plot-point.ts +102 -0
- package/src/marks/riemann-sum.ts +99 -0
- package/src/marks/tangent-line.ts +119 -0
- package/src/marks/vector-arrow.ts +98 -0
- package/src/nodes.ts +99 -0
- package/src/plots/function-plot.ts +220 -0
- package/src/plots/points-plot.ts +103 -0
- package/src/plots/stream-lines.ts +160 -0
- package/src/plots/traced-path.ts +70 -0
- package/src/plots/vector-field.ts +107 -0
- package/src/structures/graph-layout.ts +145 -0
- package/src/structures/network-graph.ts +291 -0
- package/src/structures/sample-space.ts +210 -0
- package/src/systems/axes2d.ts +226 -0
- package/src/systems/number-line.ts +130 -0
- package/src/systems/number-plane.ts +232 -0
- package/src/systems/polar-plane.ts +177 -0
- package/src/tex/geometry.ts +703 -0
- package/src/tex/index.ts +15 -0
- package/src/tex/mathjax.ts +82 -0
- package/src/tex/matrix.ts +97 -0
- package/src/tex/node.ts +74 -0
- package/src/tex/tween.ts +308 -0
- package/src/tex/typeset.ts +461 -0
- package/src/three/axes3d.ts +267 -0
- package/src/three/curve-plot3d.ts +146 -0
- package/src/three/entries.ts +42 -0
- package/src/three/label3d.ts +52 -0
- package/src/three/plot-point3d.ts +63 -0
- package/src/three/space.ts +92 -0
- package/src/three/surface-plot3d.ts +318 -0
- package/src/three/vector-arrow3d.ts +88 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { type Canvas3DProps, type Color, type NodeOf, type Alignment as _Alignment, type CornerRadiusResolved as _CornerRadiusResolved, type CornerStyleResolved as _CornerStyleResolved, type Fill as _Fill, type FillResolved as _FillResolved, type FlowMode as _FlowMode, type FlowResolved as _FlowResolved, type GapSize as _GapSize, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type NormalizedColor as _NormalizedColor, type PostEffect3D as _PostEffect3D, type RectCornerRadius as _RectCornerRadius, type RectCornerStyle as _RectCornerStyle, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Shadows3D as _Shadows3D, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved, type ToneMapping3D as _ToneMapping3D, type Vector2 as _Vector2 } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
3
|
+
export interface Axes3dProps extends Canvas3DProps {
|
|
4
|
+
xRange?: Interval;
|
|
5
|
+
yRange?: Interval;
|
|
6
|
+
zRange?: Interval;
|
|
7
|
+
xLength?: number;
|
|
8
|
+
yLength?: number;
|
|
9
|
+
zLength?: number;
|
|
10
|
+
xStep?: number;
|
|
11
|
+
yStep?: number;
|
|
12
|
+
zStep?: number;
|
|
13
|
+
color?: Color;
|
|
14
|
+
thickness?: number;
|
|
15
|
+
tips?: boolean;
|
|
16
|
+
ticks?: boolean;
|
|
17
|
+
tickSize?: number;
|
|
18
|
+
grid?: boolean;
|
|
19
|
+
gridLineColor?: Color;
|
|
20
|
+
labels?: boolean;
|
|
21
|
+
labelSize?: number;
|
|
22
|
+
labelColor?: Color;
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
xLabel?: string;
|
|
25
|
+
yLabel?: string;
|
|
26
|
+
zLabel?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A 3D graph: three axes through a box of graph coordinates, z up, seen through
|
|
30
|
+
* a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
|
|
31
|
+
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
32
|
+
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
33
|
+
*/
|
|
34
|
+
export declare const Axes3d: import("@motionscript/sdk").Component<"axes3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
35
|
+
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
36
|
+
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
37
|
+
readonly zRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
38
|
+
readonly xLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
39
|
+
readonly yLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
40
|
+
readonly zLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
41
|
+
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
42
|
+
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
43
|
+
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
44
|
+
readonly color: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
45
|
+
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
|
+
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
47
|
+
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
48
|
+
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
49
|
+
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
50
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
51
|
+
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
52
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
53
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
54
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
55
|
+
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
56
|
+
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
57
|
+
readonly zLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
58
|
+
readonly orbit: import("@motionscript/sdk").Type<number, number, false>;
|
|
59
|
+
readonly elevation: import("@motionscript/sdk").Type<number, number, false>;
|
|
60
|
+
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
61
|
+
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
|
+
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
63
|
+
readonly ambientColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
64
|
+
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
65
|
+
readonly keyColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
66
|
+
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
67
|
+
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
68
|
+
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
69
|
+
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
70
|
+
readonly gridColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
71
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
72
|
+
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
73
|
+
readonly axisXColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
74
|
+
readonly axisZColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
75
|
+
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
76
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
77
|
+
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
78
|
+
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
79
|
+
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
80
|
+
readonly tone: import("@motionscript/sdk").Type<_ToneMapping3D | undefined, _ToneMapping3D | undefined, false>;
|
|
81
|
+
readonly exposure: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
82
|
+
readonly post: import("@motionscript/sdk").Type<_PostEffect3D | readonly _PostEffect3D[] | undefined, _PostEffect3D | readonly _PostEffect3D[] | undefined, false>;
|
|
83
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
84
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
85
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
86
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
87
|
+
readonly wrap: boolean;
|
|
88
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
89
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
90
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
91
|
+
readonly fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
92
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
93
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
94
|
+
readonly overlay: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
95
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
96
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
97
|
+
}>, {
|
|
98
|
+
readonly rangeTo: readonly ["xRange", "yRange", "zRange"];
|
|
99
|
+
readonly orbitTo: readonly ["orbit", "elevation", "zoom"];
|
|
100
|
+
readonly fillTo: readonly ["fill"];
|
|
101
|
+
readonly strokeTo: readonly ["stroke"];
|
|
102
|
+
readonly shadowTo: readonly ["shadow"];
|
|
103
|
+
readonly overlayTo: readonly ["overlay"];
|
|
104
|
+
readonly progressTo: readonly ["start", "end"];
|
|
105
|
+
readonly flash: {
|
|
106
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
107
|
+
};
|
|
108
|
+
}, readonly ["2d", "3d"], _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
109
|
+
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
110
|
+
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
111
|
+
readonly zRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
112
|
+
readonly xLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
113
|
+
readonly yLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
114
|
+
readonly zLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
115
|
+
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
116
|
+
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
|
+
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
118
|
+
readonly color: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
119
|
+
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
|
+
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
121
|
+
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
122
|
+
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
123
|
+
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
124
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
125
|
+
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
126
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
127
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
128
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
129
|
+
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
130
|
+
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
131
|
+
readonly zLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
132
|
+
readonly orbit: import("@motionscript/sdk").Type<number, number, false>;
|
|
133
|
+
readonly elevation: import("@motionscript/sdk").Type<number, number, false>;
|
|
134
|
+
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
135
|
+
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
136
|
+
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
137
|
+
readonly ambientColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
138
|
+
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
139
|
+
readonly keyColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
140
|
+
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
141
|
+
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
142
|
+
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
|
+
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
144
|
+
readonly gridColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
145
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
146
|
+
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
147
|
+
readonly axisXColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
148
|
+
readonly axisZColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
149
|
+
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
150
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
151
|
+
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
152
|
+
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
153
|
+
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
154
|
+
readonly tone: import("@motionscript/sdk").Type<_ToneMapping3D | undefined, _ToneMapping3D | undefined, false>;
|
|
155
|
+
readonly exposure: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
156
|
+
readonly post: import("@motionscript/sdk").Type<_PostEffect3D | readonly _PostEffect3D[] | undefined, _PostEffect3D | readonly _PostEffect3D[] | undefined, false>;
|
|
157
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
158
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
159
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
160
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
161
|
+
readonly wrap: boolean;
|
|
162
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
163
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
164
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
165
|
+
readonly fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
166
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
167
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
168
|
+
readonly overlay: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
169
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
170
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
171
|
+
}>, readonly ["2d", "3d"], import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
172
|
+
readonly xRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
173
|
+
readonly yRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
174
|
+
readonly zRange: import("@motionscript/sdk").Type<Interval, Interval, false>;
|
|
175
|
+
readonly xLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
176
|
+
readonly yLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
177
|
+
readonly zLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
178
|
+
readonly xStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
179
|
+
readonly yStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
180
|
+
readonly zStep: import("@motionscript/sdk").Type<number, number, false>;
|
|
181
|
+
readonly color: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
182
|
+
readonly thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
183
|
+
readonly tips: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
184
|
+
readonly ticks: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
185
|
+
readonly tickSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
186
|
+
readonly grid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
187
|
+
readonly gridLineColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
188
|
+
readonly labels: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
189
|
+
readonly labelSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
190
|
+
readonly labelColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
191
|
+
readonly fontFamily: import("@motionscript/sdk").Type<string, string, false>;
|
|
192
|
+
readonly xLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
193
|
+
readonly yLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
194
|
+
readonly zLabel: import("@motionscript/sdk").Type<string, string, false>;
|
|
195
|
+
readonly orbit: import("@motionscript/sdk").Type<number, number, false>;
|
|
196
|
+
readonly elevation: import("@motionscript/sdk").Type<number, number, false>;
|
|
197
|
+
readonly zoom: import("@motionscript/sdk").Type<number, number, false>;
|
|
198
|
+
readonly fov: import("@motionscript/sdk").Type<number, number, false>;
|
|
199
|
+
readonly ambientIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
200
|
+
readonly ambientColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
201
|
+
readonly keyIntensity: import("@motionscript/sdk").Type<number, number, false>;
|
|
202
|
+
readonly keyColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
203
|
+
readonly showGrid: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
204
|
+
readonly gridSize: import("@motionscript/sdk").Type<number, number, false>;
|
|
205
|
+
readonly gridDivisions: import("@motionscript/sdk").Type<number, number, false>;
|
|
206
|
+
readonly gridMajorEvery: import("@motionscript/sdk").Type<number, number, false>;
|
|
207
|
+
readonly gridColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
208
|
+
readonly gridMajorColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
209
|
+
readonly showAxes: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
210
|
+
readonly axisXColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
211
|
+
readonly axisZColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
212
|
+
readonly gridFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
213
|
+
readonly gridFadeColor: import("@motionscript/sdk").Type<Color, _NormalizedColor, false>;
|
|
214
|
+
readonly maxPixelRatio: import("@motionscript/sdk").Type<number, number, false>;
|
|
215
|
+
readonly antialias: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
216
|
+
readonly shadows: import("@motionscript/sdk").Type<_Shadows3D, _Shadows3D, false>;
|
|
217
|
+
readonly tone: import("@motionscript/sdk").Type<_ToneMapping3D | undefined, _ToneMapping3D | undefined, false>;
|
|
218
|
+
readonly exposure: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
219
|
+
readonly post: import("@motionscript/sdk").Type<_PostEffect3D | readonly _PostEffect3D[] | undefined, _PostEffect3D | readonly _PostEffect3D[] | undefined, false>;
|
|
220
|
+
readonly cornerRadius: import("@motionscript/sdk").Attribute<_RectCornerRadius, _CornerRadiusResolved>;
|
|
221
|
+
readonly cornerStyle: import("@motionscript/sdk").Attribute<_RectCornerStyle, _CornerStyleResolved>;
|
|
222
|
+
readonly flow: import("@motionscript/sdk").Type<_FlowMode, _FlowResolved, false>;
|
|
223
|
+
readonly gap: import("@motionscript/sdk").Type<_GapSize, _GapSize, false>;
|
|
224
|
+
readonly wrap: boolean;
|
|
225
|
+
readonly crossGap: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
226
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
227
|
+
readonly align: import("@motionscript/sdk").Attribute<_Alignment, _Vector2>;
|
|
228
|
+
readonly fill: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
229
|
+
readonly stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
230
|
+
readonly shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
231
|
+
readonly overlay: import("@motionscript/sdk").Attribute<_Fill, _FillResolved[]>;
|
|
232
|
+
readonly start: import("@motionscript/sdk").Type<number, number, false>;
|
|
233
|
+
readonly end: import("@motionscript/sdk").Type<number, number, false>;
|
|
234
|
+
}>, {
|
|
235
|
+
readonly rangeTo: readonly ["xRange", "yRange", "zRange"];
|
|
236
|
+
readonly orbitTo: readonly ["orbit", "elevation", "zoom"];
|
|
237
|
+
readonly fillTo: readonly ["fill"];
|
|
238
|
+
readonly strokeTo: readonly ["stroke"];
|
|
239
|
+
readonly shadowTo: readonly ["shadow"];
|
|
240
|
+
readonly overlayTo: readonly ["overlay"];
|
|
241
|
+
readonly progressTo: readonly ["start", "end"];
|
|
242
|
+
readonly flash: {
|
|
243
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
244
|
+
};
|
|
245
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
246
|
+
export type Axes3d = NodeOf<typeof Axes3d>;
|
|
247
|
+
//# sourceMappingURL=axes3d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axes3d.d.ts","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAWH,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,MAAM,EAOX,KAAK,SAAS,IAAI,UAAU,EAC5B,KAAK,oBAAoB,IAAI,qBAAqB,EAClD,KAAK,mBAAmB,IAAI,oBAAoB,EAChD,KAAK,IAAI,IAAI,KAAK,EAClB,KAAK,YAAY,IAAI,aAAa,EAClC,KAAK,QAAQ,IAAI,SAAS,EAC1B,KAAK,YAAY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CAAC,EAAE,KAAK,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAsDD;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAoBjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { component2d, Flow, Geo, Graphics3D, Mat, Paint, provides, Shapes, Types, View3D, } from "@motionscript/sdk";
|
|
2
|
+
import { AXIS_COLOR, lerpInterval, readInterval } from "../kit/furniture.js";
|
|
3
|
+
import { clamp } from "../kit/geometry.js";
|
|
4
|
+
import { formatTick, ticksFor } from "../kit/ticks.js";
|
|
5
|
+
import { drawLabel3D } from "./label3d.js";
|
|
6
|
+
import { GRAPH_3D, graphSpace } from "./space.js";
|
|
7
|
+
/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */
|
|
8
|
+
const UNIT_AS_PIXELS = 64;
|
|
9
|
+
/** The turn that lays a shape built along the scene's +y along each graph axis. */
|
|
10
|
+
const ALONG = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };
|
|
11
|
+
/** The graph axis each axis's tick marks lie along. */
|
|
12
|
+
const TICK_ALONG = { x: "y", y: "x", z: "y" };
|
|
13
|
+
function range(initial) {
|
|
14
|
+
return Types.custom(initial, { resolve: readInterval, lerp: lerpInterval });
|
|
15
|
+
}
|
|
16
|
+
/** The axes' own entries, beside a 3D canvas's. */
|
|
17
|
+
const own = {
|
|
18
|
+
xRange: range([-3, 3]),
|
|
19
|
+
yRange: range([-3, 3]),
|
|
20
|
+
zRange: range([-2, 2]),
|
|
21
|
+
/** How long each axis is drawn, in scene units. */
|
|
22
|
+
xLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
23
|
+
yLength: Types.number(6, { min: 0.01, step: 0.1 }),
|
|
24
|
+
zLength: Types.number(4, { min: 0.01, step: 0.1 }),
|
|
25
|
+
/** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */
|
|
26
|
+
xStep: Types.number(0, { min: 0 }),
|
|
27
|
+
yStep: Types.number(0, { min: 0 }),
|
|
28
|
+
zStep: Types.number(0, { min: 0 }),
|
|
29
|
+
color: Types.color(AXIS_COLOR),
|
|
30
|
+
/** The radius of an axis line, in scene units. */
|
|
31
|
+
thickness: Types.number(0.02, { min: 0, step: 0.005 }),
|
|
32
|
+
tips: Types.boolean(true, { animatable: false }),
|
|
33
|
+
ticks: Types.boolean(true, { animatable: false }),
|
|
34
|
+
tickSize: Types.number(0.16, { min: 0, step: 0.01 }),
|
|
35
|
+
/** Lines across the plane the x and y axes lie in, at each of their ticks. */
|
|
36
|
+
grid: Types.boolean(false, { animatable: false }),
|
|
37
|
+
/** (`gridColor` is the viewport's own reference grid.) */
|
|
38
|
+
gridLineColor: Types.color("#374151"),
|
|
39
|
+
/** A number at each tick. */
|
|
40
|
+
labels: Types.boolean(false, { animatable: false }),
|
|
41
|
+
/** The height of a label's text, in scene units. */
|
|
42
|
+
labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),
|
|
43
|
+
labelColor: Types.color(AXIS_COLOR),
|
|
44
|
+
fontFamily: Types.text("", { animatable: false }),
|
|
45
|
+
/** A title at the positive end of each axis. */
|
|
46
|
+
xLabel: Types.text("x", { animatable: false }),
|
|
47
|
+
yLabel: Types.text("y", { animatable: false }),
|
|
48
|
+
zLabel: Types.text("z", { animatable: false }),
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A 3D graph: three axes through a box of graph coordinates, z up, seen through
|
|
52
|
+
* a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`
|
|
53
|
+
* does. Its 3D children sit in its graph coordinates: a surface, a space curve,
|
|
54
|
+
* a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.
|
|
55
|
+
*/
|
|
56
|
+
export const Axes3d = component2d({
|
|
57
|
+
key: "axes3d",
|
|
58
|
+
state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },
|
|
59
|
+
defaults: { width: "fill", height: "fill" },
|
|
60
|
+
commands: {
|
|
61
|
+
...Paint.commands,
|
|
62
|
+
...View3D.commands,
|
|
63
|
+
/** Animate the window of values the axes show; everything drawn in them follows. */
|
|
64
|
+
rangeTo: { args: ["xRange", "yRange", "zRange"] },
|
|
65
|
+
},
|
|
66
|
+
allowedChildren: ["2d", "3d"],
|
|
67
|
+
load: (loader, s) => {
|
|
68
|
+
View3D.load(loader, furnish(s));
|
|
69
|
+
if (s.fontFamily !== "")
|
|
70
|
+
loader.font(s.fontFamily);
|
|
71
|
+
},
|
|
72
|
+
provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],
|
|
73
|
+
space: (s) => axesSpace(s),
|
|
74
|
+
measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),
|
|
75
|
+
layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),
|
|
76
|
+
render: (ctx, s) => View3D.draw(ctx, s, furnish(s)),
|
|
77
|
+
});
|
|
78
|
+
/** The axes' own drawing, added to the scene: what `render` draws and `load` declares. */
|
|
79
|
+
function furnish(s) {
|
|
80
|
+
return (scene) => scene.draw(furniture(s));
|
|
81
|
+
}
|
|
82
|
+
/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */
|
|
83
|
+
const spaces = new WeakMap();
|
|
84
|
+
/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */
|
|
85
|
+
function axesSpace(s) {
|
|
86
|
+
const { xRange, yRange, zRange, xLength, yLength, zLength } = s;
|
|
87
|
+
const key = [xRange, yRange, zRange, xLength, yLength, zLength].join("|");
|
|
88
|
+
let kept = spaces.get(s);
|
|
89
|
+
if (kept?.key !== key)
|
|
90
|
+
spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));
|
|
91
|
+
return kept.space;
|
|
92
|
+
}
|
|
93
|
+
// One per axes, so the context its subtree holds is the same from frame to frame.
|
|
94
|
+
const graphs = new WeakMap();
|
|
95
|
+
function graphOfAxes(s) {
|
|
96
|
+
let graph = graphs.get(s);
|
|
97
|
+
if (!graph)
|
|
98
|
+
graphs.set(s, (graph = { space: () => axesSpace(s) }));
|
|
99
|
+
return graph;
|
|
100
|
+
}
|
|
101
|
+
/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */
|
|
102
|
+
function furniture(s) {
|
|
103
|
+
const space = axesSpace(s);
|
|
104
|
+
const g3 = new Graphics3D();
|
|
105
|
+
const ranges = { x: space.xRange, y: space.yRange, z: space.zRange };
|
|
106
|
+
const lengths = { x: s.xLength, y: s.yLength, z: s.zLength };
|
|
107
|
+
const steps = { x: s.xStep, y: s.yStep, z: s.zStep };
|
|
108
|
+
const titles = { x: s.xLabel, y: s.yLabel, z: s.zLabel };
|
|
109
|
+
// Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.
|
|
110
|
+
const cross = {
|
|
111
|
+
x: clamp(0, ranges.x[0], ranges.x[1]),
|
|
112
|
+
y: clamp(0, ranges.y[0], ranges.y[1]),
|
|
113
|
+
z: clamp(0, ranges.z[0], ranges.z[1]),
|
|
114
|
+
};
|
|
115
|
+
const at = (axis, value, shift = {}) => {
|
|
116
|
+
const point = { ...cross, [axis]: value };
|
|
117
|
+
const local = space.toLocal(point.x, point.y, point.z);
|
|
118
|
+
const moved = space.offset(0, 0, 0);
|
|
119
|
+
for (const key of ["x", "y", "z"]) {
|
|
120
|
+
const by = shift[key];
|
|
121
|
+
if (by === undefined)
|
|
122
|
+
continue;
|
|
123
|
+
// A shift is in scene units, along the graph axis it names.
|
|
124
|
+
if (key === "x")
|
|
125
|
+
moved.z += by;
|
|
126
|
+
else if (key === "y")
|
|
127
|
+
moved.x += by;
|
|
128
|
+
else
|
|
129
|
+
moved.y += by;
|
|
130
|
+
}
|
|
131
|
+
return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };
|
|
132
|
+
};
|
|
133
|
+
const { thickness, tickSize } = s;
|
|
134
|
+
const paint = Mat.basic({ color: s.color });
|
|
135
|
+
const style = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };
|
|
136
|
+
const tipLength = s.tips ? thickness * 9 : 0;
|
|
137
|
+
const marks = [];
|
|
138
|
+
const plane = [];
|
|
139
|
+
for (const axis of ["x", "y", "z"]) {
|
|
140
|
+
const [min, max] = ranges[axis];
|
|
141
|
+
const length = lengths[axis];
|
|
142
|
+
if (!(max > min) || !(length > 0))
|
|
143
|
+
continue;
|
|
144
|
+
if (thickness > 0) {
|
|
145
|
+
const from = at(axis, min);
|
|
146
|
+
const to = at(axis, max);
|
|
147
|
+
g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {
|
|
148
|
+
position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },
|
|
149
|
+
rotation: ALONG[axis],
|
|
150
|
+
});
|
|
151
|
+
if (s.tips) {
|
|
152
|
+
g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {
|
|
153
|
+
position: at(axis, max, { [axis]: tipLength / 2 }),
|
|
154
|
+
rotation: ALONG[axis],
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);
|
|
159
|
+
const side = TICK_ALONG[axis];
|
|
160
|
+
for (const value of ticks.values) {
|
|
161
|
+
// The crossing is marked by the other axes, and the far end by the tip.
|
|
162
|
+
if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9))
|
|
163
|
+
continue;
|
|
164
|
+
if (s.ticks && tickSize > 0)
|
|
165
|
+
marks.push({ position: at(axis, value), rotation: ALONG[side] });
|
|
166
|
+
if (s.labels) {
|
|
167
|
+
drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);
|
|
171
|
+
if (s.grid && axis !== "z") {
|
|
172
|
+
const other = axis === "x" ? "y" : "x";
|
|
173
|
+
for (const value of ticks.values) {
|
|
174
|
+
const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };
|
|
175
|
+
const b = { ...a, [other]: ranges[other][1] };
|
|
176
|
+
plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (marks.length > 0) {
|
|
181
|
+
g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);
|
|
182
|
+
}
|
|
183
|
+
if (plane.length > 0)
|
|
184
|
+
g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });
|
|
185
|
+
return g3;
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=axes3d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"axes3d.js","sourceRoot":"","sources":["../../src/three/axes3d.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,IAAI,EACJ,GAAG,EACH,UAAU,EACV,GAAG,EACH,KAAK,EACL,QAAQ,EACR,MAAM,EAC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EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/H,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IACpG,OAAO,EAAE,CAAC;AACd,CAAC","sourcesContent":["import {\n component2d,\n Flow,\n Geo,\n Graphics3D,\n Mat,\n Paint,\n provides,\n Shapes,\n Types,\n View3D,\n type Canvas3DProps,\n type Color,\n type NodeOf,\n type Scene3D,\n type Transform3D,\n type Values,\n type Vector3,\n type Vector3Input,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Alignment as _Alignment,\n type CornerRadiusResolved as _CornerRadiusResolved,\n type CornerStyleResolved as _CornerStyleResolved,\n type Fill as _Fill,\n type FillResolved as _FillResolved,\n type FlowMode as _FlowMode,\n type FlowResolved as _FlowResolved,\n type GapSize as _GapSize,\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n type NormalizedColor as _NormalizedColor,\n type PostEffect3D as _PostEffect3D,\n type RectCornerRadius as _RectCornerRadius,\n type RectCornerStyle as _RectCornerStyle,\n type Shadow as _Shadow,\n type ShadowResolved as _ShadowResolved,\n type Shadows3D as _Shadows3D,\n type Stroke as _Stroke,\n type StrokeResolved as _StrokeResolved,\n type ToneMapping3D as _ToneMapping3D,\n type Vector2 as _Vector2,\n} from \"@motionscript/sdk\";\nimport type { Interval } from \"../kit/coords\";\nimport { AXIS_COLOR, lerpInterval, readInterval } from \"../kit/furniture\";\nimport { clamp } from \"../kit/geometry\";\nimport { formatTick, ticksFor } from \"../kit/ticks\";\nimport { drawLabel3D, type LabelStyle3D } from \"./label3d\";\nimport { GRAPH_3D, graphSpace, type Graph3D, type GraphSpace } from \"./space\";\n\nexport interface Axes3dProps extends Canvas3DProps {\n xRange?: Interval;\n yRange?: Interval;\n zRange?: Interval;\n xLength?: number;\n yLength?: number;\n zLength?: number;\n xStep?: number;\n yStep?: number;\n zStep?: number;\n color?: Color;\n thickness?: number;\n tips?: boolean;\n ticks?: boolean;\n tickSize?: number;\n grid?: boolean;\n gridLineColor?: Color;\n labels?: boolean;\n labelSize?: number;\n labelColor?: Color;\n fontFamily?: string;\n xLabel?: string;\n yLabel?: string;\n zLabel?: string;\n}\n\n/** How many pixels of a 2D axis one scene unit counts as, when an axis picks its own tick spacing. */\nconst UNIT_AS_PIXELS = 64;\n\ntype AxisName = \"x\" | \"y\" | \"z\";\n\n/** The turn that lays a shape built along the scene's +y along each graph axis. */\nconst ALONG: Record<AxisName, Vector3Input> = { x: [90, 0, 0], y: [0, 0, -90], z: [0, 0, 0] };\n\n/** The graph axis each axis's tick marks lie along. */\nconst TICK_ALONG: Record<AxisName, AxisName> = { x: \"y\", y: \"x\", z: \"y\" };\n\nfunction range(initial: Interval) {\n return Types.custom<Interval>(initial, { resolve: readInterval, lerp: lerpInterval });\n}\n\n/** The axes' own entries, beside a 3D canvas's. */\nconst own = {\n xRange: range([-3, 3]),\n yRange: range([-3, 3]),\n zRange: range([-2, 2]),\n /** How long each axis is drawn, in scene units. */\n xLength: Types.number(6, { min: 0.01, step: 0.1 }),\n yLength: Types.number(6, { min: 0.01, step: 0.1 }),\n zLength: Types.number(4, { min: 0.01, step: 0.1 }),\n /** The spacing of each axis's ticks; zero picks a tidy one for the axis's length. */\n xStep: Types.number(0, { min: 0 }),\n yStep: Types.number(0, { min: 0 }),\n zStep: Types.number(0, { min: 0 }),\n color: Types.color(AXIS_COLOR),\n /** The radius of an axis line, in scene units. */\n thickness: Types.number(0.02, { min: 0, step: 0.005 }),\n tips: Types.boolean(true, { animatable: false }),\n ticks: Types.boolean(true, { animatable: false }),\n tickSize: Types.number(0.16, { min: 0, step: 0.01 }),\n /** Lines across the plane the x and y axes lie in, at each of their ticks. */\n grid: Types.boolean(false, { animatable: false }),\n /** (`gridColor` is the viewport's own reference grid.) */\n gridLineColor: Types.color(\"#374151\"),\n /** A number at each tick. */\n labels: Types.boolean(false, { animatable: false }),\n /** The height of a label's text, in scene units. */\n labelSize: Types.number(0.26, { min: 0.01, step: 0.01 }),\n labelColor: Types.color(AXIS_COLOR),\n fontFamily: Types.text(\"\", { animatable: false }),\n /** A title at the positive end of each axis. */\n xLabel: Types.text(\"x\", { animatable: false }),\n yLabel: Types.text(\"y\", { animatable: false }),\n zLabel: Types.text(\"z\", { animatable: false }),\n};\n\ntype AxesValues = Values<typeof own>;\n\n/**\n * A 3D graph: three axes through a box of graph coordinates, z up, seen through\n * a camera of its own, so it stands on a 2D stage as it is, the way `axes2d`\n * does. Its 3D children sit in its graph coordinates: a surface, a space curve,\n * a point, an arrow, or any 3D node. `orbitTo` swings the camera round it.\n */\nexport const Axes3d = component2d({\n key: \"axes3d\",\n state: { ...Paint.state, ...Flow.state, ...Shapes.corners, ...View3D.state, ...own },\n defaults: { width: \"fill\", height: \"fill\" },\n commands: {\n ...Paint.commands,\n ...View3D.commands,\n /** Animate the window of values the axes show; everything drawn in them follows. */\n rangeTo: { args: [\"xRange\", \"yRange\", \"zRange\"] },\n },\n allowedChildren: [\"2d\", \"3d\"],\n load: (loader, s) => {\n View3D.load(loader, furnish(s));\n if (s.fontFamily !== \"\") loader.font(s.fontFamily);\n },\n provide: (s) => [provides(GRAPH_3D, graphOfAxes(s))],\n space: (s) => axesSpace(s),\n measure: (measurer, s, children) => Flow.measure(measurer, s, children, Paint.inset(s)),\n layout: (box, s, children) => Flow.layout(box, s, children, Paint.inset(s)),\n render: (ctx, s) => View3D.draw(ctx, s, furnish(s)),\n});\n\nexport type Axes3d = NodeOf<typeof Axes3d>;\n\n/** The axes' own drawing, added to the scene: what `render` draws and `load` declares. */\nfunction furnish(s: AxesValues): (scene: Scene3D) => void {\n return (scene) => scene.draw(furniture(s));\n}\n\n/** The last space worked out for each axes, kept while its ranges and lengths are unchanged. */\nconst spaces = new WeakMap<object, { readonly key: string; readonly space: GraphSpace }>();\n\n/** The coordinates of a 3D graph: what its children's `x`, `y` and `z` are in. */\nfunction axesSpace(s: AxesValues): GraphSpace {\n const { xRange, yRange, zRange, xLength, yLength, zLength } = s;\n const key = [xRange, yRange, zRange, xLength, yLength, zLength].join(\"|\");\n let kept = spaces.get(s);\n if (kept?.key !== key) spaces.set(s, (kept = { key, space: graphSpace(xRange, yRange, zRange, { x: xLength, y: yLength, z: zLength }) }));\n return kept.space;\n}\n\n// One per axes, so the context its subtree holds is the same from frame to frame.\nconst graphs = new WeakMap<object, Graph3D>();\n\nfunction graphOfAxes(s: AxesValues): Graph3D {\n let graph = graphs.get(s);\n if (!graph) graphs.set(s, (graph = { space: () => axesSpace(s) }));\n return graph;\n}\n\n/** The axes, their ticks, numbers and titles, and the grid, in the scene's units. */\nfunction furniture(s: AxesValues): Graphics3D {\n const space = axesSpace(s);\n const g3 = new Graphics3D();\n const ranges: Record<AxisName, Interval> = { x: space.xRange, y: space.yRange, z: space.zRange };\n const lengths: Record<AxisName, number> = { x: s.xLength, y: s.yLength, z: s.zLength };\n const steps: Record<AxisName, number> = { x: s.xStep, y: s.yStep, z: s.zStep };\n const titles: Record<AxisName, string> = { x: s.xLabel, y: s.yLabel, z: s.zLabel };\n // Where each axis is crossed by the other two: their zero, or the nearest end of a range without one.\n const cross: Record<AxisName, number> = {\n x: clamp(0, ranges.x[0], ranges.x[1]),\n y: clamp(0, ranges.y[0], ranges.y[1]),\n z: clamp(0, ranges.z[0], ranges.z[1]),\n };\n const at = (axis: AxisName, value: number, shift: Partial<Record<AxisName, number>> = {}): Vector3 => {\n const point = { ...cross, [axis]: value };\n const local = space.toLocal(point.x, point.y, point.z);\n const moved = space.offset(0, 0, 0);\n for (const key of [\"x\", \"y\", \"z\"] as const) {\n const by = shift[key];\n if (by === undefined) continue;\n // A shift is in scene units, along the graph axis it names.\n if (key === \"x\") moved.z += by;\n else if (key === \"y\") moved.x += by;\n else moved.y += by;\n }\n return { x: local.x + moved.x, y: local.y + moved.y, z: local.z + moved.z };\n };\n\n const { thickness, tickSize } = s;\n const paint = Mat.basic({ color: s.color });\n const style: LabelStyle3D = { size: s.labelSize, color: s.labelColor, fontFamily: s.fontFamily };\n const tipLength = s.tips ? thickness * 9 : 0;\n const marks: Transform3D[] = [];\n const plane: Vector3[] = [];\n\n for (const axis of [\"x\", \"y\", \"z\"] as const) {\n const [min, max] = ranges[axis];\n const length = lengths[axis];\n if (!(max > min) || !(length > 0)) continue;\n\n if (thickness > 0) {\n const from = at(axis, min);\n const to = at(axis, max);\n g3.mesh(Geo.cylinder({ radius: thickness, height: length, segments: [12, 1] }), paint, {\n position: { x: (from.x + to.x) / 2, y: (from.y + to.y) / 2, z: (from.z + to.z) / 2 },\n rotation: ALONG[axis],\n });\n if (s.tips) {\n g3.mesh(Geo.cone({ radius: thickness * 3.2, height: tipLength, segments: [16, 1] }), paint, {\n position: at(axis, max, { [axis]: tipLength / 2 }),\n rotation: ALONG[axis],\n });\n }\n }\n\n const ticks = ticksFor(ranges[axis], steps[axis], length * UNIT_AS_PIXELS);\n const side = TICK_ALONG[axis];\n for (const value of ticks.values) {\n // The crossing is marked by the other axes, and the far end by the tip.\n if (Math.abs(value - cross[axis]) < 1e-9 || (s.tips && Math.abs(value - max) < 1e-9)) continue;\n if (s.ticks && tickSize > 0) marks.push({ position: at(axis, value), rotation: ALONG[side] });\n if (s.labels) {\n drawLabel3D(g3, formatTick(value, ticks.step), at(axis, value, { [side]: -(tickSize / 2 + style.size * 0.8) }), style);\n }\n }\n drawLabel3D(g3, titles[axis], at(axis, max, { [axis]: tipLength + style.size * 0.9 }), style);\n\n if (s.grid && axis !== \"z\") {\n const other = axis === \"x\" ? \"y\" : \"x\";\n for (const value of ticks.values) {\n const a = { x: 0, y: 0, z: cross.z, [axis]: value, [other]: ranges[other][0] };\n const b = { ...a, [other]: ranges[other][1] };\n plane.push(space.toLocal(a.x, a.y, a.z), space.toLocal(b.x, b.y, b.z));\n }\n }\n }\n\n if (marks.length > 0) {\n g3.instances(Geo.cylinder({ radius: Math.max(thickness * 0.7, 0.008), height: tickSize, segments: [8, 1] }), paint, marks);\n }\n if (plane.length > 0) g3.line({ points: plane, segments: true, stroke: { fill: s.gridLineColor } });\n return g3;\n}\n"]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { type Geometry3D, type Mesh3DProps, type NodeOf, type Blend3D as _Blend3D, type Color as _Color, type Faces3D as _Faces3D, type Fill3D as _Fill3D, type Material3D as _Material3D, type Node3D as _Node3D, type Node3DProps as _Node3DProps, type NormalizedColor as _NormalizedColor, type Shading3D as _Shading3D, type Texture3D as _Texture3D } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
3
|
+
import type { ExpressionScope } from "../kit/expression.js";
|
|
4
|
+
import { type PlotSource } from "../kit/source.js";
|
|
5
|
+
export interface CurvePlot3dProps extends Mesh3DProps {
|
|
6
|
+
expression?: string | PlotSource;
|
|
7
|
+
domain?: Interval | null;
|
|
8
|
+
params?: ExpressionScope;
|
|
9
|
+
samples?: number;
|
|
10
|
+
thickness?: number;
|
|
11
|
+
start?: number;
|
|
12
|
+
end?: number;
|
|
13
|
+
}
|
|
14
|
+
/** A curve through a 3D graph, three parts in `t`: `(cos(t), sin(t), t / 4)`. */
|
|
15
|
+
export declare const CurvePlot3d: import("@motionscript/sdk").Component<"curvePlot3d", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
16
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
17
|
+
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
18
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
19
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
20
|
+
/** How many points the curve is drawn through. */
|
|
21
|
+
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
22
|
+
/** The radius of the line, in scene units. */
|
|
23
|
+
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
24
|
+
/** The part of the curve that is drawn, as shares of its length in `t`. */
|
|
25
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
26
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
27
|
+
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
28
|
+
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
29
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
30
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
31
|
+
geometry: import("@motionscript/sdk").Type<Geometry3D | undefined, Geometry3D | undefined, false>;
|
|
32
|
+
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
33
|
+
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
34
|
+
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
35
|
+
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
36
|
+
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
37
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
38
|
+
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
39
|
+
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
40
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
41
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
42
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
43
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
44
|
+
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
45
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
46
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
47
|
+
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
48
|
+
}>, {
|
|
49
|
+
readonly morphTo: readonly ["expression"];
|
|
50
|
+
readonly paramsTo: readonly ["params"];
|
|
51
|
+
readonly domainTo: readonly ["domain"];
|
|
52
|
+
readonly progressTo: readonly ["start", "end"];
|
|
53
|
+
}, null, _Node3D<_Node3DProps>, import("@motionscript/sdk").CallProps3D<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
54
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
55
|
+
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
56
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
57
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
58
|
+
/** How many points the curve is drawn through. */
|
|
59
|
+
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
60
|
+
/** The radius of the line, in scene units. */
|
|
61
|
+
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
|
+
/** The part of the curve that is drawn, as shares of its length in `t`. */
|
|
63
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
64
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
65
|
+
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
66
|
+
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
67
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
68
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
69
|
+
geometry: import("@motionscript/sdk").Type<Geometry3D | undefined, Geometry3D | undefined, false>;
|
|
70
|
+
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
71
|
+
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
72
|
+
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
73
|
+
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
74
|
+
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
75
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
76
|
+
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
77
|
+
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
78
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
79
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
80
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
81
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
82
|
+
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
83
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
84
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
85
|
+
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
86
|
+
}>, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Transform3DState, {
|
|
87
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
88
|
+
/** The span of `t` that is drawn; 0 to 1 when left out. */
|
|
89
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
90
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
91
|
+
/** How many points the curve is drawn through. */
|
|
92
|
+
samples: import("@motionscript/sdk").Type<number, number, false>;
|
|
93
|
+
/** The radius of the line, in scene units. */
|
|
94
|
+
thickness: import("@motionscript/sdk").Type<number, number, false>;
|
|
95
|
+
/** The part of the curve that is drawn, as shares of its length in `t`. */
|
|
96
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
97
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
98
|
+
graph: import("@motionscript/sdk").Type<import("./space.js").Graph3D | null, import("./space.js").Graph3D | null, true>;
|
|
99
|
+
fill: import("@motionscript/sdk").Type<_Fill3D, _Fill3D, false>;
|
|
100
|
+
blend: import("@motionscript/sdk").Type<_Blend3D | undefined, _Blend3D | undefined, false>;
|
|
101
|
+
opacity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
102
|
+
geometry: import("@motionscript/sdk").Type<Geometry3D | undefined, Geometry3D | undefined, false>;
|
|
103
|
+
material: import("@motionscript/sdk").Type<_Material3D | readonly _Material3D[] | undefined, _Material3D | readonly _Material3D[] | undefined, false>;
|
|
104
|
+
roughness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
105
|
+
metalness: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
106
|
+
emission: import("@motionscript/sdk").Type<_Color | undefined, _NormalizedColor | undefined, false>;
|
|
107
|
+
emissionStrength: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
108
|
+
normalMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
109
|
+
roughnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
110
|
+
metalnessMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
111
|
+
aoMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
112
|
+
alphaMap: import("@motionscript/sdk").Type<_Texture3D | undefined, _Texture3D | undefined, false>;
|
|
113
|
+
envMapIntensity: import("@motionscript/sdk").Type<number | undefined, number | undefined, false>;
|
|
114
|
+
wireframe: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
115
|
+
shading: import("@motionscript/sdk").Type<_Shading3D | undefined, _Shading3D | undefined, false>;
|
|
116
|
+
faces: import("@motionscript/sdk").Type<_Faces3D | undefined, _Faces3D | undefined, false>;
|
|
117
|
+
vertexColors: import("@motionscript/sdk").Type<boolean | undefined, boolean | undefined, false>;
|
|
118
|
+
unlit: import("@motionscript/sdk").Type<boolean, boolean, false>;
|
|
119
|
+
}>, {
|
|
120
|
+
readonly morphTo: readonly ["expression"];
|
|
121
|
+
readonly paramsTo: readonly ["params"];
|
|
122
|
+
readonly domainTo: readonly ["domain"];
|
|
123
|
+
readonly progressTo: readonly ["start", "end"];
|
|
124
|
+
}, _Node3D<_Node3DProps>>>>;
|
|
125
|
+
export type CurvePlot3d = NodeOf<typeof CurvePlot3d>;
|
|
126
|
+
//# sourceMappingURL=curve-plot3d.d.ts.map
|