cseen 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +169 -2
- package/dist/all.d.ts +9 -0
- package/dist/all.js +11 -0
- package/dist/all.js.map +1 -0
- package/dist/anim/mount.d.ts +69 -0
- package/dist/anim/mount.js +234 -0
- package/dist/anim/mount.js.map +1 -0
- package/dist/anim/orbit.d.ts +85 -0
- package/dist/anim/orbit.js +198 -0
- package/dist/anim/orbit.js.map +1 -0
- package/dist/anim/timeline.d.ts +287 -0
- package/dist/anim/timeline.js +379 -0
- package/dist/anim/timeline.js.map +1 -0
- package/dist/charts/charts.d.ts +216 -0
- package/dist/charts/charts.js +570 -0
- package/dist/charts/charts.js.map +1 -0
- package/dist/charts/index.d.ts +2 -0
- package/dist/charts/index.js +2 -0
- package/dist/charts/index.js.map +1 -0
- package/dist/construct/construct.d.ts +73 -0
- package/dist/construct/construct.js +96 -0
- package/dist/construct/construct.js.map +1 -0
- package/dist/construct/geom.d.ts +91 -0
- package/dist/construct/geom.js +118 -0
- package/dist/construct/geom.js.map +1 -0
- package/dist/core/animatable.d.ts +19 -0
- package/dist/core/animatable.js +41 -0
- package/dist/core/animatable.js.map +1 -0
- package/dist/core/camera.d.ts +48 -0
- package/dist/core/camera.js +95 -0
- package/dist/core/camera.js.map +1 -0
- package/dist/core/math.d.ts +39 -0
- package/dist/core/math.js +104 -0
- package/dist/core/math.js.map +1 -0
- package/dist/core/nodes.d.ts +387 -0
- package/dist/core/nodes.js +418 -0
- package/dist/core/nodes.js.map +1 -0
- package/dist/core/render.d.ts +98 -0
- package/dist/core/render.js +386 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/scene.d.ts +96 -0
- package/dist/core/scene.js +104 -0
- package/dist/core/scene.js.map +1 -0
- package/dist/core/sort.d.ts +40 -0
- package/dist/core/sort.js +181 -0
- package/dist/core/sort.js.map +1 -0
- package/dist/core/split.d.ts +47 -0
- package/dist/core/split.js +169 -0
- package/dist/core/split.js.map +1 -0
- package/dist/core/svg-import.d.ts +16 -0
- package/dist/core/svg-import.js +53 -0
- package/dist/core/svg-import.js.map +1 -0
- package/dist/cseen.css +106 -0
- package/dist/devices/devices.d.ts +307 -0
- package/dist/devices/devices.js +327 -0
- package/dist/devices/devices.js.map +1 -0
- package/dist/devices/index.d.ts +6 -0
- package/dist/devices/index.js +4 -0
- package/dist/devices/index.js.map +1 -0
- package/dist/devices/keyboard.d.ts +86 -0
- package/dist/devices/keyboard.js +186 -0
- package/dist/devices/keyboard.js.map +1 -0
- package/dist/devices/peripherals.d.ts +103 -0
- package/dist/devices/peripherals.js +171 -0
- package/dist/devices/peripherals.js.map +1 -0
- package/dist/draw/heads.d.ts +11 -0
- package/dist/draw/heads.js +26 -0
- package/dist/draw/heads.js.map +1 -0
- package/dist/draw/link.d.ts +76 -0
- package/dist/draw/link.js +102 -0
- package/dist/draw/link.js.map +1 -0
- package/dist/draw/overlap.d.ts +50 -0
- package/dist/draw/overlap.js +80 -0
- package/dist/draw/overlap.js.map +1 -0
- package/dist/draw/pen.d.ts +41 -0
- package/dist/draw/pen.js +57 -0
- package/dist/draw/pen.js.map +1 -0
- package/dist/draw/shapes.d.ts +206 -0
- package/dist/draw/shapes.js +225 -0
- package/dist/draw/shapes.js.map +1 -0
- package/dist/draw/svgplane.d.ts +74 -0
- package/dist/draw/svgplane.js +97 -0
- package/dist/draw/svgplane.js.map +1 -0
- package/dist/draw/text.d.ts +111 -0
- package/dist/draw/text.js +204 -0
- package/dist/draw/text.js.map +1 -0
- package/dist/draw/words.d.ts +29 -0
- package/dist/draw/words.js +30 -0
- package/dist/draw/words.js.map +1 -0
- package/dist/flow/flow.d.ts +206 -0
- package/dist/flow/flow.js +408 -0
- package/dist/flow/flow.js.map +1 -0
- package/dist/flow/index.d.ts +4 -0
- package/dist/flow/index.js +3 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/flow/layout.d.ts +66 -0
- package/dist/flow/layout.js +353 -0
- package/dist/flow/layout.js.map +1 -0
- package/dist/flow/sequence.d.ts +114 -0
- package/dist/flow/sequence.js +309 -0
- package/dist/flow/sequence.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/math/index.d.ts +2 -0
- package/dist/math/index.js +2 -0
- package/dist/math/index.js.map +1 -0
- package/dist/math/math.d.ts +238 -0
- package/dist/math/math.js +421 -0
- package/dist/math/math.js.map +1 -0
- package/dist/optics/index.d.ts +2 -0
- package/dist/optics/index.js +2 -0
- package/dist/optics/index.js.map +1 -0
- package/dist/optics/optics.d.ts +94 -0
- package/dist/optics/optics.js +173 -0
- package/dist/optics/optics.js.map +1 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/ui.d.ts +166 -0
- package/dist/ui/ui.js +255 -0
- package/dist/ui/ui.js.map +1 -0
- package/dist/uml/factory.d.ts +15 -0
- package/dist/uml/factory.js +16 -0
- package/dist/uml/factory.js.map +1 -0
- package/dist/uml/index.d.ts +3 -0
- package/dist/uml/index.js +3 -0
- package/dist/uml/index.js.map +1 -0
- package/dist/uml/uml.d.ts +187 -0
- package/dist/uml/uml.js +599 -0
- package/dist/uml/uml.js.map +1 -0
- package/dist/waves/index.d.ts +2 -0
- package/dist/waves/index.js +2 -0
- package/dist/waves/index.js.map +1 -0
- package/dist/waves/waves.d.ts +93 -0
- package/dist/waves/waves.js +206 -0
- package/dist/waves/waves.js.map +1 -0
- package/package.json +85 -4
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { Animatable } from './animatable.ts';
|
|
2
|
+
import { type V3 } from './math.ts';
|
|
3
|
+
import { type ParsedSvg } from './svg-import.ts';
|
|
4
|
+
/** A point that may follow something else: a fixed position, or a function evaluated each frame. */
|
|
5
|
+
export type Anchor = V3 | (() => V3);
|
|
6
|
+
/** A place in the scene: a plain `[x, y, z]`, an anchor of a node, or a node itself (its position). */
|
|
7
|
+
export type Point = Anchor | Node;
|
|
8
|
+
/** Reads a point's current position in the coordinates it was given in: a node gives its world position, an anchor is called. */
|
|
9
|
+
export declare const resolve: (p: Point) => V3;
|
|
10
|
+
/** What the renderer draws. Nodes turn themselves into these, in world coordinates. */
|
|
11
|
+
export interface Prim {
|
|
12
|
+
/** a stable name, so a redraw replaces only what changed */
|
|
13
|
+
key: string;
|
|
14
|
+
/** what to draw */
|
|
15
|
+
kind: 'path' | 'dot' | 'text' | 'plane' | 'ground' | 'link' | 'hud';
|
|
16
|
+
/** the points in world space */
|
|
17
|
+
pts: V3[];
|
|
18
|
+
/** colour role (`ink`, `faint`, `accent`, `s1` to `s8`) or a role you define in CSS */
|
|
19
|
+
role: string;
|
|
20
|
+
/** transparency, 0 to 1 */
|
|
21
|
+
opacity: number;
|
|
22
|
+
/** draw order between groups of things, lower first */
|
|
23
|
+
layer: number;
|
|
24
|
+
/** join the last point back to the first */
|
|
25
|
+
closed?: boolean;
|
|
26
|
+
/** fill the polygon as a lit surface */
|
|
27
|
+
face?: boolean;
|
|
28
|
+
/** how strongly the role colour shows in a face, 0 to 1 (mixed into the background) */
|
|
29
|
+
fill?: number;
|
|
30
|
+
/** see-through amount of a face, 1 is solid */
|
|
31
|
+
alpha?: number;
|
|
32
|
+
/** 0 to 1: blend the face colour towards the accent, for value-coloured surfaces */
|
|
33
|
+
mix?: number;
|
|
34
|
+
/** light the face from the scene light */
|
|
35
|
+
shade?: boolean;
|
|
36
|
+
/** hide when the viewer is behind it. Needs a normal that points outwards. */
|
|
37
|
+
cull?: boolean;
|
|
38
|
+
/** the outward direction of a face, used for shading, culling and depth order */
|
|
39
|
+
normal?: V3;
|
|
40
|
+
/** line width in SVG units */
|
|
41
|
+
width?: number;
|
|
42
|
+
/** how much of the line is drawn, 0 to 1 */
|
|
43
|
+
draw?: number;
|
|
44
|
+
/** where to put arrowheads */
|
|
45
|
+
arrow?: 'start' | 'end' | 'both';
|
|
46
|
+
/** an SVG dash pattern */
|
|
47
|
+
dash?: string;
|
|
48
|
+
/** dashes travel along the line, this many cycles per second */
|
|
49
|
+
flow?: number;
|
|
50
|
+
/** radius in pixels, for a dot */
|
|
51
|
+
r?: number;
|
|
52
|
+
/** the characters, for text, or the readable name of a link */
|
|
53
|
+
text?: string;
|
|
54
|
+
/** which end of the text sits at the point */
|
|
55
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
56
|
+
/** nudge right in pixels */
|
|
57
|
+
dx?: number;
|
|
58
|
+
/** nudge down in pixels */
|
|
59
|
+
dy?: number;
|
|
60
|
+
/** font size in pixels */
|
|
61
|
+
size?: number;
|
|
62
|
+
/** leave out of the framing, so it never changes the size of the picture */
|
|
63
|
+
noFit?: boolean;
|
|
64
|
+
/** pieces of one object (a mesh, a box) are ordered among themselves by depth, not by plane tests */
|
|
65
|
+
group?: string;
|
|
66
|
+
/** an SVG to place on the plane through the first three points */
|
|
67
|
+
plane?: {
|
|
68
|
+
w: number;
|
|
69
|
+
h: number;
|
|
70
|
+
svg: ParsedSvg;
|
|
71
|
+
cells: number;
|
|
72
|
+
id: string;
|
|
73
|
+
};
|
|
74
|
+
/** where a link goes */
|
|
75
|
+
href?: string;
|
|
76
|
+
/** the lattice on the floor */
|
|
77
|
+
ground?: {
|
|
78
|
+
step?: number;
|
|
79
|
+
extent?: number;
|
|
80
|
+
};
|
|
81
|
+
/** for a hud: where in the frame the text is pinned, and how far in from the edge */
|
|
82
|
+
hud?: {
|
|
83
|
+
at: HudAnchor;
|
|
84
|
+
pad: number;
|
|
85
|
+
decorative?: boolean; /** for a hud plane: the drawing and its size in viewBox units, instead of text */
|
|
86
|
+
svg?: {
|
|
87
|
+
w: number;
|
|
88
|
+
h: number;
|
|
89
|
+
inner: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Options every node takes. */
|
|
94
|
+
export interface NodeOpts {
|
|
95
|
+
/** position of the node's origin in its parent */
|
|
96
|
+
at?: V3;
|
|
97
|
+
/** Euler rotation in degrees */
|
|
98
|
+
rot?: V3;
|
|
99
|
+
/** uniform scale, 1 by default */
|
|
100
|
+
scale?: number;
|
|
101
|
+
/** transparency of the whole node, 0 to 1. Animatable. */
|
|
102
|
+
opacity?: number;
|
|
103
|
+
/** draw order between groups of things: lower first. Labels default to above geometry. */
|
|
104
|
+
layer?: number;
|
|
105
|
+
/** a name for finding the node later */
|
|
106
|
+
name?: string;
|
|
107
|
+
}
|
|
108
|
+
/** The base of everything in a scene. A node has a position, rotation, scale and opacity, and animatable properties. */
|
|
109
|
+
export declare abstract class Node extends Animatable {
|
|
110
|
+
id: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
parent?: Group;
|
|
113
|
+
layer: number;
|
|
114
|
+
constructor(o?: NodeOpts);
|
|
115
|
+
/** point in this node's own space to the parent's space */
|
|
116
|
+
private local;
|
|
117
|
+
/** point in this node's own space to world space */
|
|
118
|
+
world(p: V3): V3;
|
|
119
|
+
/** a point in world space as a point in this node's own space: the inverse of `world` */
|
|
120
|
+
toLocal(p: V3): V3;
|
|
121
|
+
/** a direction in this node's own space as a direction in world space (rotation and scale, no translation) */
|
|
122
|
+
worldDir(d: V3): V3;
|
|
123
|
+
/** a point that stays attached to this node as it moves, rotates and scales */
|
|
124
|
+
anchor(local: V3): () => V3;
|
|
125
|
+
/** opacity of this node times that of every group above it */
|
|
126
|
+
get opacityEff(): number;
|
|
127
|
+
/** draw layer of this node plus that of every group above it */
|
|
128
|
+
get layerEff(): number;
|
|
129
|
+
/** appends what this node draws right now to `out`, in world coordinates. Draws nothing when fully transparent. */
|
|
130
|
+
abstract collect(out: Prim[]): void;
|
|
131
|
+
}
|
|
132
|
+
/** A node that holds other nodes and moves, turns and scales them together. */
|
|
133
|
+
export declare class Group extends Node {
|
|
134
|
+
children: Node[];
|
|
135
|
+
/** adds nodes to the group. Adding one node returns it, so you can keep a handle: `const b = g.add(box())`. */
|
|
136
|
+
add<T extends Node>(node: T): T;
|
|
137
|
+
add(...nodes: Node[]): void;
|
|
138
|
+
/** takes a node out of the group. Does nothing for a node that is not in this group. */
|
|
139
|
+
remove(n: Node): void;
|
|
140
|
+
collect(out: Prim[]): void;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Returns a URL that is safe to put in a link, or throws. It is read the way a browser reads it, so hidden control
|
|
144
|
+
* characters do not help. Relative addresses, `http`, `https`, `mailto` and `tel` pass.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* const s = new Scene({ view: 'front', size: [320, 160], title: 'A linked box' });
|
|
148
|
+
* const d = s.add(diagram());
|
|
149
|
+
* d.node('docs', 'read the docs', { href: safeHref('/docs') });
|
|
150
|
+
*/
|
|
151
|
+
export declare function safeHref(href: string): string;
|
|
152
|
+
/**
|
|
153
|
+
* The clickable area of something that is a link. What it covers may be drawn as many separate pieces, sorted by depth
|
|
154
|
+
* with the rest of the scene; the area is a single element above the picture, so it is one Tab stop.
|
|
155
|
+
*/
|
|
156
|
+
export declare class LinkArea extends Node {
|
|
157
|
+
pts: V3[];
|
|
158
|
+
href: string;
|
|
159
|
+
text: string;
|
|
160
|
+
constructor(pts: V3[], href: string, text: string);
|
|
161
|
+
collect(out: Prim[]): void;
|
|
162
|
+
}
|
|
163
|
+
/** Colour and line width, shared by lines, faces and text. */
|
|
164
|
+
export interface StyleOpts {
|
|
165
|
+
/** colour role: ink, faint, accent, warm, cool, s1 to s8, or any name you define in CSS as .cn-r-name */
|
|
166
|
+
role?: string;
|
|
167
|
+
/** line width in SVG units */
|
|
168
|
+
width?: number;
|
|
169
|
+
}
|
|
170
|
+
/** Options of lines and paths. */
|
|
171
|
+
export interface PathOpts extends NodeOpts, StyleOpts {
|
|
172
|
+
/** join the last point back to the first */
|
|
173
|
+
closed?: boolean;
|
|
174
|
+
/** where to put arrowheads */
|
|
175
|
+
arrow?: 'start' | 'end' | 'both';
|
|
176
|
+
/** an SVG dash pattern such as `'3 3'` */
|
|
177
|
+
dash?: string;
|
|
178
|
+
/** dashes travel along the line (in the direction it is drawn): true, or cycles per second. Runs in CSS, so it works in a static SVG too. */
|
|
179
|
+
flow?: boolean | number;
|
|
180
|
+
/** how much of the line is drawn, 0 to 1. Animate it for a draw-on effect. */
|
|
181
|
+
draw?: number;
|
|
182
|
+
}
|
|
183
|
+
/** the speed of a flow option in cycles per second, or undefined when off */
|
|
184
|
+
export declare const flowOf: (f: boolean | number | undefined) => number | undefined;
|
|
185
|
+
/** A line through points, drawn as one SVG path. */
|
|
186
|
+
export declare class Path extends Node {
|
|
187
|
+
pts: Point[];
|
|
188
|
+
o: PathOpts;
|
|
189
|
+
constructor(pts: Point[], o?: PathOpts);
|
|
190
|
+
collect(out: Prim[]): void;
|
|
191
|
+
}
|
|
192
|
+
/** A line through the samples of a function, drawn as one SVG path. */
|
|
193
|
+
export declare class Curve extends Node {
|
|
194
|
+
fn: (t: number) => V3;
|
|
195
|
+
o: PathOpts & {
|
|
196
|
+
range?: [number, number];
|
|
197
|
+
samples?: number;
|
|
198
|
+
};
|
|
199
|
+
constructor(fn: (t: number) => V3, o?: PathOpts & {
|
|
200
|
+
range?: [number, number];
|
|
201
|
+
samples?: number;
|
|
202
|
+
});
|
|
203
|
+
collect(out: Prim[]): void;
|
|
204
|
+
}
|
|
205
|
+
/** A circle or arc in one of the coordinate planes. Angles are in degrees. */
|
|
206
|
+
export declare function arcPoints(r: number, plane: 'xy' | 'xz' | 'yz', a0?: number, a1?: number, seg?: number): V3[];
|
|
207
|
+
/** A dot of fixed size on the screen at a point of the scene. */
|
|
208
|
+
export declare class Dot extends Node {
|
|
209
|
+
o: StyleOpts & {
|
|
210
|
+
r?: number;
|
|
211
|
+
};
|
|
212
|
+
constructor(o?: NodeOpts & StyleOpts & {
|
|
213
|
+
r?: number;
|
|
214
|
+
});
|
|
215
|
+
collect(out: Prim[]): void;
|
|
216
|
+
}
|
|
217
|
+
/** Options of filled surfaces. */
|
|
218
|
+
export interface FaceOpts extends NodeOpts, StyleOpts {
|
|
219
|
+
/** colour strength, 0 to 1. Low values are a tint, 1 is the full role colour. */
|
|
220
|
+
fill?: number;
|
|
221
|
+
/** see-through amount. 1 is solid, 0.2 is a faint pane of glass. */
|
|
222
|
+
alpha?: number;
|
|
223
|
+
/** light the face from the scene's light, darker or lighter by angle */
|
|
224
|
+
shade?: boolean;
|
|
225
|
+
/** draw the outline */
|
|
226
|
+
outline?: boolean;
|
|
227
|
+
}
|
|
228
|
+
/** One flat polygon. */
|
|
229
|
+
export declare class Face extends Node {
|
|
230
|
+
pts: Point[];
|
|
231
|
+
o: FaceOpts;
|
|
232
|
+
constructor(pts: Point[], o?: FaceOpts);
|
|
233
|
+
collect(out: Prim[]): void;
|
|
234
|
+
}
|
|
235
|
+
type BoxSize = number | [number, number, number];
|
|
236
|
+
/** Options of `box`. */
|
|
237
|
+
export interface BoxOpts extends FaceOpts {
|
|
238
|
+
/** [width (x), depth (y), height (z)], or one number for a cube */
|
|
239
|
+
size?: BoxSize;
|
|
240
|
+
}
|
|
241
|
+
/** A box standing on the point `at`: the centre of its base. */
|
|
242
|
+
export declare class Box extends Node {
|
|
243
|
+
o: BoxOpts;
|
|
244
|
+
constructor(o?: BoxOpts);
|
|
245
|
+
/** named points on the box, in world space, that follow it when it moves */
|
|
246
|
+
pt(name: 'top' | 'bottom' | 'center' | 'front' | 'back' | 'left' | 'right'): () => V3;
|
|
247
|
+
collect(out: Prim[]): void;
|
|
248
|
+
}
|
|
249
|
+
/** Options of `surface`. */
|
|
250
|
+
export interface SurfaceOpts extends FaceOpts {
|
|
251
|
+
/** parameter ranges */
|
|
252
|
+
u?: [number, number];
|
|
253
|
+
/** range of the second parameter, `[min, max]` */
|
|
254
|
+
v?: [number, number];
|
|
255
|
+
/** number of cells along u and v */
|
|
256
|
+
res?: [number, number];
|
|
257
|
+
/** returns 0 to 1 per point, blending the colour from the role towards the accent */
|
|
258
|
+
color?: (p: V3, u: number, v: number) => number;
|
|
259
|
+
}
|
|
260
|
+
/** A parametric surface (u, v) to a point, drawn as a mesh of shaded quads. A function z = f(x, y) is a special case. */
|
|
261
|
+
export declare class Surface extends Node {
|
|
262
|
+
fn: (u: number, v: number) => V3;
|
|
263
|
+
o: SurfaceOpts;
|
|
264
|
+
constructor(fn: (u: number, v: number) => V3, o?: SurfaceOpts);
|
|
265
|
+
collect(out: Prim[]): void;
|
|
266
|
+
}
|
|
267
|
+
/** Options of `label`. */
|
|
268
|
+
export interface TextOpts extends NodeOpts, StyleOpts {
|
|
269
|
+
/** which end of the text sits at the point */
|
|
270
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
271
|
+
/** nudge in final pixels (a text always faces the viewer) */
|
|
272
|
+
dx?: number;
|
|
273
|
+
/** nudge down in pixels */
|
|
274
|
+
dy?: number;
|
|
275
|
+
/** font size in pixels */
|
|
276
|
+
size?: number;
|
|
277
|
+
}
|
|
278
|
+
/** Text that stays upright and readable, attached to a point in the scene. */
|
|
279
|
+
export declare class Label extends Node {
|
|
280
|
+
text: string;
|
|
281
|
+
o: TextOpts;
|
|
282
|
+
constructor(text: string, o?: TextOpts);
|
|
283
|
+
collect(out: Prim[]): void;
|
|
284
|
+
}
|
|
285
|
+
/** Where in the frame a `hud` is pinned. */
|
|
286
|
+
export type HudAnchor = 'top-left' | 'top' | 'top-right' | 'left' | 'center' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right';
|
|
287
|
+
/** Options of `hud`. The position options of other nodes (`at`, `rot`, `scale`) do not apply: a hud is placed by `anchor`. */
|
|
288
|
+
export interface HudOpts extends StyleOpts {
|
|
289
|
+
/** which point of the frame the text is pinned to, 'top-left' by default. The text grows away from the edge: from the left, centred or towards the left. */
|
|
290
|
+
anchor?: HudAnchor;
|
|
291
|
+
/** distance from the edge of the frame (not the padded area) in viewBox units, 8 by default. Ignored on the axis where the anchor is centred. */
|
|
292
|
+
pad?: number;
|
|
293
|
+
/** nudge right in pixels */
|
|
294
|
+
dx?: number;
|
|
295
|
+
/** nudge down in pixels */
|
|
296
|
+
dy?: number;
|
|
297
|
+
/** font size in pixels, 7.5 by default. The line is placed as if the text were this size. */
|
|
298
|
+
size?: number;
|
|
299
|
+
/** transparency, 0 to 1. Animatable. */
|
|
300
|
+
opacity?: number;
|
|
301
|
+
/** hide the text from screen readers. Off by default, like `label`. */
|
|
302
|
+
decorative?: boolean;
|
|
303
|
+
/** a name for finding the node later */
|
|
304
|
+
name?: string;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Text pinned to the frame, not to the scene: the camera, zoom, orbit and fit do not move it, and it is
|
|
308
|
+
* drawn above everything else. Use it for a caption or a corner readout. `typeOn` and `fadeIn` work on it.
|
|
309
|
+
*/
|
|
310
|
+
export declare class Hud extends Node {
|
|
311
|
+
text: string;
|
|
312
|
+
o: HudOpts;
|
|
313
|
+
constructor(text: string, o?: HudOpts);
|
|
314
|
+
collect(out: Prim[]): void;
|
|
315
|
+
}
|
|
316
|
+
/** Options of `plane`. */
|
|
317
|
+
export interface PlaneOpts extends NodeOpts {
|
|
318
|
+
/** the SVG to place: its source text */
|
|
319
|
+
svg: string;
|
|
320
|
+
/** size of the plane in world units: [width along u, height along v] */
|
|
321
|
+
size: [number, number];
|
|
322
|
+
/** direction of the SVG's x axis, and of its (upward) y axis, in the node's space. Defaults to the x and z axes: a wall facing you. */
|
|
323
|
+
u?: V3;
|
|
324
|
+
/** direction of the SVG's upward y axis in the node's space */
|
|
325
|
+
v?: V3;
|
|
326
|
+
/** swap hard-coded colours in the SVG for CSS variables, e.g. { '#ffffff': 'var(--c-bg)' } */
|
|
327
|
+
recolor?: Record<string, string>;
|
|
328
|
+
/** a line around the plane */
|
|
329
|
+
border?: string | false;
|
|
330
|
+
/** pieces per side when the camera has perspective. More is smoother and slower. */
|
|
331
|
+
cells?: number;
|
|
332
|
+
/** see-through amount of the SVG, 0 to 1 */
|
|
333
|
+
alpha?: number;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Any SVG laid on a plane in 3D. With a parallel camera the placement is exact. With perspective
|
|
337
|
+
* it is a close approximation, built from small pieces (an SVG can only be sheared, not foreshortened).
|
|
338
|
+
*/
|
|
339
|
+
export declare class Plane extends Node {
|
|
340
|
+
parsed: ParsedSvg;
|
|
341
|
+
o: PlaneOpts;
|
|
342
|
+
constructor(o: PlaneOpts);
|
|
343
|
+
collect(out: Prim[]): void;
|
|
344
|
+
}
|
|
345
|
+
/** Shared by everything that lays flat 2D content on a plane: emits the plane and its optional outline. */
|
|
346
|
+
export declare function pushPlane(node: Node, o: {
|
|
347
|
+
size: [number, number];
|
|
348
|
+
u?: V3;
|
|
349
|
+
v?: V3;
|
|
350
|
+
svg: ParsedSvg;
|
|
351
|
+
cells?: number;
|
|
352
|
+
border?: string | false;
|
|
353
|
+
cull?: boolean;
|
|
354
|
+
opacity: number;
|
|
355
|
+
}, out: Prim[]): void;
|
|
356
|
+
/** Several spheres drawn as one body: overlapping balls, like a cloud, are ordered together by depth. */
|
|
357
|
+
export declare class Spheres extends Node {
|
|
358
|
+
list: [V3, number][];
|
|
359
|
+
o: StyleOpts & {
|
|
360
|
+
fill?: number;
|
|
361
|
+
alpha?: number;
|
|
362
|
+
res?: number;
|
|
363
|
+
outline?: boolean; /** light the balls from the scene's light, on by default */
|
|
364
|
+
shade?: boolean;
|
|
365
|
+
};
|
|
366
|
+
constructor(list: [V3, number][], o?: NodeOpts & StyleOpts & {
|
|
367
|
+
fill?: number;
|
|
368
|
+
alpha?: number;
|
|
369
|
+
res?: number;
|
|
370
|
+
outline?: boolean; /** light the balls from the scene's light, on by default */
|
|
371
|
+
shade?: boolean;
|
|
372
|
+
});
|
|
373
|
+
collect(out: Prim[]): void;
|
|
374
|
+
}
|
|
375
|
+
/** The ground lattice. With a parallel camera it fills the whole picture. */
|
|
376
|
+
export declare class Ground extends Node {
|
|
377
|
+
o: {
|
|
378
|
+
step?: number;
|
|
379
|
+
extent?: number;
|
|
380
|
+
};
|
|
381
|
+
constructor(o?: NodeOpts & {
|
|
382
|
+
step?: number;
|
|
383
|
+
extent?: number;
|
|
384
|
+
});
|
|
385
|
+
collect(out: Prim[]): void;
|
|
386
|
+
}
|
|
387
|
+
export {};
|