@nevuto/novi 0.0.0-stage → 0.3.49
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/COMPONENTS.md +579 -0
- package/LICENSE +21 -0
- package/NOTICE +32 -0
- package/README.md +35 -2
- package/dist/AiAssistant/AiAssistantActionCard.d.ts +39 -0
- package/dist/AiAssistant/AiAssistantActionCard.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantAnswer.d.ts +54 -0
- package/dist/AiAssistant/AiAssistantAnswer.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantBottom.d.ts +22 -0
- package/dist/AiAssistant/AiAssistantBottom.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantHeader.d.ts +34 -0
- package/dist/AiAssistant/AiAssistantHeader.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantImageGroup.d.ts +21 -0
- package/dist/AiAssistant/AiAssistantImageGroup.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantInput.d.ts +70 -0
- package/dist/AiAssistant/AiAssistantInput.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantLauncher.d.ts +41 -0
- package/dist/AiAssistant/AiAssistantLauncher.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantLink.d.ts +27 -0
- package/dist/AiAssistant/AiAssistantLink.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantMenu.d.ts +13 -0
- package/dist/AiAssistant/AiAssistantMenu.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantModal.d.ts +39 -0
- package/dist/AiAssistant/AiAssistantModal.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantQuestion.d.ts +34 -0
- package/dist/AiAssistant/AiAssistantQuestion.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantQuestionCard.d.ts +46 -0
- package/dist/AiAssistant/AiAssistantQuestionCard.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantReasoning.d.ts +34 -0
- package/dist/AiAssistant/AiAssistantReasoning.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantRecommendation.d.ts +26 -0
- package/dist/AiAssistant/AiAssistantRecommendation.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantReference.d.ts +42 -0
- package/dist/AiAssistant/AiAssistantReference.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantReferencePanel.d.ts +28 -0
- package/dist/AiAssistant/AiAssistantReferencePanel.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantSecretField.d.ts +21 -0
- package/dist/AiAssistant/AiAssistantSecretField.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantSuggestions.d.ts +21 -0
- package/dist/AiAssistant/AiAssistantSuggestions.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantTask.d.ts +21 -0
- package/dist/AiAssistant/AiAssistantTask.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantThinking.d.ts +22 -0
- package/dist/AiAssistant/AiAssistantThinking.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantTitle.d.ts +13 -0
- package/dist/AiAssistant/AiAssistantTitle.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantToolCall.d.ts +30 -0
- package/dist/AiAssistant/AiAssistantToolCall.d.ts.map +1 -0
- package/dist/AiAssistant/AiAssistantToolCallGroup.d.ts +22 -0
- package/dist/AiAssistant/AiAssistantToolCallGroup.d.ts.map +1 -0
- package/dist/AiAssistant/index.d.ts +46 -0
- package/dist/AiAssistant/index.d.ts.map +1 -0
- package/dist/AiAssistant/useControlled.d.ts +14 -0
- package/dist/AiAssistant/useControlled.d.ts.map +1 -0
- package/dist/AiAssistant/usePaper.d.ts +9 -0
- package/dist/AiAssistant/usePaper.d.ts.map +1 -0
- package/dist/Novi/Novi.d.ts +55 -0
- package/dist/Novi/Novi.d.ts.map +1 -0
- package/dist/Novi/useResolvedColor.d.ts +3 -0
- package/dist/Novi/useResolvedColor.d.ts.map +1 -0
- package/dist/NoviTile/NoviTile.d.ts +22 -0
- package/dist/NoviTile/NoviTile.d.ts.map +1 -0
- package/dist/engine/decor.d.ts +115 -0
- package/dist/engine/decor.d.ts.map +1 -0
- package/dist/engine/engine.d.ts +210 -0
- package/dist/engine/engine.d.ts.map +1 -0
- package/dist/engine/expressions.d.ts +26 -0
- package/dist/engine/expressions.d.ts.map +1 -0
- package/dist/engine/eyefit.d.ts +35 -0
- package/dist/engine/eyefit.d.ts.map +1 -0
- package/dist/engine/face.d.ts +63 -0
- package/dist/engine/face.d.ts.map +1 -0
- package/dist/engine/frame.d.ts +26 -0
- package/dist/engine/frame.d.ts.map +1 -0
- package/dist/engine/gaze.d.ts +108 -0
- package/dist/engine/gaze.d.ts.map +1 -0
- package/dist/engine/math.d.ts +21 -0
- package/dist/engine/math.d.ts.map +1 -0
- package/dist/engine/profiles.d.ts +8 -0
- package/dist/engine/profiles.d.ts.map +1 -0
- package/dist/engine/shape.d.ts +79 -0
- package/dist/engine/shape.d.ts.map +1 -0
- package/dist/engine/skins.d.ts +44 -0
- package/dist/engine/skins.d.ts.map +1 -0
- package/dist/engine/states.d.ts +85 -0
- package/dist/engine/states.d.ts.map +1 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +2940 -0
- package/package.json +48 -3
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { ArcRender, DotRender } from './decor';
|
|
2
|
+
import { NoviExpression } from './expressions';
|
|
3
|
+
import { StateId } from './states';
|
|
4
|
+
export interface RenderedEye {
|
|
5
|
+
d: string;
|
|
6
|
+
matrix: string;
|
|
7
|
+
alpha: number;
|
|
8
|
+
}
|
|
9
|
+
export interface NoviFrame {
|
|
10
|
+
bodyPath: string;
|
|
11
|
+
bodyAlpha: number;
|
|
12
|
+
eyes: RenderedEye[];
|
|
13
|
+
dots: DotRender[];
|
|
14
|
+
/** true = the dots pass behind the body (the burst's particles) */
|
|
15
|
+
dotsBehind: boolean;
|
|
16
|
+
arcs: ArcRender[];
|
|
17
|
+
notif: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
r: number;
|
|
21
|
+
} | null;
|
|
22
|
+
notch: {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
r: number;
|
|
26
|
+
} | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Where Novi aims its gaze when something external drives it — the mouse pointer,
|
|
30
|
+
* today.
|
|
31
|
+
*
|
|
32
|
+
* `yaw` and `pitch` are ABSOLUTE directions, which replace the pose's own as `mix`
|
|
33
|
+
* rises. Two reasons, each one a trap already fallen into:
|
|
34
|
+
*
|
|
35
|
+
* - it is the ENGINE that must do this mixing, not the caller, because only the
|
|
36
|
+
* engine knows the pose AT THIS INSTANT. A caller compensating for the
|
|
37
|
+
* expression's orientation would read its landing value while the morph is still
|
|
38
|
+
* running, and the eyes jumped on every mood change;
|
|
39
|
+
* - and it has to be absolute on BOTH axes. Relative, the height of the eyes
|
|
40
|
+
* followed each expression's own — `neutral` looks at +28.6deg when the others sit
|
|
41
|
+
* between -9 and +9 — so the eyes dropped at the first mood change. What gives an
|
|
42
|
+
* expression its character while following is the SHAPE of its eyes (narrowed,
|
|
43
|
+
* round, mismatched), not where it looks: that, the cursor decides.
|
|
44
|
+
*
|
|
45
|
+
* `mix` says how much the outside commands the DIRECTION (0 = not at all).
|
|
46
|
+
*
|
|
47
|
+
* `wander` says, separately, how much automatic drift remains. The two are not the
|
|
48
|
+
* same: when the pointer moves, the drift must die down — combined, Novi would look
|
|
49
|
+
* like it is hunting for the cursor without ever holding it. But when there is NO
|
|
50
|
+
* pointer (keyboard arrival, touch, or the mouse leaving the window), the head must
|
|
51
|
+
* stay turned AND keep living. Conflating them froze the gaze as soon as the view
|
|
52
|
+
* opened.
|
|
53
|
+
*
|
|
54
|
+
* `spin` is a turn to travel ON THE WAY, in degrees, faded towards 0 as it lands.
|
|
55
|
+
* Since the eyes live on a sphere, a turn takes them behind the ball and back round
|
|
56
|
+
* the other side — and -360deg being the same angle as 0, it changes nothing about
|
|
57
|
+
* where they come to rest.
|
|
58
|
+
*/
|
|
59
|
+
export interface Look {
|
|
60
|
+
yaw: number;
|
|
61
|
+
pitch: number;
|
|
62
|
+
mix: number;
|
|
63
|
+
spin: number;
|
|
64
|
+
wander: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A clockless engine: `sample(t)` is a pure function of time.
|
|
68
|
+
*
|
|
69
|
+
* Practical consequence: pause, resume, slow motion and a jump to an arbitrary date
|
|
70
|
+
* all give exactly the same image, and the render is testable without a DOM. Nothing
|
|
71
|
+
* in here may read a real-time clock, and `sample()` must not mutate — purging a
|
|
72
|
+
* stale previous state during playback makes the engine non-replayable.
|
|
73
|
+
*/
|
|
74
|
+
export declare class NoviEngine {
|
|
75
|
+
/** radius of the ball at rest, in viewBox units */
|
|
76
|
+
readonly scale: number;
|
|
77
|
+
private cur;
|
|
78
|
+
private prev;
|
|
79
|
+
/**
|
|
80
|
+
* FROZEN start pose, laid down only when a state change arrives while a fade is
|
|
81
|
+
* already running. See `setState`.
|
|
82
|
+
*/
|
|
83
|
+
private frozenStart;
|
|
84
|
+
private tCur;
|
|
85
|
+
private tPrev;
|
|
86
|
+
private blinkAt;
|
|
87
|
+
private pts;
|
|
88
|
+
private shape;
|
|
89
|
+
private shapePrev;
|
|
90
|
+
private shapeAt;
|
|
91
|
+
private expr;
|
|
92
|
+
private exprPrev;
|
|
93
|
+
private exprAt;
|
|
94
|
+
private look;
|
|
95
|
+
private lookPrev;
|
|
96
|
+
private lookAt;
|
|
97
|
+
/** the catch-up duration in force; see `LOOK_MORPH`, its default */
|
|
98
|
+
private lookMorph;
|
|
99
|
+
/** morph duration when the body's shape changes */
|
|
100
|
+
static readonly SHAPE_MORPH = 0.45;
|
|
101
|
+
/**
|
|
102
|
+
* How long the gaze takes to catch up with its target. Shorter than `SHAPE_MORPH`:
|
|
103
|
+
* a following gaze must look attentive, not viscous. Since the target is re-laid on
|
|
104
|
+
* every mouse move, this duration is what gives the follow its inertia — the gaze
|
|
105
|
+
* never quite reaches a cursor that keeps moving.
|
|
106
|
+
*/
|
|
107
|
+
static readonly LOOK_MORPH = 0.24;
|
|
108
|
+
constructor(scale?: number, initial?: StateId, shape?: number[] | null, expression?: NoviExpression | null);
|
|
109
|
+
/**
|
|
110
|
+
* The resting expression chosen in the customiser. Like the shape, it glides
|
|
111
|
+
* towards the new value instead of jumping.
|
|
112
|
+
*/
|
|
113
|
+
setExpression(expression: NoviExpression | null, now?: number): void;
|
|
114
|
+
/** The effective expression at `now`, morph in progress included. */
|
|
115
|
+
private exprAtTime;
|
|
116
|
+
/**
|
|
117
|
+
* The shape chosen in the customiser. It only replaces the body on the resting
|
|
118
|
+
* states (`baseBody`): on the others the silhouette IS the animation and must not
|
|
119
|
+
* be overwritten.
|
|
120
|
+
*
|
|
121
|
+
* The change is a morph, not a jump: since every shape is sampled at the same
|
|
122
|
+
* angles, interpolating the radii is enough.
|
|
123
|
+
*/
|
|
124
|
+
setShape(radii: number[] | null, now?: number): void;
|
|
125
|
+
/**
|
|
126
|
+
* The effective shape at `now`, morph in progress included.
|
|
127
|
+
*
|
|
128
|
+
* Does NOT reset `shapePrev` to null when the morph ends: `sample` must stay a pure
|
|
129
|
+
* function of time, so re-reading a past date has to give back the intermediate
|
|
130
|
+
* image. We simply keep one more reference.
|
|
131
|
+
*/
|
|
132
|
+
private shapeAtTime;
|
|
133
|
+
/**
|
|
134
|
+
* A new gaze target, `null` to fall back to the state's own.
|
|
135
|
+
*
|
|
136
|
+
* It restarts from the CURRENT value, and not from the previous target the way
|
|
137
|
+
* `setShape` does: this method is called on every pointer move, and restarting from
|
|
138
|
+
* the old target would step the gaze backwards before every catch-up — the follow
|
|
139
|
+
* would tremble instead of gliding.
|
|
140
|
+
*
|
|
141
|
+
* Same contract as `setShape` otherwise: external state comes in through a dated
|
|
142
|
+
* setter, never through a variable read during `sample`, or the engine stops being
|
|
143
|
+
* a pure function of time.
|
|
144
|
+
*/
|
|
145
|
+
setLook(look: Look | null, now: number, morph?: number): void;
|
|
146
|
+
/** The effective gaze at `now`, catch-up in progress included. */
|
|
147
|
+
private lookAtTime;
|
|
148
|
+
private posed;
|
|
149
|
+
/**
|
|
150
|
+
* The eye offset at `now` for a given state, in ball-radius units.
|
|
151
|
+
*
|
|
152
|
+
* It is READ from a table and interpolated, never recomputed: `eyefit.ts` explains
|
|
153
|
+
* why that distinction is the whole fix. All that is left here is interpolating it
|
|
154
|
+
* along the shape's axis, with exactly the silhouette morph's curve and duration —
|
|
155
|
+
* it is the same cause, so it must be the same movement.
|
|
156
|
+
*
|
|
157
|
+
* The table is queried on the morph's BOUNDARIES (`shapePrev` and `shape`) and not
|
|
158
|
+
* on the profile `shapeAtTime` returns: that one is a fresh array allocated every
|
|
159
|
+
* frame, so it has no identity and exists in no table.
|
|
160
|
+
*/
|
|
161
|
+
private eyeOffsetAtTime;
|
|
162
|
+
get state(): StateId;
|
|
163
|
+
/**
|
|
164
|
+
* Restarts on `id` WITH NO previous state, like a fresh engine placed on it.
|
|
165
|
+
*
|
|
166
|
+
* This is what "rewind" means for this engine. `setState` alone cannot do it: it
|
|
167
|
+
* keeps the state being left in order to fade from it, which is exactly its job
|
|
168
|
+
* during playback and exactly what must not happen when returning to the start of a
|
|
169
|
+
* sequence. Replaying frame 0 after a full pass blended the first state with the
|
|
170
|
+
* LAST one, and the export opened on an eyeless ball — the comet has a zero
|
|
171
|
+
* `eyeAlpha`.
|
|
172
|
+
*
|
|
173
|
+
* `sample` stays a pure function of time: like `setState`, this is a DATED setter,
|
|
174
|
+
* called by whatever drives the sequence, never during a sampling.
|
|
175
|
+
*/
|
|
176
|
+
reset(id: StateId, now: number): void;
|
|
177
|
+
/**
|
|
178
|
+
* The origin of the running fade: the frozen pose if there is one, otherwise the
|
|
179
|
+
* state being left evaluated at its own elapsed time — so still animating, which is
|
|
180
|
+
* what we want.
|
|
181
|
+
*/
|
|
182
|
+
private fadeOrigin;
|
|
183
|
+
/**
|
|
184
|
+
* The composite pose at `now`, running fade included: exactly what `sample` blends,
|
|
185
|
+
* before the layer of life-at-rest and gaze. Extracted so that `setState` can
|
|
186
|
+
* freeze it.
|
|
187
|
+
*/
|
|
188
|
+
private composedPose;
|
|
189
|
+
/**
|
|
190
|
+
* A dated state change.
|
|
191
|
+
*
|
|
192
|
+
* The engine keeps only ONE slot of history, so a change arriving during a fade
|
|
193
|
+
* replaced the blend's origin with the FULL pose of the state being left, instead
|
|
194
|
+
* of the partially blended image that was on screen. Measured on
|
|
195
|
+
* `idle -> wide -> idle` at 100 ms: 35.9 px of jump against 8.0 px of normal
|
|
196
|
+
* movement.
|
|
197
|
+
*
|
|
198
|
+
* So we freeze the current composite pose and blend from it. Continuous by
|
|
199
|
+
* construction, however many changes are chained.
|
|
200
|
+
*
|
|
201
|
+
* And ONLY in that case. Freezing on every change would halt the outgoing state's
|
|
202
|
+
* animation for the whole fade — `alert`'s "!" would freeze mid-flight — while
|
|
203
|
+
* there is nothing to correct outside a morph: there the state being left already
|
|
204
|
+
* IS exactly the displayed image. Spaced playback therefore freezes nothing and
|
|
205
|
+
* renders byte for byte what it used to.
|
|
206
|
+
*/
|
|
207
|
+
setState(id: StateId, now: number): void;
|
|
208
|
+
sample(now: number): NoviFrame;
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAapE,OAAO,EAAyC,KAAK,OAAO,EAAE,MAAM,UAAU,CAAA;AAE9E,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAA;IACT,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C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;CAqI/B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HeadGaze } from './face';
|
|
2
|
+
import { EyeCfg } from './states';
|
|
3
|
+
/**
|
|
4
|
+
* The resting expressions offered by the customiser.
|
|
5
|
+
*
|
|
6
|
+
* An expression is a head orientation plus a pair of eye shapes. It replaces the
|
|
7
|
+
* face of the `baseFace` states only — everywhere else the silhouette IS the
|
|
8
|
+
* animation and carries its own measured face.
|
|
9
|
+
*
|
|
10
|
+
* A tilt is only visible on an elongated eye: keep width/height outside [0.6, 1.7]
|
|
11
|
+
* for a tilt of 20 degrees or more, and outside [0.8, 1.25] below that. A near-round
|
|
12
|
+
* eye reads as round however much it is turned.
|
|
13
|
+
*/
|
|
14
|
+
export type ExpressionId = 'neutral' | 'attentive' | 'surprised' | 'excited' | 'happy' | 'laughing' | 'angry' | 'sad' | 'scared' | 'suspicious' | 'confused' | 'curious' | 'proud' | 'shy' | 'unimpressed' | 'sleepy';
|
|
15
|
+
export interface NoviExpression {
|
|
16
|
+
id: ExpressionId;
|
|
17
|
+
gaze: HeadGaze;
|
|
18
|
+
split: number;
|
|
19
|
+
eyes: [EyeCfg, EyeCfg];
|
|
20
|
+
}
|
|
21
|
+
export declare const EXPRESSIONS: NoviExpression[];
|
|
22
|
+
export declare const EXPRESSION_BY_ID: Map<string, NoviExpression>;
|
|
23
|
+
export declare const DEFAULT_EXPRESSION: ExpressionId;
|
|
24
|
+
/** Interpolates two expressions: the change happens by gliding. */
|
|
25
|
+
export declare function blendExpression(a: NoviExpression, b: NoviExpression, t: number): NoviExpression;
|
|
26
|
+
//# sourceMappingURL=expressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../src/engine/expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAE/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,WAAW,GACX,WAAW,GACX,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,GACP,KAAK,GACL,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,SAAS,GACT,OAAO,GACP,KAAK,GACL,aAAa,GACb,QAAQ,CAAA;AAEZ,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAA;IAChB,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACvB;AAcD,eAAO,MAAM,WAAW,EAAE,cAAc,EA2GvC,CAAA;AAED,eAAO,MAAM,gBAAgB,6BAAqE,CAAA;AAClG,eAAO,MAAM,kBAAkB,EAAE,YAAwB,CAAA;AASzD,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,MAAM,GAAG,cAAc,CAW/F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { StateId } from './states';
|
|
2
|
+
/**
|
|
3
|
+
* The offset table, built at import: one entry per (shape, base-body state,
|
|
4
|
+
* expression). Only `idle` and `swirl` carry the resting face, so only they are
|
|
5
|
+
* declined per expression — the three other base-body states have a measured face
|
|
6
|
+
* and a single entry.
|
|
7
|
+
*
|
|
8
|
+
* Keyed by REFERENCE of the radii array, which is already the engine's convention:
|
|
9
|
+
* its `radii === this.shape` and `expression === this.expr` guards rest on the same
|
|
10
|
+
* stability. An unknown profile, or `null`, corrects nothing — the API accepts any
|
|
11
|
+
* array and the engine must not depend on its callers being careful.
|
|
12
|
+
*/
|
|
13
|
+
declare function build(): Map<number[], Map<string, {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
}>>;
|
|
17
|
+
/**
|
|
18
|
+
* The offset to apply to both eyes for this shape on this state, in ball-radius
|
|
19
|
+
* units — the engine puts it back to its own scale.
|
|
20
|
+
*
|
|
21
|
+
* Zero as soon as the shape is not in the catalogue, which covers `null` and the
|
|
22
|
+
* circle: on the circle both profiles are the same, so the margin is already the one
|
|
23
|
+
* required and the search exits on the first round. The measured shape therefore
|
|
24
|
+
* does not move, with no special case.
|
|
25
|
+
*/
|
|
26
|
+
export declare function eyeOffset(radii: number[] | null, state: StateId, expr: string | null): {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
/** For tests: enough to time the table's construction without redoing the geometry. */
|
|
31
|
+
export declare const FOR_TESTS: {
|
|
32
|
+
build: typeof build;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=eyefit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eyefit.d.ts","sourceRoot":"","sources":["../../src/engine/eyefit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,EAAoC,KAAK,OAAO,EAAE,MAAM,UAAU,CAAA;AA6VzE;;;;;;;;;;GAUG;AACH,iBAAS,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAcrE;AAID;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EACtB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAM1B;AAED,uFAAuF;AACvF,eAAO,MAAM,SAAS;;CAAY,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Half the eye split on the sphere, in degrees (total separation ~31deg). */
|
|
2
|
+
export declare const EYE_SPLIT = 15.46;
|
|
3
|
+
/** Eye size at rest, in ball-radius units. */
|
|
4
|
+
export declare const EYE_W = 0.186;
|
|
5
|
+
export declare const EYE_H = 0.412;
|
|
6
|
+
/** Head orientation at rest, fitted on the reference frames. */
|
|
7
|
+
export declare const REST_GAZE: HeadGaze;
|
|
8
|
+
export interface EyePose {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
/** 2x2 tangent matrix: [a b c d] in the sense of SVG matrix(a,b,c,d,e,f) */
|
|
12
|
+
a: number;
|
|
13
|
+
b: number;
|
|
14
|
+
c: number;
|
|
15
|
+
d: number;
|
|
16
|
+
/** z component of the normal: > 0 = facing the viewer */
|
|
17
|
+
depth: number;
|
|
18
|
+
}
|
|
19
|
+
export interface HeadGaze {
|
|
20
|
+
/** yaw, degrees, positive = looking right */
|
|
21
|
+
yaw: number;
|
|
22
|
+
/** pitch, degrees, positive = looking up */
|
|
23
|
+
pitch: number;
|
|
24
|
+
/** roll, degrees, head tilt */
|
|
25
|
+
roll: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The head's frame, then the two eyes'.
|
|
29
|
+
* Screen space: x right, y down, z towards the viewer.
|
|
30
|
+
* Index 0 is the inner eye, index 1 the outer one.
|
|
31
|
+
*/
|
|
32
|
+
export declare function eyePoses(gaze: HeadGaze, scale: number, split?: number): [EyePose, EyePose];
|
|
33
|
+
/**
|
|
34
|
+
* Life at rest: slow gaze drift, saccades, blinks.
|
|
35
|
+
*
|
|
36
|
+
* A pure function of time (no internal state), so pause, resume and a jump to an
|
|
37
|
+
* arbitrary date always give the same image. The values are OFFSETS to add to the
|
|
38
|
+
* current state's pose.
|
|
39
|
+
*/
|
|
40
|
+
export interface Liveliness {
|
|
41
|
+
dYaw: number;
|
|
42
|
+
dPitch: number;
|
|
43
|
+
dRoll: number;
|
|
44
|
+
/** 1 = eye open, 0 = closed (vertical squash in screen space) */
|
|
45
|
+
lid: number;
|
|
46
|
+
driftX: number;
|
|
47
|
+
driftY: number;
|
|
48
|
+
breath: number;
|
|
49
|
+
}
|
|
50
|
+
export interface LivelinessOptions {
|
|
51
|
+
wander?: number;
|
|
52
|
+
blink?: boolean;
|
|
53
|
+
float?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare function liveliness(t: number, opt?: LivelinessOptions): Liveliness;
|
|
56
|
+
/**
|
|
57
|
+
* A blink is a VERTICAL squash in screen space about the eye's centre (measured:
|
|
58
|
+
* the bbox width is preserved, the height falls to ~0.35), not a shrink along the
|
|
59
|
+
* capsule's tilted axis. So it composes after the tangent matrix, touching only the
|
|
60
|
+
* y outputs.
|
|
61
|
+
*/
|
|
62
|
+
export declare function blinkScale(lid: number): number;
|
|
63
|
+
//# sourceMappingURL=face.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../../src/engine/face.ts"],"names":[],"mappings":"AAkBA,8EAA8E;AAC9E,eAAO,MAAM,SAAS,QAAQ,CAAA;AAC9B,8CAA8C;AAC9C,eAAO,MAAM,KAAK,QAAQ,CAAA;AAC1B,eAAO,MAAM,KAAK,QAAQ,CAAA;AAE1B,gEAAgE;AAChE,eAAO,MAAM,SAAS,EAAE,QAAkD,CAAA;AAE1E,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,4EAA4E;IAC5E,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAA;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;IACb,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb;AAcD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,SAAY,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CA0B7F;AAED;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAmCD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,iBAAsB,GAAG,UAAU,CAiB7E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reference frame for everything the engine renders.
|
|
3
|
+
*
|
|
4
|
+
* `engine.sample()` returns coordinates in viewBox units, and these two numbers are
|
|
5
|
+
* what defines them: without them an engine output means nothing. They live here
|
|
6
|
+
* rather than in the React component because `engine/` is what gets read and consumed
|
|
7
|
+
* from outside — the component is A client of the engine, not its definition.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Radius of the ball at rest, in viewBox units. This is the `scale` the component
|
|
11
|
+
* hands to `NoviEngine`.
|
|
12
|
+
*
|
|
13
|
+
* Chosen, not measured: it is the working unit. Everything else in this folder is
|
|
14
|
+
* expressed as a fraction of it, which makes the measurements taken off the reference
|
|
15
|
+
* independent of display size.
|
|
16
|
+
*/
|
|
17
|
+
export declare const RADIUS = 100;
|
|
18
|
+
/**
|
|
19
|
+
* Half-side of the rendered viewBox. The margin beyond the radius houses the rings.
|
|
20
|
+
*
|
|
21
|
+
* Not a free value: the orbit rings and the comet swoosh reach 1.4x the radius, i.e.
|
|
22
|
+
* 140. Nothing bounds them at runtime — it is the hand-tuned `RINGS` and `SWOOSH`
|
|
23
|
+
* tables (`decor.ts`) that keep them under 158.
|
|
24
|
+
*/
|
|
25
|
+
export declare const HALF_VIEWBOX = 158;
|
|
26
|
+
//# sourceMappingURL=frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/engine/frame.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,MAAM,CAAA;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,MAAM,CAAA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Look } from './engine';
|
|
2
|
+
/**
|
|
3
|
+
* Where Novi looks when it follows the pointer.
|
|
4
|
+
*
|
|
5
|
+
* Pure, on purpose: the pointer position comes in already normalised, so the rule is
|
|
6
|
+
* testable without a DOM — and it needs to be, because two signs are easy to get
|
|
7
|
+
* wrong here.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Head orientation angles, in degrees. CHOSEN, not measured: the reference shows no
|
|
11
|
+
* pointer following at all. Wide enough to read as distinct from the drift at rest
|
|
12
|
+
* (+-7deg of yaw, +-5.5 of pitch), restrained enough that neither eye disappears
|
|
13
|
+
* behind the sphere's limb.
|
|
14
|
+
*/
|
|
15
|
+
export declare const YAW_MAX = 16;
|
|
16
|
+
export declare const PITCH_MAX = 13;
|
|
17
|
+
/**
|
|
18
|
+
* The height the gaze holds at, pointer centred. CHOSEN: slightly above the equator,
|
|
19
|
+
* which reads as attentive rather than absent.
|
|
20
|
+
*
|
|
21
|
+
* It is an ABSOLUTE value, and that is the whole point: relative, the height of the
|
|
22
|
+
* eyes followed each expression's own, and since `neutral` looks at +28.6deg while
|
|
23
|
+
* the moods sit between -9 and +9, the eyes dropped at the first mood change.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PITCH = 10;
|
|
26
|
+
/**
|
|
27
|
+
* A full turn travelled ON THE WAY: the eyes do not slide across the face, they go
|
|
28
|
+
* round the ball before arriving.
|
|
29
|
+
*
|
|
30
|
+
* This is free because the eyes live on a sphere: past 90deg of yaw they cross the
|
|
31
|
+
* limb, the engine drops them from the image, then they reappear on the other side.
|
|
32
|
+
* So the swirl is not an effect laid on top, it is the same orthographic projection
|
|
33
|
+
* pushed round by a turn.
|
|
34
|
+
*
|
|
35
|
+
* And above all it LANDS RIGHT by construction, -360deg being the same angle as 0.
|
|
36
|
+
* That is what sets it apart from a gaze pose written into a state, which leaves the
|
|
37
|
+
* eyes wherever its curve ends.
|
|
38
|
+
*/
|
|
39
|
+
export declare const SPIN = 360;
|
|
40
|
+
/**
|
|
41
|
+
* How long the turn takes. A little shorter than an entry animation block, so the
|
|
42
|
+
* eyes are settled before the decor fades.
|
|
43
|
+
*/
|
|
44
|
+
export declare const TURN_TIME = 1.1;
|
|
45
|
+
/**
|
|
46
|
+
* A SCRIPTED gaze: evaluated every frame with the time elapsed since it was laid, in
|
|
47
|
+
* seconds. The script therefore carries its own clock and can chain several moves —
|
|
48
|
+
* the component only evaluates it and has no duration to know about.
|
|
49
|
+
*
|
|
50
|
+
* THE RULE, and it is what makes a script maintenance-free: it must END at `mix: 0`,
|
|
51
|
+
* where the state's pose commands alone. There is then never anything to release,
|
|
52
|
+
* and that release — which would show as one last slide of the eyes, right when
|
|
53
|
+
* everything should be settled — does not exist.
|
|
54
|
+
*/
|
|
55
|
+
export type GazeScript = (t: number) => Look;
|
|
56
|
+
/**
|
|
57
|
+
* "The turn": the ball appears to spin on itself.
|
|
58
|
+
*
|
|
59
|
+
* `mix` stays at ZERO from start to finish: no direction is imposed, only `spin`
|
|
60
|
+
* fades, which takes the eyes BEHIND the ball before bringing them back exactly
|
|
61
|
+
* where the chosen expression puts them.
|
|
62
|
+
*
|
|
63
|
+
* Ease-in-OUT and not the exponential ease-out used everywhere else: this is not a
|
|
64
|
+
* value settling, it is an object turning. With an ease-out, two thirds of the turn
|
|
65
|
+
* were swallowed in 0.3 s — a jolt, not a rotation.
|
|
66
|
+
*
|
|
67
|
+
* It is FAST as it crosses the limb — 20 px between two frames on a ball of radius
|
|
68
|
+
* 100 — and that is not a tuning defect: near the edge a small angle becomes a large
|
|
69
|
+
* screen displacement, and the eye vanishes then reappears on the other side.
|
|
70
|
+
* Slowing it down changes nothing, the trajectory wants this, and it is exactly what
|
|
71
|
+
* makes the effect. Do not try to soften it.
|
|
72
|
+
*
|
|
73
|
+
* Necessary corollary: this turn only plays on a CIRCLE. The eyes are re-seated on
|
|
74
|
+
* the real outline (`radiusAtAngle`), so on a non-circular shape they follow the
|
|
75
|
+
* profile as they turn and stutter.
|
|
76
|
+
*/
|
|
77
|
+
export declare const SPIN_TIME = 1.5;
|
|
78
|
+
export declare const spinLook: GazeScript;
|
|
79
|
+
export interface Aim {
|
|
80
|
+
/** horizontal offset of the pointer from Novi's centre, -1 to 1 (right positive) */
|
|
81
|
+
nx: number;
|
|
82
|
+
/** vertical offset, -1 to 1, in screen sense (down positive) */
|
|
83
|
+
ny: number;
|
|
84
|
+
/** how far the arrival has progressed, 0 to 1 */
|
|
85
|
+
progress: number;
|
|
86
|
+
/** false = no pointer known: the head stays turned, but it comes back to life */
|
|
87
|
+
pointer: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Resting yaw the head holds when the pointer is centred, in degrees. Positive
|
|
90
|
+
* turns Novi towards its right (screen right). Use it to make Novi face whatever
|
|
91
|
+
* matters on the page — a panel, a form, a message thread.
|
|
92
|
+
*/
|
|
93
|
+
turn?: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The gaze target.
|
|
97
|
+
*
|
|
98
|
+
* `progress` drives everything: it raises the grip on the pose (`mix`) and fades the
|
|
99
|
+
* travelled turn (`spin`) at the same time. At 0 the state's pose commands alone; at
|
|
100
|
+
* 1 the head is settled and follows the cursor.
|
|
101
|
+
*
|
|
102
|
+
* Nothing here compensates for the displayed expression: the engine does the mixing,
|
|
103
|
+
* because it alone knows the pose at instant t. Doing it here would mean reading the
|
|
104
|
+
* expression's LANDING yaw while the engine is still morphing — and the eyes jumped
|
|
105
|
+
* on every mood change.
|
|
106
|
+
*/
|
|
107
|
+
export declare function lookTarget({ nx, ny, progress, pointer, turn }: Aim): Look;
|
|
108
|
+
//# sourceMappingURL=gaze.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gaze.d.ts","sourceRoot":"","sources":["../../src/engine/gaze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAGpC;;;;;;GAMG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,KAAK,CAAA;AACzB,eAAO,MAAM,SAAS,KAAK,CAAA;AAE3B;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,KAAK,CAAA;AAEvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,MAAM,CAAA;AAEvB;;;GAGG;AACH,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,MAAM,CAAA;AAE5B,eAAO,MAAM,QAAQ,EAAE,UAMrB,CAAA;AAEF,MAAM,WAAW,GAAG;IAClB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAA;IACV,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAA;IACV,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,iFAAiF;IACjF,OAAO,EAAE,OAAO,CAAA;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAQ,EAAE,EAAE,GAAG,GAAG,IAAI,CAY7E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const TAU: number;
|
|
2
|
+
export declare const clamp: (v: number, lo?: number, hi?: number) => number;
|
|
3
|
+
export declare const lerp: (a: number, b: number, t: number) => number;
|
|
4
|
+
export type Easing = (t: number) => number;
|
|
5
|
+
/**
|
|
6
|
+
* Measured, not chosen: transitions are exponential ease-outs and the body never
|
|
7
|
+
* overshoots. The only spring effects are local (the notification pip's pop, the
|
|
8
|
+
* eyes opening) and live inside the state that needs them.
|
|
9
|
+
*/
|
|
10
|
+
export declare const easings: {
|
|
11
|
+
easeOutCubic: (t: number) => number;
|
|
12
|
+
easeInOutCubic: (t: number) => number;
|
|
13
|
+
easeOutQuint: (t: number) => number;
|
|
14
|
+
};
|
|
15
|
+
/** Periodic 1D noise: loops seamlessly over `period`. Drives the gaze drift. */
|
|
16
|
+
export declare function loopNoise(t: number, period: number, seed?: number): number;
|
|
17
|
+
/** Deterministic PRNG (mulberry32): the same sequence on every playback. */
|
|
18
|
+
export declare function createRng(seed: number): () => number;
|
|
19
|
+
/** Short rounding: roughly halves the weight of the path strings generated at 60 fps. */
|
|
20
|
+
export declare const r2: (v: number) => number;
|
|
21
|
+
//# sourceMappingURL=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/engine/math.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,GAAG,QAAc,CAAA;AAE9B,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,EAAE,WAAM,EAAE,WAAM,WAAoC,CAAA;AACnF,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,WAAoB,CAAA;AAExE,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,OAAO;sBACA,MAAM;wBACJ,MAAM;sBACR,MAAM;CACQ,CAAA;AAElC,gFAAgF;AAChF,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,MAAM,CAOrE;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,gBAQrC;AAED,yFAAyF;AACzF,eAAO,MAAM,EAAE,GAAI,GAAG,MAAM,WAA8B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const PROFILE_SAMPLES = 64;
|
|
2
|
+
export declare const PROFILES: {
|
|
3
|
+
readonly egg: readonly [0.8369, 0.8424, 0.8497, 0.8585, 0.8674, 0.8775, 0.8878, 0.8983, 0.9089, 0.9185, 0.9288, 0.9374, 0.9445, 0.9504, 0.9543, 0.9559, 0.9555, 0.9519, 0.9466, 0.9389, 0.9302, 0.9193, 0.9085, 0.8969, 0.8852, 0.8734, 0.8625, 0.8513, 0.8411, 0.8325, 0.8243, 0.8179, 0.8137, 0.8112, 0.8102, 0.8128, 0.8178, 0.8262, 0.8374, 0.8518, 0.8702, 0.8922, 0.9169, 0.9446, 0.9741, 1.0023, 1.0267, 1.0433, 1.0481, 1.0393, 1.0216, 0.997, 0.9697, 0.9418, 0.9169, 0.8949, 0.876, 0.8604, 0.849, 0.8394, 0.8337, 0.8314, 0.8305, 0.8326];
|
|
4
|
+
readonly hexagon: readonly [0.921, 0.9282, 0.9441, 0.9706, 0.9984, 1.0059, 0.9896, 0.9562, 0.929, 0.9124, 0.9047, 0.9058, 0.9157, 0.9349, 0.9642, 0.9873, 0.9882, 0.9665, 0.9336, 0.9105, 0.8968, 0.8918, 0.8955, 0.908, 0.9293, 0.9611, 0.982, 0.9812, 0.959, 0.9282, 0.9089, 0.8978, 0.8964, 0.9026, 0.9189, 0.9439, 0.9778, 0.999, 0.9964, 0.9713, 0.9439, 0.9274, 0.9196, 0.9206, 0.9308, 0.9502, 0.9799, 1.0121, 1.0226, 1.0071, 0.9752, 0.951, 0.9366, 0.9316, 0.9351, 0.9485, 0.9711, 1.0026, 1.0213, 1.0155, 0.9863, 0.9547, 0.9347, 0.9232];
|
|
5
|
+
readonly triangle: readonly [0.7819, 0.8211, 0.8747, 0.944, 1.0223, 1.096, 1.1401, 1.134, 1.0808, 1.0047, 0.9265, 0.8603, 0.8104, 0.773, 0.745, 0.7273, 0.7151, 0.7118, 0.7148, 0.7245, 0.7427, 0.768, 0.8037, 0.8518, 0.9148, 0.9876, 1.0583, 1.1073, 1.1109, 1.0667, 0.994, 0.9164, 0.8482, 0.7948, 0.7555, 0.7261, 0.7056, 0.6925, 0.6859, 0.6869, 0.6938, 0.7084, 0.7305, 0.7615, 0.804, 0.8595, 0.9311, 1.0092, 1.0791, 1.1171, 1.1054, 1.0501, 0.9779, 0.905, 0.845, 0.799, 0.7656, 0.7413, 0.7258, 0.716, 0.7146, 0.7204, 0.733, 0.7528];
|
|
6
|
+
};
|
|
7
|
+
export type ProfileName = keyof typeof PROFILES;
|
|
8
|
+
//# sourceMappingURL=profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/engine/profiles.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,eAAe,KAAK,CAAA;AAEjC,eAAO,MAAM,QAAQ;;;;CAUX,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,QAAQ,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ProfileName } from './profiles';
|
|
2
|
+
export interface Point {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A silhouette = a radial profile r(theta) plus a pose.
|
|
8
|
+
*
|
|
9
|
+
* Everything goes through profiles sampled at the SAME set of angles, so any two
|
|
10
|
+
* shapes have points that correspond one to one and morphing reduces to a linear
|
|
11
|
+
* interpolation of radii. That is what makes the transitions clean without a path
|
|
12
|
+
* morphing library — and why a new shape has to go through a radial profile, or
|
|
13
|
+
* through `profileFromPolygon`.
|
|
14
|
+
*/
|
|
15
|
+
export interface Silhouette {
|
|
16
|
+
radii: number[];
|
|
17
|
+
/** profile rotation, in radians */
|
|
18
|
+
rot: number;
|
|
19
|
+
/** centre offset, in ball-radius units */
|
|
20
|
+
cx: number;
|
|
21
|
+
cy: number;
|
|
22
|
+
/** squash & stretch, applied in screen space (after rotation) */
|
|
23
|
+
sx: number;
|
|
24
|
+
sy: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function silhouette(name: ProfileName, pose?: Partial<Silhouette>): Silhouette;
|
|
27
|
+
/** Perfect circle: the neutral base (a dot, a bubble, a fade target). */
|
|
28
|
+
export declare function circle(radius: number, pose?: Partial<Silhouette>): Silhouette;
|
|
29
|
+
/** Interpolates two silhouettes. `out` is reused to avoid allocating at 60 fps. */
|
|
30
|
+
export declare function blend(a: Silhouette, b: Silhouette, t: number, out?: Silhouette): Silhouette;
|
|
31
|
+
/** Projects the silhouette to screen points. `scale` = ball radius in viewBox units. */
|
|
32
|
+
export declare function toPoints(s: Silhouette, scale: number, out?: Point[]): Point[];
|
|
33
|
+
/**
|
|
34
|
+
* Closed polyline -> Catmull-Rom cubics.
|
|
35
|
+
*
|
|
36
|
+
* With 64 points, centred tangents are plenty: the outline is smooth to the pixel
|
|
37
|
+
* even at 600 px, and the string stays short.
|
|
38
|
+
*/
|
|
39
|
+
export declare function closedPath(pts: Point[], tension?: number): string;
|
|
40
|
+
/**
|
|
41
|
+
* Arbitrary polygon -> radial profile, by ray casting from `center`.
|
|
42
|
+
*
|
|
43
|
+
* Builds the shapes that do not express naturally as r(theta) (the tapered bar of
|
|
44
|
+
* the "!"). Computed once at import, never inside the render loop.
|
|
45
|
+
*/
|
|
46
|
+
export declare function profileFromPolygon(poly: Point[], cx: number, cy: number): number[];
|
|
47
|
+
/** Convex hull of two circles: the tapered bar of the vertical "!". */
|
|
48
|
+
export declare function hullOfCircles(x1: number, y1: number, r1: number, x2: number, y2: number, r2v: number, steps?: number): Point[];
|
|
49
|
+
/**
|
|
50
|
+
* Profile radius in an arbitrary direction, interpolated between the two
|
|
51
|
+
* neighbouring samples.
|
|
52
|
+
*
|
|
53
|
+
* Anything sitting "on" the body (the eyes, the notification pip) must follow its
|
|
54
|
+
* real radius: without this, an eye placed at 0.62 radius leaves a shape whose edge
|
|
55
|
+
* is at 0.55 in that direction, and the mask clips it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function radiusAtAngle(radii: number[], angle: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* Superellipse: |x/sx|^n + |y/sy|^n = 1.
|
|
60
|
+
* n = 2 gives an ellipse, n ~ 4 the customiser's squircle.
|
|
61
|
+
*/
|
|
62
|
+
export declare function superellipseProfile(n: number, sx?: number, sy?: number): number[];
|
|
63
|
+
/**
|
|
64
|
+
* Radial profile of a UNION of disks: r(theta) = the furthest ray/circle
|
|
65
|
+
* intersection. Exact as long as the origin sits inside the union — this is what
|
|
66
|
+
* gives the cloud its bumps without a boolean path operation.
|
|
67
|
+
*/
|
|
68
|
+
export declare function unionOfCirclesProfile(circles: Array<{
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
r: number;
|
|
72
|
+
}>): number[];
|
|
73
|
+
/** Regular polygon with rounded corners, inscribed in `radius`. */
|
|
74
|
+
export declare function regularPolygonProfile(sides: number, radius: number, rc: number, rotationDeg?: number): number[];
|
|
75
|
+
/** Exact closed polyline: keeps the straight segments, unlike `closedPath`. */
|
|
76
|
+
export declare function polyPath(pts: Point[], scale?: number): string;
|
|
77
|
+
/** Capsule (stadium) centred on the origin: the exact shape of Novi's eyes. */
|
|
78
|
+
export declare function capsulePath(w: number, h: number): string;
|
|
79
|
+
//# sourceMappingURL=shape.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../src/engine/shape.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,YAAY,CAAA;AAExE,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;IACV,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAMD,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAUxF;AAED,yEAAyE;AACzE,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,OAAO,CAAC,UAAU,CAAM,GAAG,UAAU,CAUjF;AAED,mFAAmF;AACnF,wBAAgB,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,UAAU,CAuB3F;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,GAAE,KAAK,EAAO,GAAG,KAAK,EAAE,CAiBjF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GA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