@motionscript/math 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 +22 -0
- package/README.md +39 -33
- package/dist/annotate/angle-mark.d.ts +52 -27
- package/dist/annotate/angle-mark.d.ts.map +1 -1
- package/dist/annotate/angle-mark.js +80 -115
- package/dist/annotate/angle-mark.js.map +1 -1
- package/dist/annotate/curly-brace.d.ts +59 -25
- package/dist/annotate/curly-brace.d.ts.map +1 -1
- package/dist/annotate/curly-brace.js +85 -100
- package/dist/annotate/curly-brace.js.map +1 -1
- package/dist/annotate/emphasis-mark.d.ts +43 -9
- package/dist/annotate/emphasis-mark.d.ts.map +1 -1
- package/dist/annotate/emphasis-mark.js +33 -34
- package/dist/annotate/emphasis-mark.js.map +1 -1
- package/dist/browser/chunks/chunk-ABYBW64J.js +2 -0
- package/dist/browser/chunks/chunk-ABYBW64J.js.map +7 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js +2 -0
- package/dist/browser/chunks/chunk-K77KLQX4.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/tex.js +1 -1
- package/dist/browser/tex.js.map +2 -2
- package/dist/engine.d.ts +26 -19
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +17 -14
- package/dist/engine.js.map +1 -1
- 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/curve.d.ts +22 -11
- package/dist/kit/curve.d.ts.map +1 -1
- package/dist/kit/curve.js +25 -18
- package/dist/kit/curve.js.map +1 -1
- package/dist/kit/field-mark.d.ts +58 -35
- package/dist/kit/field-mark.d.ts.map +1 -1
- package/dist/kit/field-mark.js +100 -120
- package/dist/kit/field-mark.js.map +1 -1
- package/dist/kit/follow.d.ts +67 -29
- package/dist/kit/follow.d.ts.map +1 -1
- package/dist/kit/follow.js +114 -110
- package/dist/kit/follow.js.map +1 -1
- package/dist/kit/furniture.d.ts +3 -1
- package/dist/kit/furniture.d.ts.map +1 -1
- package/dist/kit/furniture.js +5 -0
- package/dist/kit/furniture.js.map +1 -1
- 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 +64 -39
- package/dist/kit/mark.d.ts.map +1 -1
- package/dist/kit/mark.js +80 -96
- package/dist/kit/mark.js.map +1 -1
- package/dist/kit/place.d.ts +10 -8
- package/dist/kit/place.d.ts.map +1 -1
- package/dist/kit/place.js +28 -30
- package/dist/kit/place.js.map +1 -1
- package/dist/kit/system.d.ts +27 -29
- package/dist/kit/system.d.ts.map +1 -1
- package/dist/kit/system.js +62 -58
- package/dist/kit/system.js.map +1 -1
- package/dist/kit/withdrawn.d.ts +3 -3
- package/dist/kit/withdrawn.js +3 -3
- package/dist/kit/withdrawn.js.map +1 -1
- package/dist/marks/curve-area.d.ts +24 -18
- package/dist/marks/curve-area.d.ts.map +1 -1
- package/dist/marks/curve-area.js +50 -73
- package/dist/marks/curve-area.js.map +1 -1
- package/dist/marks/drop-lines.d.ts +28 -10
- package/dist/marks/drop-lines.d.ts.map +1 -1
- package/dist/marks/drop-lines.js +37 -52
- package/dist/marks/drop-lines.js.map +1 -1
- package/dist/marks/plot-point.d.ts +37 -20
- package/dist/marks/plot-point.d.ts.map +1 -1
- package/dist/marks/plot-point.js +65 -91
- package/dist/marks/plot-point.js.map +1 -1
- package/dist/marks/riemann-sum.d.ts +30 -26
- package/dist/marks/riemann-sum.d.ts.map +1 -1
- package/dist/marks/riemann-sum.js +57 -85
- package/dist/marks/riemann-sum.js.map +1 -1
- package/dist/marks/tangent-line.d.ts +38 -14
- package/dist/marks/tangent-line.d.ts.map +1 -1
- package/dist/marks/tangent-line.js +73 -87
- package/dist/marks/tangent-line.js.map +1 -1
- package/dist/marks/vector-arrow.d.ts +30 -20
- package/dist/marks/vector-arrow.d.ts.map +1 -1
- package/dist/marks/vector-arrow.js +58 -78
- package/dist/marks/vector-arrow.js.map +1 -1
- package/dist/nodes.d.ts +13 -5
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +0 -6
- package/dist/nodes.js.map +1 -1
- package/dist/plots/function-plot.d.ts +107 -43
- package/dist/plots/function-plot.d.ts.map +1 -1
- package/dist/plots/function-plot.js +146 -177
- package/dist/plots/function-plot.js.map +1 -1
- package/dist/plots/points-plot.d.ts +34 -19
- package/dist/plots/points-plot.d.ts.map +1 -1
- package/dist/plots/points-plot.js +31 -58
- package/dist/plots/points-plot.js.map +1 -1
- package/dist/plots/stream-lines.d.ts +38 -19
- package/dist/plots/stream-lines.d.ts.map +1 -1
- package/dist/plots/stream-lines.js +60 -79
- package/dist/plots/stream-lines.js.map +1 -1
- package/dist/plots/traced-path.d.ts +34 -15
- package/dist/plots/traced-path.d.ts.map +1 -1
- package/dist/plots/traced-path.js +33 -48
- package/dist/plots/traced-path.js.map +1 -1
- package/dist/plots/vector-field.d.ts +31 -11
- package/dist/plots/vector-field.d.ts.map +1 -1
- package/dist/plots/vector-field.js +50 -64
- package/dist/plots/vector-field.js.map +1 -1
- package/dist/structures/network-graph.d.ts +99 -49
- package/dist/structures/network-graph.d.ts.map +1 -1
- package/dist/structures/network-graph.js +168 -217
- package/dist/structures/network-graph.js.map +1 -1
- package/dist/structures/sample-space.d.ts +69 -38
- package/dist/structures/sample-space.d.ts.map +1 -1
- package/dist/structures/sample-space.js +132 -170
- package/dist/structures/sample-space.js.map +1 -1
- package/dist/systems/axes2d.d.ts +126 -37
- package/dist/systems/axes2d.d.ts.map +1 -1
- package/dist/systems/axes2d.js +147 -183
- package/dist/systems/axes2d.js.map +1 -1
- package/dist/systems/number-line.d.ts +51 -28
- package/dist/systems/number-line.d.ts.map +1 -1
- package/dist/systems/number-line.js +82 -118
- package/dist/systems/number-line.js.map +1 -1
- package/dist/systems/number-plane.d.ts +92 -31
- package/dist/systems/number-plane.d.ts.map +1 -1
- package/dist/systems/number-plane.js +142 -149
- package/dist/systems/number-plane.js.map +1 -1
- package/dist/systems/polar-plane.d.ts +47 -26
- package/dist/systems/polar-plane.d.ts.map +1 -1
- package/dist/systems/polar-plane.js +107 -133
- package/dist/systems/polar-plane.js.map +1 -1
- package/dist/tex/index.d.ts.map +1 -1
- package/dist/tex/index.js +1 -0
- package/dist/tex/index.js.map +1 -1
- package/dist/tex/matrix.d.ts +56 -18
- package/dist/tex/matrix.d.ts.map +1 -1
- package/dist/tex/matrix.js +33 -50
- package/dist/tex/matrix.js.map +1 -1
- package/dist/tex/node.d.ts +55 -201
- package/dist/tex/node.d.ts.map +1 -1
- package/dist/tex/node.js +23 -593
- package/dist/tex/node.js.map +1 -1
- 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 +140 -54
- package/dist/three/axes3d.d.ts.map +1 -1
- package/dist/three/axes3d.js +159 -204
- package/dist/three/axes3d.js.map +1 -1
- package/dist/three/curve-plot3d.d.ts +70 -42
- package/dist/three/curve-plot3d.d.ts.map +1 -1
- package/dist/three/curve-plot3d.js +97 -132
- package/dist/three/curve-plot3d.js.map +1 -1
- 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/plot-point3d.d.ts +57 -12
- package/dist/three/plot-point3d.d.ts.map +1 -1
- package/dist/three/plot-point3d.js +27 -53
- package/dist/three/plot-point3d.js.map +1 -1
- package/dist/three/space.d.ts +17 -2
- package/dist/three/space.d.ts.map +1 -1
- package/dist/three/space.js +19 -8
- package/dist/three/space.js.map +1 -1
- package/dist/three/surface-plot3d.d.ts +131 -49
- package/dist/three/surface-plot3d.d.ts.map +1 -1
- package/dist/three/surface-plot3d.js +227 -261
- package/dist/three/surface-plot3d.js.map +1 -1
- package/dist/three/vector-arrow3d.d.ts +58 -16
- package/dist/three/vector-arrow3d.d.ts.map +1 -1
- package/dist/three/vector-arrow3d.js +48 -67
- package/dist/three/vector-arrow3d.js.map +1 -1
- package/package.json +4 -4
- package/src/annotate/angle-mark.ts +95 -105
- package/src/annotate/curly-brace.ts +107 -85
- package/src/annotate/emphasis-mark.ts +55 -26
- package/src/engine.ts +35 -21
- package/src/kit/component.ts +57 -0
- package/src/kit/curve.ts +38 -20
- package/src/kit/field-mark.ts +124 -108
- package/src/kit/follow.ts +146 -120
- package/src/kit/furniture.ts +6 -1
- package/src/kit/graph.ts +116 -0
- package/src/kit/mark.ts +135 -114
- package/src/kit/place.ts +32 -56
- package/src/kit/system.ts +77 -71
- package/src/kit/withdrawn.ts +3 -3
- package/src/marks/curve-area.ts +65 -65
- package/src/marks/drop-lines.ts +50 -42
- package/src/marks/plot-point.ts +77 -82
- package/src/marks/riemann-sum.ts +73 -72
- package/src/marks/tangent-line.ts +87 -71
- package/src/marks/vector-arrow.ts +73 -73
- package/src/nodes.ts +41 -5
- package/src/plots/function-plot.ts +155 -171
- package/src/plots/points-plot.ts +46 -50
- package/src/plots/stream-lines.ts +75 -66
- package/src/plots/traced-path.ts +51 -33
- package/src/plots/vector-field.ts +68 -49
- package/src/structures/network-graph.ts +168 -185
- package/src/structures/sample-space.ts +149 -148
- package/src/systems/axes2d.ts +165 -156
- package/src/systems/number-line.ts +91 -92
- package/src/systems/number-plane.ts +149 -120
- package/src/systems/polar-plane.ts +117 -116
- package/src/tex/index.ts +2 -1
- package/src/tex/matrix.ts +62 -40
- package/src/tex/node.ts +54 -621
- package/src/tex/typeset.ts +461 -0
- package/src/three/axes3d.ts +182 -161
- package/src/three/curve-plot3d.ts +107 -110
- package/src/three/entries.ts +42 -0
- package/src/three/plot-point3d.ts +42 -45
- package/src/three/space.ts +34 -9
- package/src/three/surface-plot3d.ts +312 -323
- package/src/three/vector-arrow3d.ts +65 -54
- package/dist/browser/chunks/chunk-3GJB6AVO.js +0 -2
- package/dist/browser/chunks/chunk-3GJB6AVO.js.map +0 -7
- package/dist/browser/chunks/chunk-D5WHCVBC.js +0 -2
- package/dist/browser/chunks/chunk-D5WHCVBC.js.map +0 -7
- package/dist/browser/chunks/chunk-WL4KEX7Y.js +0 -2
- package/dist/browser/chunks/chunk-WL4KEX7Y.js.map +0 -7
- package/src/kit/placement.ts +0 -8
|
@@ -1,87 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { command, node, property, strokeProperty, vector2Property, withdraw, } from "@motionscript/sdk";
|
|
8
|
-
import { stated } from "../kit/geometry.js";
|
|
9
|
-
import { Mark } from "../kit/mark.js";
|
|
10
|
-
import { SYSTEMS } from "../kit/placement.js";
|
|
11
|
-
import { FILL_PAINT } from "../kit/withdrawn.js";
|
|
1
|
+
import { component2d, Types, } from "@motionscript/sdk";
|
|
2
|
+
import { omit, PAINT, PAINT_COMMANDS } from "../kit/component.js";
|
|
3
|
+
import { PLANE_ENTRY } from "../kit/graph.js";
|
|
4
|
+
import { drawMark, graphPoint, inkSize, ownPoint, reading, traced } from "../kit/mark.js";
|
|
12
5
|
/** Degrees of arc per drawn segment of a bent arrow. */
|
|
13
6
|
const BEND_STEP = 4;
|
|
7
|
+
const state = {
|
|
8
|
+
...omit(PAINT, "fill"),
|
|
9
|
+
tail: Types.vector2(),
|
|
10
|
+
head: Types.vector2({ x: 1, y: 1 }),
|
|
11
|
+
/** The arc the arrow sweeps, in degrees: zero is straight, positive bows to its left. */
|
|
12
|
+
bend: Types.number(0, { min: -180, max: 180, unit: "°" }),
|
|
13
|
+
graph: PLANE_ENTRY,
|
|
14
|
+
};
|
|
15
|
+
/** A handle on one end of the arrow: where the end is in its own frame, and the graph point a drop there gives. */
|
|
16
|
+
const end = (which) => ({
|
|
17
|
+
at: (s) => {
|
|
18
|
+
const read = reading(s);
|
|
19
|
+
return ownPoint(read, traceArrow(s, read), s[which]);
|
|
20
|
+
},
|
|
21
|
+
value: (at, s) => {
|
|
22
|
+
const read = reading(s);
|
|
23
|
+
return graphPoint(read, traceArrow(s, read), at);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
14
26
|
/**
|
|
15
27
|
* An arrow from `tail` to `head`, two graph points. Its arrowhead is the stroke's
|
|
16
28
|
* `endCap`, so a plain segment, a double arrow or a dashed one is a change of
|
|
17
29
|
* stroke. (`from` and `to` are not its names because every node has a `to`.)
|
|
18
30
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
31
|
+
export const VectorArrow = traced(component2d({
|
|
32
|
+
key: "vectorArrow",
|
|
33
|
+
state,
|
|
34
|
+
defaults: { stroke: { weight: 4, fill: "#e5e7eb", align: "center", endCap: "triangle" }, width: "hug", height: "hug" },
|
|
35
|
+
commands: {
|
|
36
|
+
...omit(PAINT_COMMANDS, "fillTo"),
|
|
37
|
+
/** Move either end, in graph coordinates. */
|
|
38
|
+
endpointsTo: { args: ["tail", "head"] },
|
|
39
|
+
},
|
|
40
|
+
handles: { tail: end("tail"), head: end("head") },
|
|
41
|
+
measure: (_measurer, s) => inkSize(traceArrow(s, reading(s))),
|
|
42
|
+
render: (ctx, s) => drawMark(ctx, s, traceArrow(s, reading(s))),
|
|
43
|
+
}), traceArrow);
|
|
44
|
+
function traceArrow(s, { map, shift }) {
|
|
45
|
+
const a = map.toPoint(s.tail.x + shift.x, s.tail.y + shift.y);
|
|
46
|
+
const b = map.toPoint(s.head.x + shift.x, s.head.y + shift.y);
|
|
47
|
+
const sweep = (s.bend * Math.PI) / 180;
|
|
48
|
+
const chord = Math.hypot(b.x - a.x, b.y - a.y);
|
|
49
|
+
if (Math.abs(sweep) < 1e-3 || chord === 0)
|
|
50
|
+
return [[a, b]];
|
|
51
|
+
// The circle through both ends that subtends `sweep` at its centre.
|
|
52
|
+
const radius = chord / (2 * Math.sin(Math.abs(sweep) / 2));
|
|
53
|
+
const side = Math.sign(sweep);
|
|
54
|
+
const reach = radius * Math.cos(sweep / 2);
|
|
55
|
+
// The centre sits to the arrow's right for a positive sweep, so the arc bows to its left.
|
|
56
|
+
const cx = (a.x + b.x) / 2 + (side * (b.y - a.y) * reach) / chord;
|
|
57
|
+
const cy = (a.y + b.y) / 2 - (side * (b.x - a.x) * reach) / chord;
|
|
58
|
+
const from = Math.atan2(a.y - cy, a.x - cx);
|
|
59
|
+
const steps = Math.max(8, Math.ceil(Math.abs(s.bend) / BEND_STEP));
|
|
60
|
+
const run = [];
|
|
61
|
+
for (let i = 0; i <= steps; i++) {
|
|
62
|
+
const angle = from - (sweep * i) / steps;
|
|
63
|
+
run.push({ x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) });
|
|
50
64
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
{ prop: "tail", at: this.ownPoint(this.tail) },
|
|
54
|
-
{ prop: "head", at: this.ownPoint(this.head) },
|
|
55
|
-
];
|
|
56
|
-
}
|
|
57
|
-
_handleValue(prop, at) {
|
|
58
|
-
return prop === "tail" || prop === "head" ? this.graphPoint(at) : null;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
__decorate([
|
|
62
|
-
vector2Property()
|
|
63
|
-
], VectorArrow.prototype, "tail", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
vector2Property({ default: { x: 1, y: 1 } })
|
|
66
|
-
], VectorArrow.prototype, "head", void 0);
|
|
67
|
-
__decorate([
|
|
68
|
-
property({ default: 0, min: -180, max: 180, unit: "°" })
|
|
69
|
-
], VectorArrow.prototype, "bend", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
strokeProperty({ default: { weight: 4, fill: "#e5e7eb", align: "center", endCap: "triangle" } })
|
|
72
|
-
], VectorArrow.prototype, "stroke", void 0);
|
|
73
|
-
__decorate([
|
|
74
|
-
command({ args: ["tail", "head"] })
|
|
75
|
-
], VectorArrow.prototype, "endpointsTo", null);
|
|
76
|
-
VectorArrow = __decorate([
|
|
77
|
-
node({
|
|
78
|
-
key: "vectorArrow",
|
|
79
|
-
within: SYSTEMS,
|
|
80
|
-
parentKey: "shape",
|
|
81
|
-
forkable: true,
|
|
82
|
-
layout: { children: "freeform", defaultWidthMode: "hug", defaultHeightMode: "hug", acceptsChildren: false },
|
|
83
|
-
}),
|
|
84
|
-
withdraw(...FILL_PAINT)
|
|
85
|
-
], VectorArrow);
|
|
86
|
-
export { VectorArrow };
|
|
65
|
+
return [run];
|
|
66
|
+
}
|
|
87
67
|
//# sourceMappingURL=vector-arrow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-arrow.js","sourceRoot":"","sources":["../../src/marks/vector-arrow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-arrow.js","sourceRoot":"","sources":["../../src/marks/vector-arrow.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,KAAK,GAWR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,Q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K,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IACnE,MAAM,GAAG,GAAc,EAAE,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACzC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,CAAC;AACjB,CAAC","sourcesContent":["import {\r\n component2d,\r\n Types,\r\n type NodeOf,\r\n type PaintProps,\r\n type Vector2,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Node2DProps as _Node2DProps,\r\n type Shadow as _Shadow,\r\n type ShadowResolved as _ShadowResolved,\r\n type Stroke as _Stroke,\r\n type StrokeResolved as _StrokeResolved,\r\n} from \"@motionscript/sdk\";\r\nimport { omit, PAINT, PAINT_COMMANDS } from \"../kit/component\";\r\nimport { PLANE_ENTRY } from \"../kit/graph\";\r\nimport { drawMark, graphPoint, inkSize, ownPoint, reading, traced, type MarkReading, type MarkState } from \"../kit/mark\";\r\n\r\nexport interface VectorArrowProps extends PaintProps {\r\n tail?: Vector2;\r\n head?: Vector2;\r\n bend?: number;\r\n}\r\n\r\n/** Degrees of arc per drawn segment of a bent arrow. */\r\nconst BEND_STEP = 4;\r\n\r\nconst state = {\r\n ...omit(PAINT, \"fill\"),\r\n tail: Types.vector2(),\r\n head: Types.vector2({ x: 1, y: 1 }),\r\n /** The arc the arrow sweeps, in degrees: zero is straight, positive bows to its left. */\r\n bend: Types.number(0, { min: -180, max: 180, unit: \"°\" }),\r\n graph: PLANE_ENTRY,\r\n};\r\n\r\ninterface ArrowValues {\r\n readonly tail: Vector2;\r\n readonly head: Vector2;\r\n readonly bend: number;\r\n}\r\n\r\n/** A handle on one end of the arrow: where the end is in its own frame, and the graph point a drop there gives. */\r\nconst end = (which: \"tail\" | \"head\") => ({\r\n at: (s: ArrowValues & MarkState) => {\r\n const read = reading(s);\r\n return ownPoint(read, traceArrow(s, read), s[which]);\r\n },\r\n value: (at: Vector2, s: ArrowValues & MarkState) => {\r\n const read = reading(s);\r\n return graphPoint(read, traceArrow(s, read), at);\r\n },\r\n});\r\n\r\n/**\r\n * An arrow from `tail` to `head`, two graph points. Its arrowhead is the stroke's\r\n * `endCap`, so a plain segment, a double arrow or a dashed one is a change of\r\n * stroke. (`from` and `to` are not its names because every node has a `to`.)\r\n */\r\nexport const VectorArrow = traced(component2d({\r\n key: \"vectorArrow\",\r\n state,\r\n defaults: { stroke: { weight: 4, fill: \"#e5e7eb\", align: \"center\", endCap: \"triangle\" }, width: \"hug\", height: \"hug\" },\r\n commands: {\r\n ...omit(PAINT_COMMANDS, \"fillTo\"),\r\n /** Move either end, in graph coordinates. */\r\n endpointsTo: { args: [\"tail\", \"head\"] },\r\n },\r\n handles: { tail: end(\"tail\"), head: end(\"head\") },\r\n measure: (_measurer, s) => inkSize(traceArrow(s, reading(s))),\r\n render: (ctx, s) => drawMark(ctx, s, traceArrow(s, reading(s))),\r\n}), traceArrow);\r\n\r\nexport type VectorArrow = NodeOf<typeof VectorArrow>;\r\n\r\nfunction traceArrow(s: ArrowValues, { map, shift }: MarkReading): Vector2[][] {\r\n const a = map.toPoint(s.tail.x + shift.x, s.tail.y + shift.y);\r\n const b = map.toPoint(s.head.x + shift.x, s.head.y + shift.y);\r\n const sweep = (s.bend * Math.PI) / 180;\r\n const chord = Math.hypot(b.x - a.x, b.y - a.y);\r\n if (Math.abs(sweep) < 1e-3 || chord === 0) return [[a, b]];\r\n\r\n // The circle through both ends that subtends `sweep` at its centre.\r\n const radius = chord / (2 * Math.sin(Math.abs(sweep) / 2));\r\n const side = Math.sign(sweep);\r\n const reach = radius * Math.cos(sweep / 2);\r\n // The centre sits to the arrow's right for a positive sweep, so the arc bows to its left.\r\n const cx = (a.x + b.x) / 2 + (side * (b.y - a.y) * reach) / chord;\r\n const cy = (a.y + b.y) / 2 - (side * (b.x - a.x) * reach) / chord;\r\n const from = Math.atan2(a.y - cy, a.x - cx);\r\n const steps = Math.max(8, Math.ceil(Math.abs(s.bend) / BEND_STEP));\r\n const run: Vector2[] = [];\r\n for (let i = 0; i <= steps; i++) {\r\n const angle = from - (sweep * i) / steps;\r\n run.push({ x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) });\r\n }\r\n return [run];\r\n}\r\n"]}
|
package/dist/nodes.d.ts
CHANGED
|
@@ -26,10 +26,18 @@ import { PlotPoint3d } from "./three/plot-point3d.js";
|
|
|
26
26
|
import { SurfacePlot3d } from "./three/surface-plot3d.js";
|
|
27
27
|
import { VectorArrow3d } from "./three/vector-arrow3d.js";
|
|
28
28
|
/**
|
|
29
|
-
* Every node type this package publishes.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* `
|
|
29
|
+
* Every node type this package publishes.
|
|
30
|
+
*
|
|
31
|
+
* A host registers these by handing the array to an engine —
|
|
32
|
+
* `new Engine(platform, { nodes: NODES })` — which reads each component's key.
|
|
33
|
+
* Defining a component only *declares* that key: nothing is registered by
|
|
34
|
+
* importing a module, so a registry holds exactly what its owner asked for.
|
|
35
|
+
*
|
|
36
|
+
* Listing the component **values** is also what survives bundling: this package
|
|
37
|
+
* declares `sideEffects: false`, and a document names a node type by string, so
|
|
38
|
+
* an import kept only for its side effect is exactly what gets shaken out.
|
|
33
39
|
*/
|
|
34
|
-
|
|
40
|
+
type KitNode = typeof Latex | typeof LatexMatrix | typeof NumberLine | typeof Axes2d | typeof NumberPlane | typeof FunctionPlot | typeof PointsPlot | typeof PlotPoint | typeof VectorArrow | typeof CurveArea | typeof RiemannSum | typeof TangentLine | typeof DropLines | typeof CurlyBrace | typeof AngleMark | typeof EmphasisMark | typeof Axes3d | typeof SurfacePlot3d | typeof CurvePlot3d | typeof PlotPoint3d | typeof VectorArrow3d | typeof PolarPlane | typeof VectorField | typeof StreamLines | typeof TracedPath | typeof NetworkGraph | typeof SampleSpace;
|
|
41
|
+
export declare const NODES: KitNode[];
|
|
42
|
+
export {};
|
|
35
43
|
//# sourceMappingURL=nodes.d.ts.map
|
package/dist/nodes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,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AAM,GACb,OAAO,aAAa,GACpB,OAAO,WAAW,GAClB,OAAO,WAAW,GAClB,OAAO,aAAa,GACpB,OAAO,UAAU,GACjB,OAAO,WAAW,GAClB,OAAO,WAAW,GAClB,OAAO,UAAU,GACjB,OAAO,YAAY,GACnB,OAAO,WAAW,CAAC;AAEzB,eAAO,MAAM,KAAK,EAAE,OAAO,EA4B1B,CAAC"}
|
package/dist/nodes.js
CHANGED
|
@@ -25,12 +25,6 @@ import { CurvePlot3d } from "./three/curve-plot3d.js";
|
|
|
25
25
|
import { PlotPoint3d } from "./three/plot-point3d.js";
|
|
26
26
|
import { SurfacePlot3d } from "./three/surface-plot3d.js";
|
|
27
27
|
import { VectorArrow3d } from "./three/vector-arrow3d.js";
|
|
28
|
-
/**
|
|
29
|
-
* Every node type this package publishes. A host registers them by handing the
|
|
30
|
-
* array to an engine (`nodes: NODES`); `@node()` only declares each key. Class
|
|
31
|
-
* values rather than side-effect imports, because the package is
|
|
32
|
-
* `sideEffects: false` and a document names a type by string.
|
|
33
|
-
*/
|
|
34
28
|
export const NODES = [
|
|
35
29
|
Latex,
|
|
36
30
|
LatexMatrix,
|
package/dist/nodes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../src/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC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IACX,UAAU;IACV,MAAM;IACN,WAAW;IACX,YAAY;IACZ,UAAU;IACV,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW;IACX,SAAS;IACT,UAAU;IACV,SAAS;IACT,YAAY;IACZ,MAAM;IACN,aAAa;IACb,WAAW;IACX,WAAW;IACX,aAAa;IACb,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,YAAY;IACZ,WAAW;CACd,CAAC","sourcesContent":["import { AngleMark } from \"./annotate/angle-mark\";\r\nimport { CurlyBrace } from \"./annotate/curly-brace\";\r\nimport { EmphasisMark } from \"./annotate/emphasis-mark\";\r\nimport { CurveArea } from \"./marks/curve-area\";\r\nimport { DropLines } from \"./marks/drop-lines\";\r\nimport { PlotPoint } from \"./marks/plot-point\";\r\nimport { RiemannSum } from \"./marks/riemann-sum\";\r\nimport { TangentLine } from \"./marks/tangent-line\";\r\nimport { VectorArrow } from \"./marks/vector-arrow\";\r\nimport { FunctionPlot } from \"./plots/function-plot\";\r\nimport { PointsPlot } from \"./plots/points-plot\";\r\nimport { StreamLines } from \"./plots/stream-lines\";\r\nimport { TracedPath } from \"./plots/traced-path\";\r\nimport { VectorField } from \"./plots/vector-field\";\r\nimport { Axes2d } from \"./systems/axes2d\";\r\nimport { NumberLine } from \"./systems/number-line\";\r\nimport { NumberPlane } from \"./systems/number-plane\";\r\nimport { PolarPlane } from \"./systems/polar-plane\";\r\nimport { NetworkGraph } from \"./structures/network-graph\";\r\nimport { SampleSpace } from \"./structures/sample-space\";\r\nimport { LatexMatrix } from \"./tex/matrix\";\r\nimport { Latex } from \"./tex/node\";\r\nimport { Axes3d } from \"./three/axes3d\";\r\nimport { CurvePlot3d } from \"./three/curve-plot3d\";\r\nimport { PlotPoint3d } from \"./three/plot-point3d\";\r\nimport { SurfacePlot3d } from \"./three/surface-plot3d\";\r\nimport { VectorArrow3d } from \"./three/vector-arrow3d\";\r\n\r\n/**\r\n * Every node type this package publishes.\r\n *\r\n * A host registers these by handing the array to an engine —\r\n * `new Engine(platform, { nodes: NODES })` — which reads each component's key.\r\n * Defining a component only *declares* that key: nothing is registered by\r\n * importing a module, so a registry holds exactly what its owner asked for.\r\n *\r\n * Listing the component **values** is also what survives bundling: this package\r\n * declares `sideEffects: false`, and a document names a node type by string, so\r\n * an import kept only for its side effect is exactly what gets shaken out.\r\n */\r\n// Typed by name, so the declaration names each component rather than spelling out its type through core.\r\ntype KitNode =\r\n | typeof Latex\r\n | typeof LatexMatrix\r\n | typeof NumberLine\r\n | typeof Axes2d\r\n | typeof NumberPlane\r\n | typeof FunctionPlot\r\n | typeof PointsPlot\r\n | typeof PlotPoint\r\n | typeof VectorArrow\r\n | typeof CurveArea\r\n | typeof RiemannSum\r\n | typeof TangentLine\r\n | typeof DropLines\r\n | typeof CurlyBrace\r\n | typeof AngleMark\r\n | typeof EmphasisMark\r\n | typeof Axes3d\r\n | typeof SurfacePlot3d\r\n | typeof CurvePlot3d\r\n | typeof PlotPoint3d\r\n | typeof VectorArrow3d\r\n | typeof PolarPlane\r\n | typeof VectorField\r\n | typeof StreamLines\r\n | typeof TracedPath\r\n | typeof NetworkGraph\r\n | typeof SampleSpace;\r\n\r\nexport const NODES: KitNode[] = [\r\n Latex,\r\n LatexMatrix,\r\n NumberLine,\r\n Axes2d,\r\n NumberPlane,\r\n FunctionPlot,\r\n PointsPlot,\r\n PlotPoint,\r\n VectorArrow,\r\n CurveArea,\r\n RiemannSum,\r\n TangentLine,\r\n DropLines,\r\n CurlyBrace,\r\n AngleMark,\r\n EmphasisMark,\r\n Axes3d,\r\n SurfacePlot3d,\r\n CurvePlot3d,\r\n PlotPoint3d,\r\n VectorArrow3d,\r\n PolarPlane,\r\n VectorField,\r\n StreamLines,\r\n TracedPath,\r\n NetworkGraph,\r\n SampleSpace,\r\n];\r\n"]}
|
|
@@ -1,67 +1,131 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type {
|
|
3
|
-
import type { Curve } from "../kit/curve.js";
|
|
1
|
+
import { type NodeOf, type PaintProps, type Vector2, type Node2D as _Node2D, type Node2DProps as _Node2DProps, type Shadow as _Shadow, type ShadowResolved as _ShadowResolved, type Stroke as _Stroke, type StrokeResolved as _StrokeResolved } from "@motionscript/sdk";
|
|
2
|
+
import type { Interval } from "../kit/coords.js";
|
|
4
3
|
import type { ExpressionScope } from "../kit/expression.js";
|
|
5
|
-
import {
|
|
4
|
+
import { type MarkReading } from "../kit/mark.js";
|
|
6
5
|
import { type PlotSource } from "../kit/source.js";
|
|
7
6
|
export interface FunctionPlotProps extends PaintProps {
|
|
8
7
|
expression?: string | PlotSource;
|
|
9
8
|
domain?: Interval | null;
|
|
10
9
|
params?: ExpressionScope;
|
|
11
10
|
}
|
|
11
|
+
/** A plot's entries: what a traced path is built on too. It is only a line, so it has no fill. */
|
|
12
|
+
export declare const PLOT_STATE: {
|
|
13
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
14
|
+
/**
|
|
15
|
+
* The span of the free variable that is drawn. Left out, a function runs the
|
|
16
|
+
* width of its system, a polar curve one turn and a parametric one from 0 to 1.
|
|
17
|
+
*/
|
|
18
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
19
|
+
/**
|
|
20
|
+
* The equation's named values: any name in it that is not a variable, a
|
|
21
|
+
* function or a constant. One left unset is 1, and a formula can bind each
|
|
22
|
+
* to a variable.
|
|
23
|
+
*/
|
|
24
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
25
|
+
graph: import("@motionscript/sdk").Type<import("../index.js").GraphPlane | null, import("../index.js").GraphPlane | null, true>;
|
|
26
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
27
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
28
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
29
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
30
|
+
};
|
|
31
|
+
/** A plot's own commands, beside a line's paints. */
|
|
32
|
+
export declare const PLOT_COMMANDS: {
|
|
33
|
+
/** Change the equation, the curve bending from the one into the other. */
|
|
34
|
+
morphTo: {
|
|
35
|
+
args: readonly ["expression"];
|
|
36
|
+
};
|
|
37
|
+
/** Animate the equation's named values. */
|
|
38
|
+
paramsTo: {
|
|
39
|
+
args: readonly ["params"];
|
|
40
|
+
};
|
|
41
|
+
/** Animate the span that is drawn. */
|
|
42
|
+
domainTo: {
|
|
43
|
+
args: readonly ["domain"];
|
|
44
|
+
};
|
|
45
|
+
strokeTo: {
|
|
46
|
+
readonly args: readonly ["stroke"];
|
|
47
|
+
readonly run?: undefined;
|
|
48
|
+
};
|
|
49
|
+
shadowTo: {
|
|
50
|
+
readonly args: readonly ["shadow"];
|
|
51
|
+
readonly run?: undefined;
|
|
52
|
+
};
|
|
53
|
+
progressTo: {
|
|
54
|
+
readonly args: readonly ["start", "end"];
|
|
55
|
+
readonly run?: undefined;
|
|
56
|
+
};
|
|
57
|
+
flash: {
|
|
58
|
+
readonly args: {
|
|
59
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
60
|
+
};
|
|
61
|
+
run(timeline: any, state: any, children: any): import("@motionscript/sdk").Piece;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const PLOT_STROKE: {
|
|
65
|
+
readonly weight: 3;
|
|
66
|
+
readonly fill: "#58a6ff";
|
|
67
|
+
readonly align: "center";
|
|
68
|
+
readonly cap: "round";
|
|
69
|
+
readonly join: "round";
|
|
70
|
+
};
|
|
71
|
+
/** What a plot's curve is drawn from. */
|
|
72
|
+
export interface PlotValues {
|
|
73
|
+
readonly expression: PlotSource;
|
|
74
|
+
readonly params: ExpressionScope;
|
|
75
|
+
}
|
|
12
76
|
/**
|
|
13
77
|
* The curve of an equation, drawn in the coordinate system it is a child of.
|
|
14
78
|
* How the equation is written says what it is: see `Equation`. A mark put
|
|
15
79
|
* inside it reads it: the area under it, a tangent, a point that rides it.
|
|
16
80
|
*/
|
|
17
|
-
export declare
|
|
18
|
-
expression: PlotSource
|
|
81
|
+
export declare const FunctionPlot: import("@motionscript/sdk").Component<"functionPlot", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
82
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
19
83
|
/**
|
|
20
84
|
* The span of the free variable that is drawn. Left out, a function runs the
|
|
21
85
|
* width of its system, a polar curve one turn and a parametric one from 0 to 1.
|
|
22
86
|
*/
|
|
23
|
-
domain: Interval | null
|
|
87
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
24
88
|
/**
|
|
25
89
|
* The equation's named values: any name in it that is not a variable, a
|
|
26
90
|
* function or a constant. One left unset is 1, and a formula can bind each
|
|
27
91
|
* to a variable.
|
|
28
92
|
*/
|
|
29
|
-
params:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
93
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
94
|
+
graph: import("@motionscript/sdk").Type<import("../index.js").GraphPlane | null, import("../index.js").GraphPlane | null, true>;
|
|
95
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
96
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
97
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
98
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
99
|
+
}>, {
|
|
100
|
+
morphTo: readonly ["expression"];
|
|
101
|
+
paramsTo: readonly ["params"];
|
|
102
|
+
domainTo: readonly ["domain"];
|
|
103
|
+
strokeTo: readonly ["stroke"];
|
|
104
|
+
shadowTo: readonly ["shadow"];
|
|
105
|
+
progressTo: readonly ["start", "end"];
|
|
106
|
+
flash: {
|
|
107
|
+
readonly portion: import("@motionscript/sdk").Type<number, number, false>;
|
|
108
|
+
};
|
|
109
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
110
|
+
expression: import("@motionscript/sdk").Type<string | PlotSource, PlotSource, false>;
|
|
111
|
+
/**
|
|
112
|
+
* The span of the free variable that is drawn. Left out, a function runs the
|
|
113
|
+
* width of its system, a polar curve one turn and a parametric one from 0 to 1.
|
|
114
|
+
*/
|
|
115
|
+
domain: import("@motionscript/sdk").Type<Interval | null, Interval | null, false>;
|
|
50
116
|
/**
|
|
51
|
-
* The
|
|
52
|
-
* function
|
|
117
|
+
* The equation's named values: any name in it that is not a variable, a
|
|
118
|
+
* function or a constant. One left unset is 1, and a formula can bind each
|
|
119
|
+
* to a variable.
|
|
53
120
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/** `source` as a pixel curve over a parameter running 0 to 1. */
|
|
65
|
-
private _curve;
|
|
66
|
-
}
|
|
121
|
+
params: import("@motionscript/sdk").Type<Readonly<Record<string, number>>, Readonly<Record<string, number>>, false>;
|
|
122
|
+
graph: import("@motionscript/sdk").Type<import("../index.js").GraphPlane | null, import("../index.js").GraphPlane | null, true>;
|
|
123
|
+
start: import("@motionscript/sdk").Type<number, number, false>;
|
|
124
|
+
end: import("@motionscript/sdk").Type<number, number, false>;
|
|
125
|
+
stroke: import("@motionscript/sdk").Attribute<_Stroke, _StrokeResolved[]>;
|
|
126
|
+
shadow: import("@motionscript/sdk").Attribute<_Shadow, _ShadowResolved[]>;
|
|
127
|
+
}>, null>>;
|
|
128
|
+
export type FunctionPlot = NodeOf<typeof FunctionPlot>;
|
|
129
|
+
/** The runs a plot of `s` draws through `read`, over `span` of its free variable (all of it for `null`). */
|
|
130
|
+
export declare function tracePlot(s: PlotValues, read: MarkReading, span: Interval | null): Vector2[][];
|
|
67
131
|
//# sourceMappingURL=function-plot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-plot.d.ts","sourceRoot":"","sources":["../../src/plots/function-plot.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"function-plot.d.ts","sourceRoot":"","sources":["../../src/plots/function-plot.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,KAAK,MAAM,EACX,KAAK,UAAU,EACf,KAAK,OAAO,EAEZ,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EAChC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACtC,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,cAAc,IAAI,eAAe,EACzC,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD,OAAO,EAAiD,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,EAA4D,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAE1G,MAAM,WAAW,iBAAkB,SAAQ,UAAU;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IACjC,MAAM,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC5B;AAID,kGAAkG;AAClG,eAAO,MAAM,UAAU;;IAGnB;;;OAGG;;IAEH;;;;OAIG;;;;;;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