@msb235/blits 0.4.0 → 0.5.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/CHANGELOG.md +262 -0
- package/README.md +2 -1
- package/dist/bare.d.ts +29 -0
- package/dist/bare.js +105 -0
- package/dist/blend.d.ts +34 -0
- package/dist/blend.js +102 -0
- package/dist/book.d.ts +53 -0
- package/dist/book.js +218 -0
- package/dist/chain.d.ts +22 -0
- package/dist/chain.js +150 -0
- package/dist/channels.d.ts +2 -0
- package/dist/channels.js +3 -1
- package/dist/clock.d.ts +50 -3
- package/dist/clock.js +102 -9
- package/dist/clone.d.ts +7 -0
- package/dist/clone.js +57 -0
- package/dist/columns.d.ts +29 -0
- package/dist/columns.js +183 -0
- package/dist/crowd.d.ts +128 -0
- package/dist/crowd.js +354 -0
- package/dist/cue.d.ts +3 -0
- package/dist/cue.js +115 -0
- package/dist/due.d.ts +12 -0
- package/dist/due.js +93 -0
- package/dist/fade.d.ts +19 -0
- package/dist/fade.js +133 -0
- package/dist/fill.d.ts +42 -0
- package/dist/fill.js +381 -0
- package/dist/fold.d.ts +51 -0
- package/dist/fold.js +475 -0
- package/dist/gather.d.ts +24 -0
- package/dist/gather.js +186 -0
- package/dist/handle.d.ts +31 -0
- package/dist/handle.js +56 -0
- package/dist/held.d.ts +14 -0
- package/dist/held.js +117 -0
- package/dist/history.d.ts +22 -0
- package/dist/history.js +149 -0
- package/dist/hosts.d.ts +16 -0
- package/dist/hosts.js +178 -0
- package/dist/index.d.ts +1 -1
- package/dist/keyrows.d.ts +36 -0
- package/dist/keyrows.js +138 -0
- package/dist/lane.d.ts +210 -0
- package/dist/lane.js +187 -0
- package/dist/lanes.d.ts +121 -246
- package/dist/lanes.js +150 -1578
- package/dist/locus.d.ts +40 -0
- package/dist/locus.js +89 -0
- package/dist/marks.d.ts +12 -0
- package/dist/marks.js +80 -0
- package/dist/meet.d.ts +16 -0
- package/dist/meet.js +113 -0
- package/dist/mixer.d.ts +244 -196
- package/dist/mixer.js +242 -2220
- package/dist/motion.d.ts +66 -21
- package/dist/motion.js +325 -165
- package/dist/move.d.ts +9 -0
- package/dist/move.js +190 -0
- package/dist/named.d.ts +12 -0
- package/dist/named.js +39 -0
- package/dist/numbers.d.ts +18 -6
- package/dist/numbers.js +59 -31
- package/dist/owed.d.ts +24 -0
- package/dist/owed.js +51 -0
- package/dist/owner.d.ts +43 -0
- package/dist/owner.js +117 -0
- package/dist/pace.d.ts +40 -0
- package/dist/pace.js +113 -0
- package/dist/patch.d.ts +51 -10
- package/dist/patch.js +140 -45
- package/dist/place.d.ts +20 -0
- package/dist/place.js +196 -0
- package/dist/project.d.ts +4 -0
- package/dist/project.js +233 -0
- package/dist/pull.d.ts +5 -0
- package/dist/pull.js +175 -0
- package/dist/qualify.d.ts +31 -0
- package/dist/qualify.js +345 -0
- package/dist/relink.d.ts +25 -0
- package/dist/relink.js +59 -0
- package/dist/rows.d.ts +33 -0
- package/dist/rows.js +282 -0
- package/dist/sample.d.ts +21 -0
- package/dist/sample.js +232 -0
- package/dist/signals.d.ts +12 -9
- package/dist/signals.js +8 -5
- package/dist/store.d.ts +10 -3
- package/dist/store.js +44 -9
- package/dist/strays.d.ts +21 -0
- package/dist/strays.js +84 -0
- package/dist/tweened.d.ts +11 -0
- package/dist/tweened.js +48 -0
- package/dist/types.d.ts +217 -34
- package/dist/unreached.d.ts +5 -0
- package/dist/unreached.js +24 -0
- package/dist/voice.d.ts +240 -0
- package/dist/voice.js +322 -0
- package/dist/weigh.d.ts +26 -0
- package/dist/weigh.js +89 -0
- package/docs/schema.html +118 -40
- package/package.json +5 -2
package/dist/motion.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Curve } from './easing.js';
|
|
2
|
-
import type { Easing, Patch } from './types.js';
|
|
2
|
+
import type { Easing, MotionSpec, Patch } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* A number, or one number per axis.
|
|
5
5
|
*
|
|
@@ -31,10 +31,23 @@ interface Change {
|
|
|
31
31
|
to?: number[];
|
|
32
32
|
v?: number[];
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The mix playing a patch, asked with its voice's id: an owner and an id, where a pair of closures
|
|
36
|
+
* cost two functions, their contexts and a weak reference per voice.
|
|
37
|
+
*/
|
|
38
|
+
export interface MotionOwner {
|
|
39
|
+
/** The subject's voice time at the mix's latest frame; NaN where no frame of the voice met it. */
|
|
40
|
+
frame(id: number, subject: unknown): number;
|
|
41
|
+
/** Brings a subject the voice faded out back to it, so a change is not made for nothing. */
|
|
42
|
+
revive(id: number, subject: unknown): void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What a mix keeping copies of a patch's stretches is told, with its id and the subject's number,
|
|
46
|
+
* before one changes.
|
|
47
|
+
*/
|
|
48
|
+
export interface Watcher {
|
|
49
|
+
stretchChanged(id: number, s: number): void;
|
|
50
|
+
}
|
|
38
51
|
/**
|
|
39
52
|
* A patch whose motion is a closed form per subject, so it lands in the same place at any frame
|
|
40
53
|
* rate, and whose changes mid-flight start from where the subject is and how fast it moves.
|
|
@@ -57,17 +70,22 @@ export type Moving<I, O, V extends Value> = Patch<I, O, void> & {
|
|
|
57
70
|
};
|
|
58
71
|
interface Shape<I> {
|
|
59
72
|
from: (subject: I) => number[];
|
|
60
|
-
|
|
73
|
+
/** How fast each axis starts moving, given where it starts: still unless the options say. */
|
|
74
|
+
velocity: (subject: I, x: number[]) => number[];
|
|
61
75
|
/** Where it heads when released from `x` at `v`, given where it was heading. */
|
|
62
76
|
aim: (x: number[], v: number[], was: number[] | null, subject: I) => number[];
|
|
63
77
|
/** `[form, settle, k1, k2, k3]`. */
|
|
64
78
|
law: readonly number[];
|
|
65
79
|
/** Whether a subject's value is a number rather than an array. */
|
|
66
80
|
scalar: (subject: I) => boolean;
|
|
81
|
+
/** Whether every subject's value is a number; undefined where that depends on the subject. */
|
|
82
|
+
scalarEvery(): boolean | undefined;
|
|
67
83
|
/** A tween's easing, which its law cannot hold; undefined, but present, on every other shape. */
|
|
68
84
|
ease: Curve | undefined;
|
|
69
85
|
/** A tween's seconds for a stretch the subject starts now; undefined, but present, on the rest. */
|
|
70
86
|
ms: ((subject: I) => number) | undefined;
|
|
87
|
+
/** The patch's kind and constants, as `Patch.motion` reports them. */
|
|
88
|
+
spec(): MotionSpec;
|
|
71
89
|
}
|
|
72
90
|
/**
|
|
73
91
|
* A motion patch's subjects: the stretch each is playing, in one flat array by a number the patch
|
|
@@ -82,45 +100,67 @@ interface Shape<I> {
|
|
|
82
100
|
export declare class Motions<I> {
|
|
83
101
|
private readonly shape;
|
|
84
102
|
private readonly numbers;
|
|
103
|
+
/** Numbers by subject once a second is numbered: till then the one subject is found by `numbers`. */
|
|
85
104
|
private readonly slots;
|
|
86
105
|
/** Axes per subject; -1 until the first subject sets it. */
|
|
87
106
|
n: number;
|
|
88
107
|
private cap;
|
|
89
108
|
private stride;
|
|
90
|
-
|
|
109
|
+
/**
|
|
110
|
+
* The law, then each subject's run; empty until the first subject, the law read from `shape`.
|
|
111
|
+
* Read outside, at `bareAt`, and written only here.
|
|
112
|
+
*/
|
|
113
|
+
runs: Float64Array<ArrayBuffer>;
|
|
91
114
|
/**
|
|
92
115
|
* Where `sample` leaves a subject's position and velocity, per axis. Shared by every patch, so
|
|
93
116
|
* read it before the next sample.
|
|
94
117
|
*/
|
|
95
118
|
xs: Float64Array<ArrayBuffer>;
|
|
96
119
|
vs: Float64Array<ArrayBuffer>;
|
|
97
|
-
private readonly pending;
|
|
98
|
-
private readonly older;
|
|
99
120
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
121
|
+
* By subject number, changes not yet applied and earlier stretches a read back may reach: null
|
|
122
|
+
* until a subject first has one, since many patches are never changed. Each starts with room for
|
|
123
|
+
* one: an empty array written at 0 reserves 17, and most patches have one subject.
|
|
124
|
+
*/
|
|
125
|
+
private pending;
|
|
126
|
+
private older;
|
|
127
|
+
/**
|
|
128
|
+
* The mix playing the patch and its voice's id, which an untimed change and a `read` with no time
|
|
129
|
+
* ask for the latest frame. Set by the mix that cues the patch, and cleared when its voice retires.
|
|
103
130
|
*/
|
|
104
|
-
|
|
131
|
+
owner: MotionOwner | null;
|
|
132
|
+
ownerId: number;
|
|
133
|
+
/** Whether the channel it was cued on holds a number; undefined until it is cued. */
|
|
134
|
+
private holdsNumber;
|
|
135
|
+
private channel;
|
|
105
136
|
/**
|
|
106
|
-
*
|
|
107
|
-
*
|
|
137
|
+
* Records what the channel the patch is cued on holds, refusing a value of the other kind: at once
|
|
138
|
+
* where every subject's value is one kind, else on the first sample of a subject whose value is not.
|
|
108
139
|
*/
|
|
109
|
-
|
|
140
|
+
cuedOn(channel: string, holdsNumber: boolean): void;
|
|
141
|
+
private frame;
|
|
110
142
|
constructor(shape: Shape<I>);
|
|
111
143
|
/** The patch's number for `subject`, made with its first stretch on first ask. */
|
|
112
144
|
slot(subject: I): number;
|
|
145
|
+
/** The patch's number for `subject`, undefined where it has none. */
|
|
146
|
+
private known;
|
|
113
147
|
/** Forgets a subject, so a later ask starts it afresh from `from`. */
|
|
114
148
|
release(subject: I): void;
|
|
115
149
|
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
150
|
+
* Told, with `watchId`, whenever a subject's stretch or what is pending for it changes, so a mix
|
|
151
|
+
* keeping a copy of it knows to read it again. Set by the mix, cleared when its voice retires. An
|
|
152
|
+
* owner and an id, where a callback cost a closure and its context per patch.
|
|
118
153
|
*/
|
|
119
|
-
|
|
154
|
+
watcher: Watcher | null;
|
|
155
|
+
watchId: number;
|
|
120
156
|
/** The easing a tween's stretches follow; undefined for every other shape. */
|
|
121
157
|
get ease(): Curve | undefined;
|
|
158
|
+
/** The patch's kind and constants. */
|
|
159
|
+
spec(): MotionSpec;
|
|
122
160
|
/** A copy of the patch's law, `[form, settle, k1, k2, k3]`. */
|
|
123
161
|
law(): Float64Array;
|
|
162
|
+
/** Whether `law` holds this patch's law, number for number, as `Object.is` compares them. */
|
|
163
|
+
hasLaw(law: Float64Array): boolean;
|
|
124
164
|
/**
|
|
125
165
|
* Copies subject `s`'s current stretch into `out` from `o` as its release time, its seconds, then
|
|
126
166
|
* `x0`, `v0` and `to` per axis; false, copying nothing, while it has a change pending or an
|
|
@@ -137,6 +177,11 @@ export declare class Motions<I> {
|
|
|
137
177
|
* a projection's read applies the timed ones to a copy and commits nothing.
|
|
138
178
|
*/
|
|
139
179
|
sample(s: number, t: number, xo: Float64Array, vo: Float64Array): void;
|
|
180
|
+
/**
|
|
181
|
+
* Where subject `s`'s run starts in `runs` (its release time, then flags, seconds, `x0`, `v0`
|
|
182
|
+
* and `to`) while it has nothing pending and no earlier stretch kept; -1 for any other.
|
|
183
|
+
*/
|
|
184
|
+
bareAt(s: number): number;
|
|
140
185
|
/**
|
|
141
186
|
* A live `sample` at `t` for a subject with nothing pending and no earlier stretch kept, true
|
|
142
187
|
* then; false, writing nothing, for any other, which `quiet` and `sample` take instead.
|
|
@@ -169,9 +214,9 @@ export declare class Motions<I> {
|
|
|
169
214
|
private peek;
|
|
170
215
|
private check;
|
|
171
216
|
private flag;
|
|
172
|
-
|
|
217
|
+
forget(s: number): void;
|
|
173
218
|
/** Where subject `s`'s run starts in `runs`. */
|
|
174
|
-
|
|
219
|
+
base(s: number): number;
|
|
175
220
|
private grow;
|
|
176
221
|
private write;
|
|
177
222
|
/** The stretch subject `s` is playing now, as an object. */
|