@motionscript/grids 0.1.0-alpha.4 → 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 +79 -41
- package/README.md +47 -15
- package/dist/browser/chunks/chunk-J62D7EFZ.js +2 -0
- package/dist/browser/chunks/chunk-J62D7EFZ.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/engine.d.ts +4 -4
- package/dist/engine.js +4 -4
- package/dist/engine.js.map +1 -1
- package/dist/kit/index.d.ts +3 -1
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +4 -1
- package/dist/kit/index.js.map +1 -1
- package/dist/kit/item-grid.d.ts +203 -198
- package/dist/kit/item-grid.d.ts.map +1 -1
- package/dist/kit/item-grid.js +413 -440
- package/dist/kit/item-grid.js.map +1 -1
- package/dist/nodes.d.ts +8 -3
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +6 -10
- package/dist/nodes.js.map +1 -1
- package/dist/path-grid/path-grid.d.ts +108 -73
- package/dist/path-grid/path-grid.d.ts.map +1 -1
- package/dist/path-grid/path-grid.js +129 -172
- package/dist/path-grid/path-grid.js.map +1 -1
- package/dist/radial-grid/radial-grid.d.ts +97 -45
- package/dist/radial-grid/radial-grid.d.ts.map +1 -1
- package/dist/radial-grid/radial-grid.js +55 -87
- package/dist/radial-grid/radial-grid.js.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.d.ts +114 -70
- package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.js +107 -145
- package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
- package/dist/sphere-grid/sphere-grid.d.ts +109 -60
- package/dist/sphere-grid/sphere-grid.d.ts.map +1 -1
- package/dist/sphere-grid/sphere-grid.js +90 -137
- package/dist/sphere-grid/sphere-grid.js.map +1 -1
- package/package.json +4 -4
- package/src/engine.ts +4 -4
- package/src/kit/index.ts +13 -1
- package/src/kit/item-grid.ts +505 -442
- package/src/nodes.ts +18 -3
- package/src/path-grid/path-grid.ts +137 -164
- package/src/radial-grid/radial-grid.ts +69 -78
- package/src/rectangular-grid/rectangular-grid.ts +118 -133
- package/src/sphere-grid/sphere-grid.ts +103 -117
- package/dist/browser/chunks/chunk-XDUDKWM7.js +0 -2
- package/dist/browser/chunks/chunk-XDUDKWM7.js.map +0 -7
package/dist/kit/item-grid.d.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { type FocusState, type RevealState, type RevealStyle, type WaveState, type WaveStyle } from "./item-effects.js";
|
|
1
|
+
import { type ChildView, type InsetsResolved, type LayoutBox, type LayoutItem, type Measurer, type Node2D, type NodeView, type Piece, type Placement2D, type RenderContext, type Size2D, type Timeline, type Values } from "@motionscript/sdk";
|
|
2
|
+
import { type FocusState, type RevealState, type WaveState } from "./item-effects.js";
|
|
4
3
|
import { type Arrangement, type Slot } from "./slots/index.js";
|
|
5
4
|
import { type StaggerOrder } from "./stagger.js";
|
|
5
|
+
/**
|
|
6
|
+
* What every grid is built from: a container that places each of its children
|
|
7
|
+
* in a slot of an arrangement — a rectangular grid, a ring, a path, a sphere.
|
|
8
|
+
* Spread `state` and `commands` in, take `defaults`, hand `fields` the
|
|
9
|
+
* {@link Arranger} that makes this grid's arrangement from its state, and pass
|
|
10
|
+
* the finished component and its arranger through {@link define}.
|
|
11
|
+
*
|
|
12
|
+
* ## Children only
|
|
13
|
+
*
|
|
14
|
+
* The items are the children, in layer order. A child's slot is a parent
|
|
15
|
+
* transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on
|
|
16
|
+
* them — still work, relative to the slot. A group is one item; a grid of
|
|
17
|
+
* grids is a grid of items that happen to be grids.
|
|
18
|
+
*
|
|
19
|
+
* ## One pass
|
|
20
|
+
*
|
|
21
|
+
* Every frame: measure the children, ask the arrangement for its slots (a pure
|
|
22
|
+
* function of the state, the sizes and the clock), blend them from where a
|
|
23
|
+
* transition is leaving, and layer on the per-item effects — reveal, wave,
|
|
24
|
+
* focus. What is left is each child's box and slot, which the renderer,
|
|
25
|
+
* picking and `global` all read, so a selection outline lands on the pixels
|
|
26
|
+
* even on a sphere.
|
|
27
|
+
*
|
|
28
|
+
* ## Commands
|
|
29
|
+
*
|
|
30
|
+
* Every command is a pure function of time. The per-item ones stagger *inside*
|
|
31
|
+
* their duration — a one-second reveal takes one second for four children or
|
|
32
|
+
* four hundred — and write their per-item state into entries
|
|
33
|
+
* (`revealState` and its siblings), which is what keeps them seekable. The ones
|
|
34
|
+
* that change the arrangement itself (a reorder, a morph, a column count) keep
|
|
35
|
+
* the arrangement they are leaving as data and blend each item from its old
|
|
36
|
+
* slot to its new one.
|
|
37
|
+
*/
|
|
6
38
|
/** An arrangement a grid is leaving, kept as data so its slots can be worked out afresh every frame. */
|
|
7
39
|
export interface GridSnapshot {
|
|
8
40
|
arrangement: Arrangement;
|
|
@@ -17,43 +49,12 @@ export interface GridTransition {
|
|
|
17
49
|
/** Each item's eased, staggered progress, `0..1`. */
|
|
18
50
|
mix: readonly number[];
|
|
19
51
|
}
|
|
20
|
-
export interface ItemGridProps extends Node2DProps {
|
|
21
|
-
/** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */
|
|
22
|
-
order: number[];
|
|
23
|
-
/** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */
|
|
24
|
-
spread: number;
|
|
25
|
-
/** Another grid whose arrangement this one takes on — what {@link ItemGrid.morphInto} animates. */
|
|
26
|
-
arrangeLike: string;
|
|
27
|
-
revealState: RevealState | null;
|
|
28
|
-
waveState: WaveState | null;
|
|
29
|
-
focusState: FocusState | null;
|
|
30
|
-
transition: GridTransition | null;
|
|
31
|
-
}
|
|
32
|
-
/** What a command that moves the items to new slots is built from. */
|
|
33
|
-
export interface TransitionArgs {
|
|
34
|
-
data?: StaggerArgs;
|
|
35
|
-
duration: number;
|
|
36
|
-
easing?: EasingFunction;
|
|
37
|
-
}
|
|
38
52
|
/** The stagger options every per-item command takes. */
|
|
39
53
|
export interface StaggerArgs {
|
|
40
54
|
staggerOrder?: StaggerOrder;
|
|
41
55
|
/** `0..0.95`: how much of the command's length the items' offsets take up. */
|
|
42
56
|
stagger?: number;
|
|
43
57
|
}
|
|
44
|
-
/** `@command` descriptors for {@link StaggerArgs}, `stagger` defaulting to `fallback`. */
|
|
45
|
-
export declare function staggerArgs(fallback: number): readonly [{
|
|
46
|
-
readonly key: "staggerOrder";
|
|
47
|
-
readonly kind: "enum";
|
|
48
|
-
readonly options: readonly ["index", "reverse", "random", "centerOut", "edgesIn", "row", "column", "angle", "path", "depth"];
|
|
49
|
-
readonly default: "index";
|
|
50
|
-
}, {
|
|
51
|
-
readonly key: "stagger";
|
|
52
|
-
readonly min: 0;
|
|
53
|
-
readonly max: 0.95;
|
|
54
|
-
readonly step: 0.05;
|
|
55
|
-
readonly default: number;
|
|
56
|
-
}];
|
|
57
58
|
/**
|
|
58
59
|
* Every grid's document key — what a reference to "another grid" may name. A
|
|
59
60
|
* `nodeRef` descriptor carries it as `nodeTypes`, for a host's picker to offer
|
|
@@ -62,174 +63,178 @@ export declare function staggerArgs(fallback: number): readonly [{
|
|
|
62
63
|
export declare const ITEM_GRID_TYPES: readonly ["rectangularGrid", "radialGrid", "pathGrid", "sphereGrid"];
|
|
63
64
|
/** The stagger a move to new slots takes when its command states none. */
|
|
64
65
|
export declare const TRANSITION_STAGGER = 0.3;
|
|
66
|
+
/** A reference to another node, a host's picker offering only `types`. Its fields read a view of it. */
|
|
67
|
+
export declare function nodeRef(types: readonly string[]): import("@motionscript/sdk").Type<string, NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
68
|
+
/** The stagger args every per-item command takes, `stagger` defaulting to `fallback`. */
|
|
69
|
+
export declare function staggerArgs(fallback: number): {
|
|
70
|
+
staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
71
|
+
stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
72
|
+
};
|
|
65
73
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
* The items are the children, in layer order. A child's slot is a parent
|
|
72
|
-
* transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on
|
|
73
|
-
* them — still work, relative to the slot. A group is one item; a grid of
|
|
74
|
-
* grids is a grid of items that happen to be grids.
|
|
75
|
-
*
|
|
76
|
-
* ## One pass
|
|
77
|
-
*
|
|
78
|
-
* Every frame: measure the children, ask the arrangement for its slots (a pure
|
|
79
|
-
* function of the props, the sizes and the clock), blend them from where a
|
|
80
|
-
* transition is leaving, and layer on the per-item effects — reveal, wave,
|
|
81
|
-
* focus. What is left is each child's box and {@link ChildPlacement}, which the
|
|
82
|
-
* renderer, picking and `global` all read, so a selection outline lands on
|
|
83
|
-
* the pixels even on a sphere.
|
|
84
|
-
*
|
|
85
|
-
* ## Commands
|
|
86
|
-
*
|
|
87
|
-
* Every command is a pure function of time, like the rest of the library. The
|
|
88
|
-
* per-item ones stagger *inside* their duration — a one-second reveal takes one
|
|
89
|
-
* second for four children or four hundred — and write their per-item state
|
|
90
|
-
* into props ({@link revealState} and its siblings), which is what keeps them
|
|
91
|
-
* seekable. The ones that change the arrangement itself (a reorder, a morph, a
|
|
92
|
-
* column count) keep the arrangement they are leaving as data and blend each
|
|
93
|
-
* item from its old slot to its new one.
|
|
74
|
+
* A command arg a host fills in with `hint`, which a row may leave out: the
|
|
75
|
+
* command then keeps what the grid has. A run arg's default is both what a
|
|
76
|
+
* host offers and what an omitted arg means, so the hint rides on the arg's
|
|
77
|
+
* description alone, and an omitted arg reads `undefined`.
|
|
94
78
|
*/
|
|
95
|
-
export declare
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}> & {
|
|
131
|
-
duration: number;
|
|
132
|
-
}): Command<ItemGridProps>;
|
|
133
|
-
/** Bring every item back to even. */
|
|
134
|
-
unfocus(args: CommandArgs<Record<string, never>> & {
|
|
135
|
-
duration: number;
|
|
136
|
-
}): Command<ItemGridProps>;
|
|
137
|
-
/** Gather the items toward the centre (`0`), back to the arrangement (`1`), or push them apart. */
|
|
138
|
-
spreadTo(args: CommandArgs<{
|
|
139
|
-
spread: number;
|
|
140
|
-
}> & {
|
|
141
|
-
duration: number;
|
|
142
|
-
}): Command<P>;
|
|
143
|
-
/** Send every item to a random slot. The same `seed` always deals the same way. */
|
|
144
|
-
shuffle(args: CommandArgs<{
|
|
145
|
-
seed?: number;
|
|
146
|
-
} & StaggerArgs> & {
|
|
147
|
-
duration: number;
|
|
148
|
-
}): Command<P>;
|
|
149
|
-
/** Two items trade places, by their place in the layers. */
|
|
150
|
-
swap(args: CommandArgs<{
|
|
151
|
-
first?: number;
|
|
152
|
-
second?: number;
|
|
153
|
-
} & StaggerArgs> & {
|
|
154
|
-
duration: number;
|
|
155
|
-
}): Command<P>;
|
|
156
|
-
/** Move the items into a new order — a list of layer indices, first slot first, like `"2, 0, 1"`. */
|
|
157
|
-
reorder(args: CommandArgs<{
|
|
158
|
-
order?: string | number[];
|
|
159
|
-
} & StaggerArgs> & {
|
|
160
|
-
duration: number;
|
|
161
|
-
}): Command<P>;
|
|
162
|
-
/**
|
|
163
|
-
* Move every item into another grid's arrangement — a grid into a ring, a ring
|
|
164
|
-
* onto a sphere — and keep following it. An empty `target` morphs back to
|
|
165
|
-
* this grid's own.
|
|
166
|
-
*/
|
|
167
|
-
morphInto(args: CommandArgs<{
|
|
168
|
-
target?: string;
|
|
169
|
-
} & StaggerArgs> & {
|
|
170
|
-
duration: number;
|
|
171
|
-
}): Command<P>;
|
|
79
|
+
export declare function hinted<T extends number | string>(hint: T, options?: object): import("@motionscript/sdk").Type<T | undefined, T | undefined, false>;
|
|
80
|
+
/** A command arg naming another node, a host's picker offering only `types`; left out, it reads `undefined`. */
|
|
81
|
+
export declare function nodeRefArg(types: readonly string[]): import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
82
|
+
/** The state every grid shares. */
|
|
83
|
+
export declare const state: {
|
|
84
|
+
/** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */
|
|
85
|
+
order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
86
|
+
/** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */
|
|
87
|
+
spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
88
|
+
/** Another grid whose arrangement this one takes on — what `morphInto` animates. */
|
|
89
|
+
arrangeLike: import("@motionscript/sdk").Type<string, NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
90
|
+
revealState: import("@motionscript/sdk").Type<RevealState | null | undefined, RevealState | null | undefined, false>;
|
|
91
|
+
waveState: import("@motionscript/sdk").Type<WaveState | null | undefined, WaveState | null | undefined, false>;
|
|
92
|
+
focusState: import("@motionscript/sdk").Type<FocusState | null | undefined, FocusState | null | undefined, false>;
|
|
93
|
+
transition: import("@motionscript/sdk").Type<GridTransition | null | undefined, GridTransition | null | undefined, false>;
|
|
94
|
+
/** The grid a transition's leaving arrangement was borrowed from, followed while the items travel. */
|
|
95
|
+
transitionSource: import("@motionscript/sdk").Type<string, NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
96
|
+
};
|
|
97
|
+
/** A grid's size is what its items come to, whether it was built with children or they arrive after it. */
|
|
98
|
+
export declare const defaults: {
|
|
99
|
+
readonly width: "hug";
|
|
100
|
+
readonly height: "hug";
|
|
101
|
+
};
|
|
102
|
+
/** What a grid's commands read of its state, beyond its own arrangement's entries. */
|
|
103
|
+
export type GridValues = Values<typeof state> & {
|
|
104
|
+
readonly padding: InsetsResolved;
|
|
105
|
+
};
|
|
106
|
+
/** What a grid's measure, layout and render read of its state, beyond its own arrangement's entries. */
|
|
107
|
+
export type GridState = GridValues & {
|
|
108
|
+
readonly width: LayoutItem["width"];
|
|
109
|
+
readonly height: LayoutItem["height"];
|
|
110
|
+
readonly children: readonly ChildView[];
|
|
111
|
+
};
|
|
112
|
+
/** What makes one grid's arrangement from its state: the rest of a grid is this module. */
|
|
113
|
+
export interface Arranger<S = unknown> {
|
|
172
114
|
/** This grid's own arrangement, for a content box of `box`. */
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
readonly height?: unknown;
|
|
177
|
-
}): void;
|
|
178
|
-
/** The room each item is measured in — the whole content box, unless an arrangement has cells. */
|
|
179
|
-
protected itemSpace(_count: number, space: Size2D, _sizes?: readonly Size2D[]): Size2D;
|
|
180
|
-
measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D>;
|
|
181
|
-
protected layoutChildren(rect: BoxBounds, scope: MeasureContext2D): void;
|
|
182
|
-
_placementOf(child: Node2D): ChildPlacement | null;
|
|
183
|
-
/**
|
|
184
|
-
* A grid whose arrangement has depth is seen through a camera of its own,
|
|
185
|
-
* which paints its items far to near — unless it already sits in a space (an
|
|
186
|
-
* orbit camera, a 3D stage), where its items join that one and its camera.
|
|
187
|
-
*/
|
|
188
|
-
_spaceCamera(): SpaceCamera | null;
|
|
189
|
-
private readonly _placements;
|
|
190
|
-
/** What {@link measure} found, for {@link layoutChildren} to reuse in the same pass. */
|
|
191
|
-
private _measured;
|
|
192
|
-
/** Each item's slot from the last layout — what a command ranks its stagger by. */
|
|
193
|
-
private _slots;
|
|
194
|
-
/** Each item's size from the last layout. */
|
|
195
|
-
private _sizes;
|
|
196
|
-
/** The last layout's camera distance, `0` while flat. */
|
|
197
|
-
private _focal;
|
|
198
|
-
private _borrowCache;
|
|
199
|
-
/** How many items a command built now will act on. */
|
|
200
|
-
protected _itemCount(): number;
|
|
201
|
-
/** Each item's slot as it stands, for a command being built — the last layout's where it still fits. */
|
|
202
|
-
protected _itemSlots(): Slot[];
|
|
203
|
-
/** The item sizes the last layout found. */
|
|
204
|
-
protected _itemSizes(): readonly Size2D[];
|
|
205
|
-
/** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */
|
|
206
|
-
protected _ranks(order: StaggerOrder | undefined): number[];
|
|
207
|
-
/**
|
|
208
|
-
* Write `changes` to the arrangement and move each item from its slot in the
|
|
209
|
-
* one being left to its slot in the new one, staggered.
|
|
210
|
-
*/
|
|
211
|
-
protected _transitionTo(changes: Partial<P>, args: TransitionArgs, stagger?: number): Command<P>;
|
|
212
|
-
/** Emphasise the items `isFocus` picks and push the rest back. */
|
|
213
|
-
protected _focusOn(isFocus: (item: number) => boolean, count: number, args: CommandArgs<{
|
|
214
|
-
dim?: number;
|
|
215
|
-
grow?: number;
|
|
216
|
-
}> & {
|
|
217
|
-
duration: number;
|
|
218
|
-
}): Command<ItemGridProps>;
|
|
219
|
-
private _snapshot;
|
|
220
|
-
private _measureItems;
|
|
221
|
-
/** Where each item sits in the arrangement it is heading for, before any transition or effect. */
|
|
222
|
-
private _targetSlots;
|
|
223
|
-
/** Each item's final slot this frame: the target, blended from any transition, with its effects on. */
|
|
224
|
-
private _resolve;
|
|
225
|
-
/** Whether an ancestor places this grid in a space, as `spaceFrameOf` walks it. */
|
|
226
|
-
private _inSpace;
|
|
227
|
-
/** The grid {@link arrangeLike} names, when it names another grid in this tree. */
|
|
228
|
-
private _borrowed;
|
|
229
|
-
private _gridById;
|
|
230
|
-
/** `slots`, laid out in `source`'s frame, moved into this grid's. */
|
|
231
|
-
private _fromGrid;
|
|
115
|
+
arrangement(state: S, box: Size2D): Arrangement;
|
|
116
|
+
/** The room each item is measured in — the whole content box, unless the arrangement has cells. */
|
|
117
|
+
itemSpace?(state: S, count: number, space: Size2D): Size2D;
|
|
232
118
|
}
|
|
119
|
+
type GridComponent = {
|
|
120
|
+
readonly key: string;
|
|
121
|
+
readonly node: abstract new (...args: never[]) => object;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* `component` as a grid: registers its `arranger`, which another grid borrowing
|
|
125
|
+
* its arrangement or morphing into it reads it by, and which {@link isGrid} knows it by.
|
|
126
|
+
*/
|
|
127
|
+
export declare function define<C extends GridComponent, S>(component: C, arranger: Arranger<S>): C;
|
|
128
|
+
/** Whether `value` is a node of one of the grids {@link define} has seen. */
|
|
129
|
+
export declare function isGrid(value: unknown): boolean;
|
|
130
|
+
/** The grid's measure, layout and render, for `arranger`'s arrangement: spread them into the component. */
|
|
131
|
+
export declare function fields<S>(arranger: Arranger<S>): {
|
|
132
|
+
measure: (measurer: Measurer, s: GridState & S, children: readonly ChildView[]) => Size2D;
|
|
133
|
+
layout: (box: LayoutBox, s: GridState & S, children: readonly ChildView[]) => readonly Placement2D[];
|
|
134
|
+
render: (ctx: RenderContext, s: GridState & S) => void;
|
|
135
|
+
};
|
|
136
|
+
export declare function measure<S>(measurer: Measurer, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): Size2D;
|
|
137
|
+
export declare function layout<S>(box: LayoutBox, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): readonly Placement2D[];
|
|
138
|
+
/**
|
|
139
|
+
* A grid whose arrangement has depth is seen through a camera of its own,
|
|
140
|
+
* which paints its items far to near — unless it already sits in a space (an
|
|
141
|
+
* orbit camera, a 3D stage), where its items join that one and its camera.
|
|
142
|
+
*/
|
|
143
|
+
export declare function render<S>(ctx: RenderContext, s: GridState & S, arranger: Arranger<S>): void;
|
|
233
144
|
/** A node's content box: its laid-out size inside its padding. */
|
|
234
145
|
export declare function contentBoxOf(grid: Node2D): Size2D;
|
|
146
|
+
type GridTimeline = Timeline<StaggerArgs, never>;
|
|
147
|
+
/**
|
|
148
|
+
* Each item's slot in its arrangement as it stands, for a command being built,
|
|
149
|
+
* at the clock commands are built against (the tree stands at time 0 while a
|
|
150
|
+
* timeline compiles): what its stagger is ranked by.
|
|
151
|
+
*/
|
|
152
|
+
export declare function itemSlots(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Slot[];
|
|
153
|
+
/** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */
|
|
154
|
+
export declare function ranks(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[], order: StaggerOrder | undefined): number[];
|
|
155
|
+
/**
|
|
156
|
+
* Write `changes` to the arrangement and move each item from its slot in the
|
|
157
|
+
* one being left to its slot in the new one, staggered.
|
|
158
|
+
*/
|
|
159
|
+
export declare function transitionTo(timeline: GridTimeline, s: GridValues, children: readonly ChildView[], changes: Record<string, unknown>, stagger?: number): Piece;
|
|
160
|
+
/** Emphasise the items `isFocus` picks and push the rest back. */
|
|
161
|
+
export declare function focusOn(timeline: Timeline<object, never>, s: GridValues, isFocus: (item: number) => boolean, count: number, dim: number, grow: number): Piece;
|
|
162
|
+
export declare const commands: {
|
|
163
|
+
readonly reveal: {
|
|
164
|
+
readonly args: {
|
|
165
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
166
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
167
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
168
|
+
};
|
|
169
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
170
|
+
};
|
|
171
|
+
readonly conceal: {
|
|
172
|
+
readonly args: {
|
|
173
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
174
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
175
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
176
|
+
};
|
|
177
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
178
|
+
};
|
|
179
|
+
readonly wave: {
|
|
180
|
+
readonly args: {
|
|
181
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
182
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
183
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
184
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
185
|
+
};
|
|
186
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
187
|
+
};
|
|
188
|
+
readonly focus: {
|
|
189
|
+
readonly args: {
|
|
190
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
191
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
192
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
193
|
+
};
|
|
194
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
195
|
+
};
|
|
196
|
+
readonly unfocus: (timeline: any, state: any, children: any) => Piece;
|
|
197
|
+
readonly spreadTo: {
|
|
198
|
+
readonly args: {
|
|
199
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
200
|
+
};
|
|
201
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
202
|
+
};
|
|
203
|
+
readonly shuffle: {
|
|
204
|
+
readonly args: {
|
|
205
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
206
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
207
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
208
|
+
};
|
|
209
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
210
|
+
};
|
|
211
|
+
readonly swap: {
|
|
212
|
+
readonly args: {
|
|
213
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
214
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
215
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
216
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
217
|
+
};
|
|
218
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
219
|
+
};
|
|
220
|
+
readonly reorder: {
|
|
221
|
+
readonly args: {
|
|
222
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
223
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
224
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
225
|
+
};
|
|
226
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
227
|
+
};
|
|
228
|
+
readonly morphInto: {
|
|
229
|
+
readonly args: {
|
|
230
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
231
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
232
|
+
readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
233
|
+
};
|
|
234
|
+
run(timeline: any, state: any, children: any): Piece;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
/** A box of `size` inside `padding`: what a command reads as its grid's content box from `timeline.node.size`. */
|
|
238
|
+
export declare function contentBox(size: Size2D, padding: InsetsResolved): Size2D;
|
|
239
|
+
export {};
|
|
235
240
|
//# sourceMappingURL=item-grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-grid.d.ts","sourceRoot":"","sources":["../../src/kit/item-grid.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"item-grid.d.ts","sourceRoot":"","sources":["../../src/kit/item-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,MAAM,EAEX,KAAK,QAAQ,EACb,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAE1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