@motionscript/grids 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +4 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -48
- package/README.md +118 -118
- package/dist/browser/chunks/{chunk-J62D7EFZ.js → chunk-TYNFMZ3D.js} +1 -1
- package/dist/browser/chunks/chunk-TYNFMZ3D.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.js +1 -1
- package/dist/engine.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/index.js.map +1 -1
- package/dist/kit/item-effects.js.map +1 -1
- package/dist/kit/item-grid.js.map +1 -1
- package/dist/kit/order.js.map +1 -1
- package/dist/kit/random.js.map +1 -1
- package/dist/kit/slots/index.js.map +1 -1
- package/dist/kit/slots/path-templates.js.map +1 -1
- package/dist/kit/slots/path.js.map +1 -1
- package/dist/kit/slots/radial.js.map +1 -1
- package/dist/kit/slots/rectangular.js.map +1 -1
- package/dist/kit/slots/slot.js.map +1 -1
- package/dist/kit/slots/sphere.js.map +1 -1
- package/dist/kit/stagger.js.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/dist/path-grid/index.js.map +1 -1
- package/dist/path-grid/path-grid.js.map +1 -1
- package/dist/radial-grid/index.js.map +1 -1
- package/dist/radial-grid/radial-grid.js.map +1 -1
- package/dist/rectangular-grid/index.js.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
- package/dist/sphere-grid/index.js.map +1 -1
- package/dist/sphere-grid/sphere-grid.js.map +1 -1
- package/package.json +5 -4
- package/registry.json +32 -32
- package/src/engine.ts +12 -12
- package/src/index.ts +6 -6
- package/src/kit/index.ts +18 -18
- package/src/kit/item-effects.ts +114 -114
- package/src/kit/item-grid.ts +648 -648
- package/src/kit/order.ts +41 -41
- package/src/kit/random.ts +29 -29
- package/src/kit/slots/index.ts +39 -39
- package/src/kit/slots/path-templates.ts +120 -120
- package/src/kit/slots/path.ts +120 -120
- package/src/kit/slots/radial.ts +62 -62
- package/src/kit/slots/rectangular.ts +108 -108
- package/src/kit/slots/slot.ts +82 -82
- package/src/kit/slots/sphere.ts +94 -94
- package/src/kit/stagger.ts +96 -96
- package/src/nodes.ts +30 -30
- package/src/path-grid/index.ts +1 -1
- package/src/path-grid/path-grid.ts +186 -186
- package/src/radial-grid/index.ts +1 -1
- package/src/radial-grid/radial-grid.ts +81 -81
- package/src/rectangular-grid/index.ts +1 -1
- package/src/rectangular-grid/rectangular-grid.ts +145 -145
- package/src/sphere-grid/index.ts +1 -1
- package/src/sphere-grid/sphere-grid.ts +129 -129
- package/dist/browser/chunks/chunk-J62D7EFZ.js.map +0 -7
package/README.md
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
# @motionscript/grids
|
|
2
|
-
|
|
3
|
-
Grid layouts for [Motion Script](https://motionscript.dev): a node that places
|
|
4
|
-
its children in a rectangular, radial, path or spherical arrangement, with
|
|
5
|
-
staggered reveals, waves, focus, reordering and morphs between arrangements.
|
|
6
|
-
Written against [`@motionscript/sdk`](https://github.com/motionscript-dev/motionscript/tree/main/packages/sdk), a peer dependency.
|
|
7
|
-
|
|
8
|
-
```ts
|
|
9
|
-
import { NODES } from '@motionscript/grids';
|
|
10
|
-
|
|
11
|
-
export const nodes = NODES; // [RectangularGrid, RadialGrid, PathGrid, SphereGrid]
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Importing registers nothing (see [`packages/components/CLAUDE.md`](https://github.com/motionscript-dev/motionscript/blob/main/packages/components/CLAUDE.md)). Each grid
|
|
15
|
-
is a component (`component2d`); `ItemGrid`, the module the four are built from,
|
|
16
|
-
is no node type and is not in `NODES`.
|
|
17
|
-
|
|
18
|
-
## Install
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install @motionscript/grids @motionscript/sdk
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Exports
|
|
25
|
-
|
|
26
|
-
| Path | Source | What |
|
|
27
|
-
|---|---|---|
|
|
28
|
-
| `@motionscript/grids` | `src/index.ts` | the four grids, `PATH_GRID_SHAPES`, `NODES`, and `src/engine.ts` |
|
|
29
|
-
| `@motionscript/grids/kit` | `src/engine.ts` | the `ItemGrid` module and what it uses (`src/kit/`): slot functions per arrangement, stagger, reveal and wave styles, order helpers, seeded random |
|
|
30
|
-
|
|
31
|
-
## Nodes
|
|
32
|
-
|
|
33
|
-
The items are the grid's children, in layer order; a group is one item. A grid is
|
|
34
|
-
`hug` by default, except `pathGrid` (640 x 400, fixed).
|
|
35
|
-
|
|
36
|
-
| Key | Arrangement props | Own commands |
|
|
37
|
-
|---|---|---|
|
|
38
|
-
| `rectangularGrid` | `columns`, `fillDirection`, `cellMode` (`fit`/`fixed`/`fill`), `cellWidth/Height`, `columnGap`, `rowGap`, `lastLineAlign`, `rowOffset`, `columnOffset` | `columnsTo`, `gapTo`, `cellSizeTo`, `focusRow`, `focusColumn` |
|
|
39
|
-
| `radialGrid` | `radius`, `startAngle`, `sweep`, `direction`, `rotateItems`, `spinSpeed` | `spin`, `turnTo`, `radiusTo`, `sweepTo` |
|
|
40
|
-
| `pathGrid` | `shape` (a template or `custom`), `path`, `pathNode`, `spacing`, `spacingDistance`, `offset`, `flowSpeed`, `trimStart/End`, `alignToPath` | `flow`, `trimTo`, `setPath` |
|
|
41
|
-
| `sphereGrid` | `radius`, `yaw`, `pitch`, `roll`, `facing`, `focalLength`, `depthFade`, `cullBackfaces`, `spinSpeed` | `spin`, `orientTo`, `turnTo`, `radiusTo`, `focalLengthTo` |
|
|
42
|
-
|
|
43
|
-
Every grid also has `order`, `spread` and `arrangeLike`, and these commands from
|
|
44
|
-
the `ItemGrid` module: `reveal`, `conceal`, `wave`, `focus`, `unfocus`, `spreadTo`, `shuffle`,
|
|
45
|
-
`swap`, `reorder`, `morphInto`. Per-item commands take `staggerOrder` (`index`,
|
|
46
|
-
`reverse`, `random`, `centerOut`, `edgesIn`, `row`, `column`, `angle`, `path`,
|
|
47
|
-
`depth`) and `stagger` (0 to 0.95); `shuffle`, `swap`, `reorder`, `morphInto`,
|
|
48
|
-
`columnsTo` and `setPath` are *transitions*.
|
|
49
|
-
|
|
50
|
-
## Rules worth knowing
|
|
51
|
-
|
|
52
|
-
- **A slot is a parent transform.** Each item is laid out where its slot is, and the
|
|
53
|
-
rest of the slot (turn, scale, tilt, depth, fade) rides on its layout placement,
|
|
54
|
-
applied about the item's centre before its own transform, so an item's own `x`,
|
|
55
|
-
`y`, `rotation` and its commands keep working relative to the slot. A grid whose
|
|
56
|
-
arrangement has depth (the sphere) opens a camera of its own with its render's
|
|
57
|
-
`ctx.space`, unless it already sits in a space (`ctx.inSpace`).
|
|
58
|
-
- **`flowOps` sizes; it never places.** The grid's size is what its slots come to
|
|
59
|
-
(`extentOf`), seen through the camera it has that frame, so a grid of grids is a
|
|
60
|
-
grid of items.
|
|
61
|
-
- **`revealState`, `waveState`, `focusState` and `transition` are written by
|
|
62
|
-
commands, not authored.** They are rewritten every frame as a pure function of
|
|
63
|
-
time and set to `null` at the command's end, so a seek reproduces them. `reveal`
|
|
64
|
-
hides every item at its start (place it where the grid enters); `conceal` leaves
|
|
65
|
-
them hidden until a later `reveal`.
|
|
66
|
-
- **The stagger lives inside the duration**: a command lasts its row's `duration`.
|
|
67
|
-
- **An arrangement is data.** A transition keeps the arrangement it leaves as a
|
|
68
|
-
`GridSnapshot` and re-evaluates it each frame, so a morph can start from any
|
|
69
|
-
arrangement, including another grid's. `morphInto` writes `arrangeLike` (a node
|
|
70
|
-
reference: the grid reads a view of the one it names, and where it stands) and keeps
|
|
71
|
-
following that grid; a grid that cannot find `arrangeLike` or `pathNode` draws its
|
|
72
|
-
own arrangement. Another grid's arrangement is worked out from its state by the
|
|
73
|
-
`Arranger` it was defined with, so a grid is borrowable once `ItemGrid.define` has
|
|
74
|
-
seen it.
|
|
75
|
-
- **A command reads the grid as its predecessors leave it.** Ranks for a stagger, the
|
|
76
|
-
rows `focusRow` picks and the cell `cellSizeTo` starts from are worked out afresh from
|
|
77
|
-
the command's state, its children's sizes and the grid's box, against the clock the
|
|
78
|
-
timeline builds commands at (time 0).
|
|
79
|
-
- **`order[k]` is the child in slot `k`**, and `normalizeOrder` repairs any order
|
|
80
|
-
(missing, repeated or out-of-range entries), so a stale order never throws.
|
|
81
|
-
- **The kit stays an import.**
|
|
82
|
-
`path-grid`, `sphere-grid`)
|
|
83
|
-
imports to `@motionscript/grids/kit` (`registry.json`): a second copy of
|
|
84
|
-
`ItemGrid` would keep a second register of grids, and a morph would not find the
|
|
85
|
-
grids it should.
|
|
86
|
-
|
|
87
|
-
## A grid of your own
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
import { component2d, Types, type Values } from '@motionscript/sdk';
|
|
91
|
-
import { ItemGrid, type Arrangement } from '@motionscript/grids/kit';
|
|
92
|
-
|
|
93
|
-
const own = { radius: Types.number(120) };
|
|
94
|
-
const arranger: ItemGrid.Arranger<Values<typeof own>> = {
|
|
95
|
-
arrangement: (s): Arrangement => ({ kind: 'radial', radius: s.radius, startAngle: 0, sweep: 180, direction: 'clockwise', rotateItems: false, spinSpeed: 0 }),
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const ArcGrid = ItemGrid.define(component2d({
|
|
99
|
-
key: 'arcGrid',
|
|
100
|
-
state: { ...ItemGrid.state, ...own },
|
|
101
|
-
defaults: ItemGrid.defaults,
|
|
102
|
-
commands: { ...ItemGrid.commands },
|
|
103
|
-
...ItemGrid.fields(arranger),
|
|
104
|
-
}), arranger);
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
`define` registers the arranger, which is what another grid and a host know it by:
|
|
108
|
-
`ItemGrid.isGrid(node)` tells a grid from any other node.
|
|
109
|
-
|
|
110
|
-
## Development
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
pnpm --filter @motionscript/grids build
|
|
114
|
-
pnpm --filter @motionscript/grids test
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Tests are in `src/tests/` (`grid.test.ts`, `slots.test.ts`, `descriptors.test.ts`);
|
|
118
|
-
`harness.ts` builds, seeks and renders a document.
|
|
1
|
+
# @motionscript/grids
|
|
2
|
+
|
|
3
|
+
Grid layouts for [Motion Script](https://motionscript.dev): a node that places
|
|
4
|
+
its children in a rectangular, radial, path or spherical arrangement, with
|
|
5
|
+
staggered reveals, waves, focus, reordering and morphs between arrangements.
|
|
6
|
+
Written against [`@motionscript/sdk`](https://github.com/motionscript-dev/motionscript/tree/main/packages/sdk), a peer dependency.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { NODES } from '@motionscript/grids';
|
|
10
|
+
|
|
11
|
+
export const nodes = NODES; // [RectangularGrid, RadialGrid, PathGrid, SphereGrid]
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Importing registers nothing (see [`packages/components/CLAUDE.md`](https://github.com/motionscript-dev/motionscript/blob/main/packages/components/CLAUDE.md)). Each grid
|
|
15
|
+
is a component (`component2d`); `ItemGrid`, the module the four are built from,
|
|
16
|
+
is no node type and is not in `NODES`.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @motionscript/grids @motionscript/sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Exports
|
|
25
|
+
|
|
26
|
+
| Path | Source | What |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `@motionscript/grids` | `src/index.ts` | the four grids, `PATH_GRID_SHAPES`, `NODES`, and `src/engine.ts` |
|
|
29
|
+
| `@motionscript/grids/kit` | `src/engine.ts` | the `ItemGrid` module and what it uses (`src/kit/`): slot functions per arrangement, stagger, reveal and wave styles, order helpers, seeded random |
|
|
30
|
+
|
|
31
|
+
## Nodes
|
|
32
|
+
|
|
33
|
+
The items are the grid's children, in layer order; a group is one item. A grid is
|
|
34
|
+
`hug` by default, except `pathGrid` (640 x 400, fixed).
|
|
35
|
+
|
|
36
|
+
| Key | Arrangement props | Own commands |
|
|
37
|
+
|---|---|---|
|
|
38
|
+
| `rectangularGrid` | `columns`, `fillDirection`, `cellMode` (`fit`/`fixed`/`fill`), `cellWidth/Height`, `columnGap`, `rowGap`, `lastLineAlign`, `rowOffset`, `columnOffset` | `columnsTo`, `gapTo`, `cellSizeTo`, `focusRow`, `focusColumn` |
|
|
39
|
+
| `radialGrid` | `radius`, `startAngle`, `sweep`, `direction`, `rotateItems`, `spinSpeed` | `spin`, `turnTo`, `radiusTo`, `sweepTo` |
|
|
40
|
+
| `pathGrid` | `shape` (a template or `custom`), `path`, `pathNode`, `spacing`, `spacingDistance`, `offset`, `flowSpeed`, `trimStart/End`, `alignToPath` | `flow`, `trimTo`, `setPath` |
|
|
41
|
+
| `sphereGrid` | `radius`, `yaw`, `pitch`, `roll`, `facing`, `focalLength`, `depthFade`, `cullBackfaces`, `spinSpeed` | `spin`, `orientTo`, `turnTo`, `radiusTo`, `focalLengthTo` |
|
|
42
|
+
|
|
43
|
+
Every grid also has `order`, `spread` and `arrangeLike`, and these commands from
|
|
44
|
+
the `ItemGrid` module: `reveal`, `conceal`, `wave`, `focus`, `unfocus`, `spreadTo`, `shuffle`,
|
|
45
|
+
`swap`, `reorder`, `morphInto`. Per-item commands take `staggerOrder` (`index`,
|
|
46
|
+
`reverse`, `random`, `centerOut`, `edgesIn`, `row`, `column`, `angle`, `path`,
|
|
47
|
+
`depth`) and `stagger` (0 to 0.95); `shuffle`, `swap`, `reorder`, `morphInto`,
|
|
48
|
+
`columnsTo` and `setPath` are *transitions*.
|
|
49
|
+
|
|
50
|
+
## Rules worth knowing
|
|
51
|
+
|
|
52
|
+
- **A slot is a parent transform.** Each item is laid out where its slot is, and the
|
|
53
|
+
rest of the slot (turn, scale, tilt, depth, fade) rides on its layout placement,
|
|
54
|
+
applied about the item's centre before its own transform, so an item's own `x`,
|
|
55
|
+
`y`, `rotation` and its commands keep working relative to the slot. A grid whose
|
|
56
|
+
arrangement has depth (the sphere) opens a camera of its own with its render's
|
|
57
|
+
`ctx.space`, unless it already sits in a space (`ctx.inSpace`).
|
|
58
|
+
- **`flowOps` sizes; it never places.** The grid's size is what its slots come to
|
|
59
|
+
(`extentOf`), seen through the camera it has that frame, so a grid of grids is a
|
|
60
|
+
grid of items.
|
|
61
|
+
- **`revealState`, `waveState`, `focusState` and `transition` are written by
|
|
62
|
+
commands, not authored.** They are rewritten every frame as a pure function of
|
|
63
|
+
time and set to `null` at the command's end, so a seek reproduces them. `reveal`
|
|
64
|
+
hides every item at its start (place it where the grid enters); `conceal` leaves
|
|
65
|
+
them hidden until a later `reveal`.
|
|
66
|
+
- **The stagger lives inside the duration**: a command lasts its row's `duration`.
|
|
67
|
+
- **An arrangement is data.** A transition keeps the arrangement it leaves as a
|
|
68
|
+
`GridSnapshot` and re-evaluates it each frame, so a morph can start from any
|
|
69
|
+
arrangement, including another grid's. `morphInto` writes `arrangeLike` (a node
|
|
70
|
+
reference: the grid reads a view of the one it names, and where it stands) and keeps
|
|
71
|
+
following that grid; a grid that cannot find `arrangeLike` or `pathNode` draws its
|
|
72
|
+
own arrangement. Another grid's arrangement is worked out from its state by the
|
|
73
|
+
`Arranger` it was defined with, so a grid is borrowable once `ItemGrid.define` has
|
|
74
|
+
seen it.
|
|
75
|
+
- **A command reads the grid as its predecessors leave it.** Ranks for a stagger, the
|
|
76
|
+
rows `focusRow` picks and the cell `cellSizeTo` starts from are worked out afresh from
|
|
77
|
+
the command's state, its children's sizes and the grid's box, against the clock the
|
|
78
|
+
timeline builds commands at (time 0).
|
|
79
|
+
- **`order[k]` is the child in slot `k`**, and `normalizeOrder` repairs any order
|
|
80
|
+
(missing, repeated or out-of-range entries), so a stale order never throws.
|
|
81
|
+
- **The kit stays an import.** A copy of `rectangular-grid` (or `radial-grid`,
|
|
82
|
+
`path-grid`, `sphere-grid`) takes one grid's two files and rewrites their kit
|
|
83
|
+
imports to `@motionscript/grids/kit` (`registry.json`): a second copy of
|
|
84
|
+
`ItemGrid` would keep a second register of grids, and a morph would not find the
|
|
85
|
+
grids it should.
|
|
86
|
+
|
|
87
|
+
## A grid of your own
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { component2d, Types, type Values } from '@motionscript/sdk';
|
|
91
|
+
import { ItemGrid, type Arrangement } from '@motionscript/grids/kit';
|
|
92
|
+
|
|
93
|
+
const own = { radius: Types.number(120) };
|
|
94
|
+
const arranger: ItemGrid.Arranger<Values<typeof own>> = {
|
|
95
|
+
arrangement: (s): Arrangement => ({ kind: 'radial', radius: s.radius, startAngle: 0, sweep: 180, direction: 'clockwise', rotateItems: false, spinSpeed: 0 }),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const ArcGrid = ItemGrid.define(component2d({
|
|
99
|
+
key: 'arcGrid',
|
|
100
|
+
state: { ...ItemGrid.state, ...own },
|
|
101
|
+
defaults: ItemGrid.defaults,
|
|
102
|
+
commands: { ...ItemGrid.commands },
|
|
103
|
+
...ItemGrid.fields(arranger),
|
|
104
|
+
}), arranger);
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
`define` registers the arranger, which is what another grid and a host know it by:
|
|
108
|
+
`ItemGrid.isGrid(node)` tells a grid from any other node.
|
|
109
|
+
|
|
110
|
+
## Development
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pnpm --filter @motionscript/grids build
|
|
114
|
+
pnpm --filter @motionscript/grids test
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Tests are in `src/tests/` (`grid.test.ts`, `slots.test.ts`, `descriptors.test.ts`);
|
|
118
|
+
`harness.ts` builds, seeks and renders a document.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var Dt=Object.defineProperty;var Yt=(t,e)=>{for(var n in e)Dt(t,n,{get:e[n],enumerable:!0})};import{pathOps as st}from"@motionscript/sdk";function y(t,e,n){return{x:t,y:e,depth:0,rotation:0,rotationX:0,rotationY:0,scale:1,opacity:1,meta:n}}function rt(t,e,n){if(n<=0)return t;if(n>=1)return e;let o=(r,a)=>r+(a-r)*n;return{x:o(t.x,e.x),y:o(t.y,e.y),depth:o(t.depth,e.depth),rotation:o(t.rotation,e.rotation),rotationX:o(t.rotationX,e.rotationX),rotationY:o(t.rotationY,e.rotationY),scale:o(t.scale,e.scale),opacity:o(t.opacity,e.opacity),meta:n<.5?t.meta:e.meta}}function Z(t,e){return e===1?t:{...t,x:t.x*e,y:t.y*e,depth:t.depth*e}}function at(t){let e=0,n=0;for(let o of t)o.width>e&&(e=o.width),o.height>n&&(n=o.height);return{width:e,height:n}}var be=["distribute","fixed"],P=new Map,Bt=32;function Xt(t){let e=P.get(t);if(e)return e;let n=st.contours(t),o={sampler:st.sampler(t),closed:n.length===1&&n[0].closed};return P.size>=Bt&&P.delete(P.keys().next().value),P.set(t,o),o}function ct(t,e){let{count:n}=e;if(n===0)return[];let{sampler:o,closed:r}=Xt(t.path),a=o.length,s=_(Math.min(t.trimStart,t.trimEnd)),c=_(Math.max(t.trimStart,t.trimEnd)),i=s*a,u=(c-s)*a,h=r&&s===0&&c===1,f=t.offset+t.flowSpeed*e.time,l=t.placement,m=l.rotation*Math.PI/180,k=Math.cos(m),A=Math.sin(m),g=[];for(let x=0;x<n;x++){let d;t.spacing==="fixed"&&u>0?d=f+x*t.spacingDistance/u:h?d=f+x/n:d=f+(n===1?.5:x/(n-1));let E=!0;h?d=d-Math.floor(d):(d<-1e-9||d>1+1e-9)&&(E=!1);let M=o.frameAt(i+_(d)*u);if(!M){let X=y(0,0,{kind:"path",t:_(d)});X.opacity=0,g.push(X);continue}let T=l.flipY?-1:1,R=(M.x-l.originX)*l.scale,G=(M.y-l.originY)*l.scale*T,O=y(l.x+R*k+G*A,l.y-R*A+G*k,{kind:"path",t:_(d)});t.alignToPath&&(O.rotation=-Math.atan2(M.ty*T,M.tx)*180/Math.PI+l.rotation),E||(O.opacity=0),g.push(O)}return g}function _(t){return t<0?0:t>1?1:t}var Re=["clockwise","counterclockwise"];function it(t,e,n){let o=t.sweep,r=Math.min(1,Math.abs(o)/360)**8,a=e<=1?0:o/(e-1+r),s=t.direction==="counterclockwise"?-1:1,c=t.startAngle+t.spinSpeed*n,i=[];for(let u=0;u<e;u++)i.push(c+s*u*a);return i}function ut(t,e){let n=it(t,e.count,e.time),o=n[0]??0;return n.map(r=>{let a=r*Math.PI/180,s=y(t.radius*Math.sin(a),t.radius*Math.cos(a),{kind:"radial",angle:Math.abs(r-o)});return t.rotateItems&&(s.rotation=r),s})}function Ge(t,e,n){let o=it({...t,spinSpeed:0},e,0)[n]??t.startAngle;return-Ft(o)}function Ft(t){let e=(t%360+360)%360;return e>180?e-360:e}var ve=["row","column"],Ce=["fit","fixed","fill"],Ne=["start","center","end"];function ft(t,e){let n=Math.max(1,Math.round(t.columns)),o=Math.max(1,Math.ceil(e/n));return t.fillDirection==="column"?{rows:o,columns:Math.max(1,Math.ceil(e/o))}:{rows:o,columns:n}}function Ht(t,e,n,o){let{rows:r,columns:a}=ft(t,e);switch(t.cellMode){case"fixed":return{width:Math.max(0,t.cellWidth),height:Math.max(0,t.cellHeight)};case"fill":return{width:Math.max(0,(o.width-t.columnGap*(a-1))/a),height:Math.max(0,(o.height-t.rowGap*(r-1))/r)};default:return at(n)}}function lt(t,e){let{count:n}=e;if(n===0)return[];let{rows:o,columns:r}=ft(t,n),a=t.fillDirection==="column",s=a?r:o,c=a?o:r,i=Ht(t,n,e.sizes,e.box),u=i.width+t.columnGap,h=i.height+t.rowGap,f=s-1,l=n-f*c,m=c-l,k=t.lastLineAlign==="center"?m/2:t.lastLineAlign==="end"?m:0,A=t.rowOffset*u,g=t.columnOffset*h,x=[];for(let d=0;d<n;d++){let E=Math.floor(d/c),M=d%c;E===f&&(M+=k);let T=a?M:E,R=a?E:M,G=Math.round(T),O=Math.round(R),X=(R-(r-1)/2)*u+(G%2===1?A:0)-(o>1?A/2:0),zt=((o-1)/2-T)*h-(O%2===1?g:0)+(r>1?g/2:0);x.push(y(X,zt,{kind:"rectangular",row:G,column:O}))}return x}var Ye=["outward","billboard"],Be=["x","y","z"],Wt=Math.PI*(3-Math.sqrt(5)),w=180/Math.PI;function ht(t,e){if(e<=1)return[0,0,1];let n=1-2*(t+.5)/e,o=Math.sqrt(Math.max(0,1-n*n)),r=t*Wt;return[Math.cos(r)*o,n,Math.sin(r)*o]}function qt(t,e,n,o){let[r,a,s]=t,c=e/w,i=n/w,u=o/w,h=r*Math.cos(c)+s*Math.sin(c),f=-r*Math.sin(c)+s*Math.cos(c),l=a*Math.cos(i)-f*Math.sin(i),m=a*Math.sin(i)+f*Math.cos(i);return[h*Math.cos(u)+l*Math.sin(u),-h*Math.sin(u)+l*Math.cos(u),m]}function pt(t,e){let{count:n}=e,o=t.radius,r=t.yaw+t.spinSpeed*e.time,a=t.facing==="outward",s=[];for(let c=0;c<n;c++){let i=ht(c,n),[u,h,f]=qt(i,r,t.pitch,t.roll),l=y(u*o,h*o,{kind:"sphere",lat:Math.asin(Math.max(-1,Math.min(1,i[1])))*w,lon:Math.atan2(i[2],i[0])*w,depth:f});l.depth=f*o,a&&(l.rotationY=Math.asin(Math.max(-1,Math.min(1,u)))*w,l.rotationX=Math.atan2(h,f)*w),l.opacity=1-t.depthFade*(1-(f+1)/2),a&&t.cullBackfaces&&Vt(l,[u,h,f],t.focalLength)&&(l.opacity=0),s.push(l)}return s}function Vt(t,e,n){return n<=0?e[2]<0:e[0]*-t.x+e[1]*-t.y+e[2]*(n-t.depth)<0}function Xe(t,e){let[n,o,r]=ht(e,t);return{yaw:-Math.atan2(n,r)*w,pitch:Math.atan2(o,Math.hypot(n,r))*w}}var He=["circle","square","star","heart","infinity","wave","spiral","arc","line"];var v=new Map,$t=64;function We(t,e){let n=`${t}:${Math.round(e.width*100)}:${Math.round(e.height*100)}`,o=v.get(n);if(o)return o;let r=Kt(t,e);return v.size>=$t&&v.delete(v.keys().next().value),v.set(n,r),r}function Kt(t,e){let n=e.width>0?e.width:400,o=e.height>0?e.height:400,r=n/2,a=o/2;switch(t){case"square":return F([[-r,a],[r,a],[r,-a],[-r,-a]]);case"star":{let s=[];for(let c=0;c<10;c++){let i=c*Math.PI/5,u=c%2===0?1:.45;s.push([Math.sin(i)*r*u,Math.cos(i)*a*u])}return F(s)}case"heart":return F(C(96,s=>{let c=s*2*Math.PI,i=16*Math.sin(c)**3,u=13*Math.cos(c)-5*Math.cos(2*c)-2*Math.cos(3*c)-Math.cos(4*c);return[i/17*r,(u+2.5)/15.5*a]}).slice(0,-1));case"infinity":return F(C(96,s=>{let c=s*2*Math.PI,i=1+Math.sin(c)**2;return[Math.cos(c)/i*r,Math.sin(c)*Math.cos(c)/i*a*2]}).slice(0,-1));case"wave":return H(C(96,s=>[(-1+2*s)*r,Math.sin(s*4*Math.PI)*a*.6]));case"spiral":return H(C(160,s=>{let c=s*3*2*Math.PI,i=.08+.92*s;return[Math.sin(c)*r*i,Math.cos(c)*a*i]}));case"arc":return H(C(64,s=>{let c=-Math.PI/2+s*Math.PI;return[Math.sin(c)*r,-a+Math.cos(c)*o]}));case"line":return[{type:"M",x:-r,y:0},{type:"L",x:r,y:0}];default:return Zt(r,a)}}function Zt(t,e){let n=.5522847498;return[{type:"M",x:0,y:e},{type:"C",x1:n*t,y1:e,x2:t,y2:n*e,x:t,y:0},{type:"C",x1:t,y1:-n*e,x2:n*t,y2:-e,x:0,y:-e},{type:"C",x1:-n*t,y1:-e,x2:-t,y2:-n*e,x:-t,y:0},{type:"C",x1:-t,y1:n*e,x2:-n*t,y2:e,x:0,y:e},{type:"Z"}]}function C(t,e){let n=[];for(let o=0;o<=t;o++)n.push(e(o/t));return n}function H(t){return t.map(([e,n],o)=>o===0?{type:"M",x:e,y:n}:{type:"L",x:e,y:n})}function F(t){return[...H(t),{type:"Z"}]}function j(t,e){switch(t.kind){case"rectangular":return lt(t,e);case"radial":return ut(t,e);case"path":return ct(t,e);case"sphere":return pt(t,e)}}function J(t){return t.kind==="sphere"?Math.max(1,t.focalLength):0}function jt(t){let e=Math.floor(t)>>>0;return()=>{e=e+1831565813>>>0;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function W(t,e){let n=[...t],o=jt(e);for(let r=n.length-1;r>0;r--){let a=Math.floor(o()*(r+1));[n[r],n[a]]=[n[a],n[r]]}return n}function dt(t){let e=2166136261;for(let n=0;n<t.length;n++)e=Math.imul(e^t.charCodeAt(n),16777619);return e>>>0}var mt=["index","reverse","random","centerOut","edgesIn","row","column","angle","path","depth"],Jt=.95;function gt(t,e,n){let o=e.length,r=Qt(t,e,n),a=1/0,s=-1/0;for(let i of r)i<a&&(a=i),i>s&&(s=i);let c=s-a;return c>1e-9?r.map(i=>(i-a)/c):new Array(o).fill(0)}function N(t,e,n){let o=Math.max(0,Math.min(Jt,n)),r=o===0?e:(e-t*o)/(1-o);return r<0?0:r>1?1:r}function Qt(t,e,n){switch(t){case"reverse":return e.map((o,r)=>-r);case"random":{let o=W(e.map((a,s)=>s),n),r=new Array(e.length);return o.forEach((a,s)=>{r[a]=s}),r}case"centerOut":return e.map(o=>Math.round(Math.hypot(o.x,o.y,o.depth)*1e3)/1e3);case"edgesIn":return e.map(o=>-Math.round(Math.hypot(o.x,o.y,o.depth)*1e3)/1e3);case"row":return e.map(o=>o.meta.kind==="rectangular"?o.meta.row:-Math.round(o.y));case"column":return e.map(o=>o.meta.kind==="rectangular"?o.meta.column:Math.round(o.x));case"angle":return e.map((o,r)=>o.meta.kind==="radial"?o.meta.angle:o.meta.kind==="rectangular"||o.meta.kind==="sphere"?Ut(o):r);case"path":return e.map((o,r)=>o.meta.kind==="path"?o.meta.t:r);case"depth":return e.map((o,r)=>o.meta.kind==="sphere"?-o.meta.depth:r);default:return e.map((o,r)=>r)}}function Ut(t){let e=Math.atan2(t.x,t.y)*180/Math.PI;return e<0?e+360:e}var Q=["scale","fade","center","rise","flip","spin"],xt=["scale","lift","fade","spin"];function Mt(t,e,n,o,r,a){o&&te(t,o.style,o.values[e]??1,n),r&&ee(t,r,r.values[e]??0,n),a&&ne(t,a,a.values[e]??0)}function te(t,e,n,o){if(n===1)return;let r=q(n);switch(e){case"fade":t.opacity*=r;break;case"center":t.x*=n,t.y*=n,t.depth*=n,t.opacity*=q(n*4);break;case"rise":t.y-=(1-n)*Math.max(40,o.height),t.opacity*=r;break;case"flip":t.rotationX+=(1-n)*90;break;case"spin":t.rotation-=(1-n)*180,t.scale*=Math.max(0,n);break;default:t.scale*=Math.max(0,n)}}function ee(t,e,n,o){if(n!==0)switch(e.style){case"lift":t.y+=e.amount*n*Math.max(40,o.height);break;case"fade":t.opacity*=q(1-e.amount*n);break;case"spin":t.rotation+=e.amount*n*360;break;default:t.scale*=1+e.amount*n}}function ne(t,e,n){if(n!==0){if(n>0){t.scale*=1+e.grow*n;return}t.opacity*=q(1-e.dim*-n),t.scale*=Math.max(0,1+e.grow*.5*n)}}function q(t){return t<0?0:t>1?1:t}function I(t,e){let n=[],o=new Array(e).fill(!1);for(let r of t??[]){let a=Math.round(r);a>=0&&a<e&&!o[a]&&(o[a]=!0,n.push(a))}for(let r=0;r<e;r++)o[r]||n.push(r);return n}function U(t){let e=new Array(t.length);return t.forEach((n,o)=>{e[n]=o}),e}function yt(t){return Array.isArray(t)?t.map(Number).filter(Number.isFinite):typeof t!="string"?[]:t.split(/[\s,]+/).filter(e=>e!=="").map(Number).filter(Number.isFinite)}var Nt={};Yt(Nt,{ITEM_GRID_TYPES:()=>$,TRANSITION_STAGGER:()=>b,commands:()=>pe,contentBox:()=>L,contentBoxOf:()=>Lt,defaults:()=>se,define:()=>ce,fields:()=>ue,focusOn:()=>Rt,hinted:()=>ae,isGrid:()=>ie,itemSlots:()=>Tt,layout:()=>Ot,measure:()=>Et,nodeRef:()=>kt,nodeRefArg:()=>At,ranks:()=>Y,render:()=>bt,staggerArgs:()=>S,state:()=>It,transitionTo:()=>z});import{commandsFor as oe,easeIn as re,easeInOut as D,easeOut as wt,flowOps as tt,insetsOps as St,Types as p}from"@motionscript/sdk";var $=["rectangularGrid","radialGrid","pathGrid","sphereGrid"],b=.3;function kt(t){let e={kind:"nodeRef",nodeTypes:t,animatable:!1};return p.custom("",e)}function S(t){return{staggerOrder:p.oneOf(mt,{default:"index"}),stagger:p.number(t,{min:0,max:.95,step:.05})}}function ae(t,e={}){let n={...e,default:t};return p.custom(void 0,n)}function At(t){let e={kind:"nodeRef",nodeTypes:t};return p.custom(void 0,e)}var It={order:p.custom([],{kind:"order",animatable:!1}),spread:p.number(1,{min:0,max:3,step:.05}),arrangeLike:kt($),revealState:p.custom(void 0,{kind:"state",animatable:!1}),waveState:p.custom(void 0,{kind:"state",animatable:!1}),focusState:p.custom(void 0,{kind:"state",animatable:!1}),transition:p.custom(void 0,{kind:"state",animatable:!1}),transitionSource:p.custom("",{kind:"nodeRef",private:!0})},se={width:"hug",height:"hug"},B=new Map;function ce(t,e){return B.set(t.key,{component:t,arranger:e}),t}function ie(t){for(let{component:e}of B.values())if(t instanceof e.node)return!0;return!1}function ue(t){return{measure:(e,n,o)=>Et(e,n,o,t),layout:(e,n,o)=>Ot(e,n,o,t),render:(e,n)=>bt(e,n,t)}}var fe={width:0,height:0},le={x:0,y:0},V=new WeakMap;function Et(t,e,n,o){let r={maxWidth:t.max.width,maxHeight:t.max.height},a=e.padding;if(n.length===0)return V.delete(e),tt.size(e,r,a,fe);let s=tt.contentBox(e,r,a),c=_t(n,s,e,o);V.set(e,{space:s,sizes:c});let i={state:e,arranger:o,children:n,isSelf:Gt(n)},u=ot(i,c.length,c,s,t.time.total);return tt.size(e,r,a,we(u.slots,c,vt(e,u.arrangement)))}function Ot(t,e,n,o){let r=V.get(e);if(V.delete(e),n.length===0)return[];let a=St.insetBounds(t.width,t.height,e.padding),s=r&&r.sizes.length===n.length&&ke(r.space,a)?r.sizes:_t(n,a,e,o);return xe({state:e,arranger:o,children:n,isSelf:Gt(n)},s,a,t.time.total).map((i,u)=>ye(a,i,s[u]))}function bt(t,e,n){let o=e.children.length===0?0:vt(e,ge({state:e,arranger:n,children:[],isSelf:()=>!1},L(t.size,e.padding)));o>0&&!t.inSpace?t.space(Me(o)):t.children()}function Lt(t){let e=t.layoutBounds;return L({width:e.width,height:e.height},t.effectivePadding())}function Tt(t,e,n){let o=Pt(t,e,n),r=n.map(a=>a.size);return ot(o,n.length,r,L(t.node.size,e.padding),0).slots}function Y(t,e,n,o){return gt(o??"index",Tt(t,e,n),dt(t.node.id))}function z(t,e,n,o,r=b){let a=me(t,e,n),s=t.easing??D("cubic"),c=Y(t,e,n,t.args.staggerOrder),i=t.args.stagger??r;return t.animate(u=>{if(u>=1)return{...o,transition:null,transitionSource:""};let h=c.map(f=>s(N(f,u,i)));return{...o,transition:{from:a,mix:h},transitionSource:a.source}},{eased:!1})}function Rt(t,e,n,o,r,a){let s=e.focusState,c=Array.from({length:o},(u,h)=>n(h)?1:-1),i=t.easing??D("cubic");return t.animate(u=>{let h=i(u);return{focusState:{dim:et(s?.dim??r,r,h),grow:et(s?.grow??a,a,h),values:c.map((f,l)=>et(s?.values[l]??0,f,h))}}},{eased:!1})}var he={...It,padding:p.insets},pe=oe(he,{reveal:{args:{style:p.oneOf(Q,{default:"scale"}),...S(.5)},run:(t,e,n)=>{let o=t.args.style??"scale",r=t.easing??(o==="scale"||o==="flip"?wt("back"):wt("cubic")),a=Y(t,e,n,t.args.staggerOrder),s=t.args.stagger??.5;return t.animate(c=>c>=1?{revealState:null}:{revealState:{style:o,values:a.map(i=>r(N(i,c,s)))}},{eased:!1})}},conceal:{args:{style:p.oneOf(Q,{default:"scale"}),...S(.5)},run:(t,e,n)=>{let o=t.args.style??"scale",r=t.easing??(o==="scale"||o==="flip"?re("back"):D("cubic")),a=Y(t,e,n,t.args.staggerOrder),s=t.args.stagger??.5,c=e.revealState?.values;return t.animate(i=>({revealState:{style:o,values:a.map((u,h)=>(c?.[h]??1)*(1-r(N(u,i,s))))}}),{eased:!1})}},wave:{args:{style:p.oneOf(xt,{default:"scale"}),amount:p.number(.3,{min:0,max:2,step:.05}),...S(.7)},run:(t,e,n)=>{let o=t.args.style??"scale",r=t.args.amount??.3,a=t.easing??D("sine"),s=Y(t,e,n,t.args.staggerOrder),c=t.args.stagger??.7;return t.animate(i=>i>=1?{waveState:null}:{waveState:{style:o,amount:r,values:s.map(u=>Math.sin(Math.PI*a(N(u,i,c))))}},{eased:!1})}},focus:{args:{item:p.number(0,{min:0,step:1}),dim:p.number(.7,{min:0,max:1,step:.05}),grow:p.number(.15,{min:0,max:1,step:.05})},run:(t,e,n)=>{let o=Math.round(t.args.item??0);return Rt(t,e,r=>r===o,n.length,t.args.dim??.7,t.args.grow??.15)}},unfocus:(t,e)=>{let n=e.focusState,o=t.easing??D("cubic");return t.animate(r=>{if(r>=1||!n)return{focusState:null};let a=1-o(r);return{focusState:{...n,values:n.values.map(s=>s*a)}}},{eased:!1})},spreadTo:{args:{spread:p.number(1,{min:0,max:3,step:.05})},run:t=>t.tween({spread:t.args.spread??1})},shuffle:{args:{seed:p.number(1,{min:0,step:1}),...S(b)},run:(t,e,n)=>{let o=I(e.order,n.length),r=W(o,t.args.seed??1);return r.length>1&&r.every((a,s)=>a===o[s])&&(r=[...r.slice(1),r[0]]),z(t,e,n,{order:r})}},swap:{args:{first:p.number(0,{min:0,step:1}),second:p.number(1,{min:0,step:1}),...S(0)},run:(t,e,n)=>{let o=I(e.order,n.length),r=o.indexOf(Math.round(t.args.first??0)),a=o.indexOf(Math.round(t.args.second??1));return r>=0&&a>=0&&([o[r],o[a]]=[o[a],o[r]]),z(t,e,n,{order:o},0)}},reorder:{args:{order:p.text(""),...S(b)},run:(t,e,n)=>{let o=I(yt(t.args.order),n.length);return z(t,e,n,{order:o})}},morphInto:{args:{target:At($),...S(b)},run:(t,e,n)=>z(t,e,n,{arrangeLike:t.args.target??""})}});function de(t){let e=B.get(t);if(!e)throw new Error(`"${t}" is no grid: pass its component through ItemGrid.define.`);return e.arranger}function nt(t,e){if(!t)return null;let n=B.get(t.key);return!n||e.isSelf(t)?null:{view:t,arranger:n.arranger}}function Gt(t){return e=>t.length===0?!1:e.state.children?.[0]===t[0]}function Pt(t,e,n){return{state:e,arranger:de(t.node.key),children:n,isSelf:o=>o.id===t.node.id}}function me(t,e,n){let o=Pt(t,e,n),r=nt(e.arrangeLike,o);return{arrangement:r?r.arranger.arrangement(r.view.state,K(r.view)):o.arranger.arrangement(e,L(t.node.size,e.padding)),source:r?.view.id??"",order:I(e.order,n.length),spread:e.spread}}function _t(t,e,n,o){let r=t.map(s=>s.measure(e)),a=o.itemSpace?o.itemSpace(n,t.length,e):e;return a===e?r:t.map(s=>s.measure(a))}function ge(t,e){let n=nt(t.state.arrangeLike,t);return n?n.arranger.arrangement(n.view.state,K(n.view)):t.arranger.arrangement(t.state,e)}function ot(t,e,n,o,r){let a=t.state,s=nt(a.arrangeLike,t),c=s?K(s.view):o,i=s?s.arranger.arrangement(s.view.state,c):t.arranger.arrangement(a,o),u=j(i,{count:e,sizes:n,box:c,time:r});return s&&(u=Ct(s.view.frame,u)),{slots:U(I(a.order,e)).map(f=>Z(u[f],a.spread)),arrangement:i}}function xe(t,e,n,o){let r=t.state,a=e.length,s=ot(t,a,e,n,o).slots,c=r.transition;if(c){let{from:f}=c,l=f.source?r.transitionSource:null,m=l&&l.id===f.source&&B.has(l.key)?l:null,k=m!==null&&t.isSelf(m),A=m&&!k?K(m):n,g=j(f.arrangement,{count:a,sizes:e,box:A,time:o});m&&!k&&(g=Ct(m.frame,g));let x=U(I(f.order,a));for(let d=0;d<a;d++)s[d]=rt(Z(g[x[d]],f.spread),s[d],c.mix[d]??1)}let i=r.revealState,u=r.waveState,h=r.focusState;if(i||u||h)for(let f=0;f<a;f++)Mt(s[f],f,e[f],i,u,h);return s}function vt(t,e){return J(e)||(t.transition?J(t.transition.from.arrangement):0)}function Me(t){return{perspective:t,orbit:0,elevation:0,dolly:0,lookAt:le,zoom:1,heading:0,viewportX:0,viewportY:0}}function ye(t,e,n){let o={x:t.x+e.x,y:e.y-t.y,width:n.width,height:n.height};return e.rotation===0&&e.scale===1&&e.rotationX===0&&e.rotationY===0&&e.depth===0&&e.opacity===1?o:{...o,rotation:e.rotation,scale:e.scale,rotationX:e.rotationX,rotationY:e.rotationY,depth:e.depth,opacity:e.opacity}}function Ct(t,e){return e.map(n=>{let o=Se(n.x*t.scale,n.y*t.scale,t.rotation);return{...n,x:t.x+o.x,y:t.y+o.y,depth:n.depth*t.scale,rotation:n.rotation+t.rotation,scale:n.scale*t.scale}})}function K(t){return L(t.size,t.state.padding)}function L(t,e){let n=St.insetBounds(t.width,t.height,e);return{width:n.width,height:n.height}}function we(t,e,n){let o=0,r=0;for(let a=0;a<t.length;a++){let s=t[a],c=e[a],i=s.rotation*Math.PI/180,u=Math.abs(Math.cos(i)),h=Math.abs(Math.sin(i)),f=n>0&&n-s.depth>1?n/(n-s.depth):1,l=(c.width*u+c.height*h)/2*s.scale*f,m=(c.width*h+c.height*u)/2*s.scale*f;o=Math.max(o,Math.abs(s.x)*f+l),r=Math.max(r,Math.abs(s.y)*f+m)}return{width:o*2,height:r*2}}function Se(t,e,n){if(n===0)return{x:t,y:e};let o=n*Math.PI/180,r=Math.cos(o),a=Math.sin(o);return{x:t*r+e*a,y:-t*a+e*r}}function ke(t,e){return Math.abs(t.width-e.width)<1e-6&&Math.abs(t.height-e.height)<1e-6}function et(t,e,n){return t+(e-t)*n}import{findNode2D as An,frameIn as In}from"@motionscript/sdk";export{y as a,rt as b,Z as c,at as d,be as e,ct as f,Re as g,it as h,ut as i,Ge as j,Ft as k,ve as l,Ce as m,Ne as n,ft as o,Ht as p,lt as q,Ye as r,Be as s,ht as t,qt as u,pt as v,Xe as w,He as x,We as y,j as z,J as A,jt as B,W as C,dt as D,mt as E,gt as F,N as G,Q as H,xt as I,Mt as J,I as K,U as L,yt as M,$ as N,b as O,S as P,Lt as Q,Nt as R,An as S,In as T};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
//# sourceMappingURL=chunk-TYNFMZ3D.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/kit/slots/path.ts", "../../../src/kit/slots/slot.ts", "../../../src/kit/slots/radial.ts", "../../../src/kit/slots/rectangular.ts", "../../../src/kit/slots/sphere.ts", "../../../src/kit/slots/path-templates.ts", "../../../src/kit/slots/index.ts", "../../../src/kit/random.ts", "../../../src/kit/stagger.ts", "../../../src/kit/item-effects.ts", "../../../src/kit/order.ts", "../../../src/kit/item-grid.ts", "../../../src/kit/index.ts"],
|
|
4
|
+
"sourcesContent": ["import { pathOps, type PathData, type PathSampler } from \"@motionscript/sdk\"\n\nimport { slot, type Slot, type SlotInput } from \"./slot\"\n\n/** `distribute` spreads the items over the path; `fixed` sets them a distance apart. */\nexport const PATH_SPACINGS = [\"distribute\", \"fixed\"] as const\nexport type PathSpacing = (typeof PATH_SPACINGS)[number]\n\n/** How path coordinates land in the grid's frame: `origin` of the path goes to `(x, y)`, turned and scaled. */\nexport interface PathPlacement {\n originX: number\n originY: number\n /** The path is y-down, as SVG and the editor write one. */\n flipY?: boolean\n x: number\n y: number\n /** Degrees clockwise. */\n rotation: number\n scale: number\n}\n\nexport interface PathArrangement {\n kind: \"path\"\n /** y-up, like every path in the library, unless its placement says otherwise. */\n path: PathData\n placement: PathPlacement\n spacing: PathSpacing\n /** Pixels between items when `spacing` is `fixed`. */\n spacingDistance: number\n /** Share of the path the items are moved along; wraps on a closed path. */\n offset: number\n /** Share of the path per second the items travel on their own. */\n flowSpeed: number\n trimStart: number\n trimEnd: number\n /** Turn each item to follow the path's direction. */\n alignToPath: boolean\n}\n\nconst SAMPLERS = new Map<PathData, { sampler: PathSampler; closed: boolean }>()\nconst SAMPLER_CACHE = 32\n\n/** A sampler for `path`, kept while the same value keeps arriving — a path is re-read every frame. */\nfunction measured(path: PathData): { sampler: PathSampler; closed: boolean } {\n const hit = SAMPLERS.get(path)\n if (hit) return hit\n const contours = pathOps.contours(path)\n const entry = {\n sampler: pathOps.sampler(path),\n closed: contours.length === 1 && contours[0].closed,\n }\n if (SAMPLERS.size >= SAMPLER_CACHE) SAMPLERS.delete(SAMPLERS.keys().next().value!)\n SAMPLERS.set(path, entry)\n return entry\n}\n\n/**\n * Items at even arc-length steps — by distance along the curve rather than the\n * path's own parameter, which bunches them up wherever a curve is tight.\n *\n * On a closed path used whole, `n` items take `n` equal steps and `offset`\n * wraps round, so an animated offset is a loop. Anywhere else the ends are\n * ends: `n` items take `n - 1` steps so both get one, and an item moved past\n * either is hidden rather than piled on it.\n */\nexport function pathSlots(arrangement: PathArrangement, input: SlotInput): Slot[] {\n const { count } = input\n if (count === 0) return []\n const { sampler, closed } = measured(arrangement.path)\n const length = sampler.length\n const a = clamp01(Math.min(arrangement.trimStart, arrangement.trimEnd))\n const b = clamp01(Math.max(arrangement.trimStart, arrangement.trimEnd))\n const start = a * length\n const span = (b - a) * length\n const loops = closed && a === 0 && b === 1\n const offset = arrangement.offset + arrangement.flowSpeed * input.time\n const place = arrangement.placement\n const rad = (place.rotation * Math.PI) / 180\n const cos = Math.cos(rad)\n const sin = Math.sin(rad)\n\n const slots: Slot[] = []\n for (let k = 0; k < count; k++) {\n let u: number\n if (arrangement.spacing === \"fixed\" && span > 0) {\n u = offset + (k * arrangement.spacingDistance) / span\n } else if (loops) {\n u = offset + k / count\n } else {\n u = offset + (count === 1 ? 0.5 : k / (count - 1))\n }\n let visible = true\n if (loops) u = u - Math.floor(u)\n else if (u < -1e-9 || u > 1 + 1e-9) visible = false\n const at = sampler.frameAt(start + clamp01(u) * span)\n if (!at) {\n const s = slot(0, 0, { kind: \"path\", t: clamp01(u) })\n s.opacity = 0\n slots.push(s)\n continue\n }\n // Into the grid's frame: about the path's origin, turned clockwise (y-up).\n const flip = place.flipY ? -1 : 1\n const px = (at.x - place.originX) * place.scale\n const py = (at.y - place.originY) * place.scale * flip\n const s = slot(\n place.x + px * cos + py * sin,\n place.y - px * sin + py * cos,\n { kind: \"path\", t: clamp01(u) },\n )\n if (arrangement.alignToPath) s.rotation = (-Math.atan2(at.ty * flip, at.tx) * 180) / Math.PI + place.rotation\n if (!visible) s.opacity = 0\n slots.push(s)\n }\n return slots\n}\n\nfunction clamp01(v: number): number {\n return v < 0 ? 0 : v > 1 ? 1 : v\n}\n", "import type { Size2D } from \"@motionscript/sdk\"\n\n/**\n * One place in an arrangement, in the grid's own frame: centred on it, y-up,\n * `depth` toward the viewer.\n *\n * Pure data, and the whole of what an arrangement produces — which is what lets\n * a morph blend any two of them item by item, whatever shapes they came from.\n */\nexport interface Slot {\n x: number\n y: number\n depth: number\n /** Degrees clockwise. */\n rotation: number\n /** Tilt, degrees, as a node's own `rotationX`/`rotationY`. */\n rotationX: number\n rotationY: number\n scale: number\n opacity: number\n meta: SlotMeta\n}\n\n/** What kind of place a slot is — the orderings a stagger can follow. */\nexport type SlotMeta =\n | { kind: \"rectangular\"; row: number; column: number }\n /** Degrees clockwise from the arrangement's first slot. */\n | { kind: \"radial\"; angle: number }\n /** `0..1` along the part of the path in use. */\n | { kind: \"path\"; t: number }\n /** `depth` is `-1` at the back of the sphere and `1` at the front. */\n | { kind: \"sphere\"; lat: number; lon: number; depth: number }\n\n/** What an arrangement is laid out for. */\nexport interface SlotInput {\n count: number\n /** Each item's measured size, in item order. */\n sizes: readonly Size2D[]\n /** The grid's content box. */\n box: Size2D\n /** Clip seconds, for arrangements that move on their own. */\n time: number\n}\n\nexport function slot(x: number, y: number, meta: SlotMeta): Slot {\n return { x, y, depth: 0, rotation: 0, rotationX: 0, rotationY: 0, scale: 1, opacity: 1, meta }\n}\n\n/** `a` toward `b`. The meta switches halfway, since an ordering cannot be half one thing. */\nexport function blendSlot(a: Slot, b: Slot, t: number): Slot {\n if (t <= 0) return a\n if (t >= 1) return b\n const mix = (p: number, q: number) => p + (q - p) * t\n return {\n x: mix(a.x, b.x),\n y: mix(a.y, b.y),\n depth: mix(a.depth, b.depth),\n rotation: mix(a.rotation, b.rotation),\n rotationX: mix(a.rotationX, b.rotationX),\n rotationY: mix(a.rotationY, b.rotationY),\n scale: mix(a.scale, b.scale),\n opacity: mix(a.opacity, b.opacity),\n meta: t < 0.5 ? a.meta : b.meta,\n }\n}\n\n/** Push `s` away from (or pull it toward) the grid's centre. */\nexport function spreadSlot(s: Slot, spread: number): Slot {\n if (spread === 1) return s\n return { ...s, x: s.x * spread, y: s.y * spread, depth: s.depth * spread }\n}\n\n/** Largest width and height among `sizes`. */\nexport function largest(sizes: readonly Size2D[]): Size2D {\n let width = 0\n let height = 0\n for (const size of sizes) {\n if (size.width > width) width = size.width\n if (size.height > height) height = size.height\n }\n return { width, height }\n}\n", "import { slot, type Slot, type SlotInput } from \"./slot\"\n\nexport const RADIAL_DIRECTIONS = [\"clockwise\", \"counterclockwise\"] as const\nexport type RadialDirection = (typeof RADIAL_DIRECTIONS)[number]\n\nexport interface RadialArrangement {\n kind: \"radial\"\n radius: number\n /** Where the first item sits, degrees clockwise from twelve o'clock. */\n startAngle: number\n /** How much of the circle the items span, degrees. */\n sweep: number\n direction: RadialDirection\n /** Turn each item so its top faces away from the centre. */\n rotateItems: boolean\n /** Degrees per second the ring turns on its own. */\n spinSpeed: number\n}\n\n/**\n * The angle of each of `count` slots, clockwise from twelve o'clock. A full\n * circle divides by the count, so the last item does not land on the first; an\n * arc divides by one less, so both ends get an item. In between the divisor\n * slides from one to the other as the arc closes — steeply, so an arc is an arc\n * until it is nearly whole, and a sweep animated to 360 lands without a jump.\n */\nexport function radialAngles(arrangement: RadialArrangement, count: number, time: number): number[] {\n const sweep = arrangement.sweep\n const closing = Math.min(1, Math.abs(sweep) / 360) ** 8\n const step = count <= 1 ? 0 : sweep / (count - 1 + closing)\n const sign = arrangement.direction === \"counterclockwise\" ? -1 : 1\n const start = arrangement.startAngle + arrangement.spinSpeed * time\n const angles: number[] = []\n for (let k = 0; k < count; k++) angles.push(start + sign * k * step)\n return angles\n}\n\nexport function radialSlots(arrangement: RadialArrangement, input: SlotInput): Slot[] {\n const angles = radialAngles(arrangement, input.count, input.time)\n const start = angles[0] ?? 0\n return angles.map((angle) => {\n const rad = (angle * Math.PI) / 180\n const s = slot(arrangement.radius * Math.sin(rad), arrangement.radius * Math.cos(rad), {\n kind: \"radial\",\n angle: Math.abs(angle - start),\n })\n if (arrangement.rotateItems) s.rotation = angle\n return s\n })\n}\n\n/** The change to `startAngle` that brings slot `index` to twelve o'clock by the shorter way round. */\nexport function radialTurnToTop(arrangement: RadialArrangement, count: number, index: number): number {\n const angle = radialAngles({ ...arrangement, spinSpeed: 0 }, count, 0)[index] ?? arrangement.startAngle\n return -wrapDegrees(angle)\n}\n\n/** `degrees` folded into `(-180, 180]`. */\nexport function wrapDegrees(degrees: number): number {\n const wrapped = ((degrees % 360) + 360) % 360\n return wrapped > 180 ? wrapped - 360 : wrapped\n}\n", "import type { Size2D } from \"@motionscript/sdk\"\n\nimport { largest, slot, type Slot, type SlotInput } from \"./slot\"\n\nexport const FILL_DIRECTIONS = [\"row\", \"column\"] as const\nexport type FillDirection = (typeof FILL_DIRECTIONS)[number]\n\n/**\n * How big a cell is: the largest child (`fit`), a size of its own (`fixed`), or\n * an equal share of the grid's box (`fill`), which is also the room a child set\n * to `fill` grows into.\n */\nexport const CELL_MODES = [\"fit\", \"fixed\", \"fill\"] as const\nexport type CellMode = (typeof CELL_MODES)[number]\n\n/** Where a short last row (or column, filling by column) sits. */\nexport const LINE_ALIGNS = [\"start\", \"center\", \"end\"] as const\nexport type LineAlign = (typeof LINE_ALIGNS)[number]\n\nexport interface RectangularArrangement {\n kind: \"rectangular\"\n columns: number\n fillDirection: FillDirection\n cellMode: CellMode\n cellWidth: number\n cellHeight: number\n columnGap: number\n rowGap: number\n lastLineAlign: LineAlign\n /** Share of a column's pitch every other row shifts right — `0.5` is a brick bond. */\n rowOffset: number\n /** Share of a row's pitch every other column shifts down. */\n columnOffset: number\n}\n\n/** Rows and columns `count` items make, `columns` wide. */\nexport function rectangularShape(arrangement: RectangularArrangement, count: number): { rows: number; columns: number } {\n const columns = Math.max(1, Math.round(arrangement.columns))\n const rows = Math.max(1, Math.ceil(count / columns))\n // Filling by column, the rows are set by the count, and a column the items\n // never reach would pull the block off centre.\n if (arrangement.fillDirection === \"column\") return { rows, columns: Math.max(1, Math.ceil(count / rows)) }\n return { rows, columns }\n}\n\n/** The cell every item is laid out in — what a `fill` child is measured against. */\nexport function rectangularCell(\n arrangement: RectangularArrangement,\n count: number,\n sizes: readonly Size2D[],\n box: Size2D,\n): Size2D {\n const { rows, columns } = rectangularShape(arrangement, count)\n switch (arrangement.cellMode) {\n case \"fixed\":\n return { width: Math.max(0, arrangement.cellWidth), height: Math.max(0, arrangement.cellHeight) }\n case \"fill\":\n return {\n width: Math.max(0, (box.width - arrangement.columnGap * (columns - 1)) / columns),\n height: Math.max(0, (box.height - arrangement.rowGap * (rows - 1)) / rows),\n }\n default:\n return largest(sizes)\n }\n}\n\n/**\n * Items fill rows left to right, top to bottom (or columns top to bottom, left to\n * right), and the whole block is centred on the grid.\n */\nexport function rectangularSlots(arrangement: RectangularArrangement, input: SlotInput): Slot[] {\n const { count } = input\n if (count === 0) return []\n const { rows, columns } = rectangularShape(arrangement, count)\n const byColumn = arrangement.fillDirection === \"column\"\n // Filling by column keeps the column count and lets the rows follow from it.\n const lines = byColumn ? columns : rows\n const perLine = byColumn ? rows : columns\n const cell = rectangularCell(arrangement, count, input.sizes, input.box)\n const pitchX = cell.width + arrangement.columnGap\n const pitchY = cell.height + arrangement.rowGap\n const lastLine = lines - 1\n const lastCount = count - lastLine * perLine\n const shortBy = perLine - lastCount\n const lead = arrangement.lastLineAlign === \"center\" ? shortBy / 2 : arrangement.lastLineAlign === \"end\" ? shortBy : 0\n // Shifting every other row by a share of a pitch moves the block's centre by\n // half that share; taking it back keeps the block centred on the grid.\n const shiftX = arrangement.rowOffset * pitchX\n const shiftY = arrangement.columnOffset * pitchY\n\n const slots: Slot[] = []\n for (let i = 0; i < count; i++) {\n const line = Math.floor(i / perLine)\n let along = i % perLine\n if (line === lastLine) along += lead\n const row = byColumn ? along : line\n const column = byColumn ? line : along\n // A centred short line sits between whole cells; its parity is the cell it covers most.\n const rowIndex = Math.round(row)\n const columnIndex = Math.round(column)\n const x = (column - (columns - 1) / 2) * pitchX\n + (rowIndex % 2 === 1 ? shiftX : 0) - (rows > 1 ? shiftX / 2 : 0)\n const y = ((rows - 1) / 2 - row) * pitchY\n - (columnIndex % 2 === 1 ? shiftY : 0) + (columns > 1 ? shiftY / 2 : 0)\n slots.push(slot(x, y, { kind: \"rectangular\", row: rowIndex, column: columnIndex }))\n }\n return slots\n}\n", "import { slot, type Slot, type SlotInput } from \"./slot\"\n\n/** `outward` lays each item on the sphere's surface; `billboard` keeps every item facing the viewer. */\nexport const SPHERE_FACINGS = [\"outward\", \"billboard\"] as const\nexport type SphereFacing = (typeof SPHERE_FACINGS)[number]\n\nexport const SPHERE_AXES = [\"x\", \"y\", \"z\"] as const\nexport type SphereAxis = (typeof SPHERE_AXES)[number]\n\nexport interface SphereArrangement {\n kind: \"sphere\"\n radius: number\n /** Turn about the vertical axis, degrees — positive carries the front to the right. */\n yaw: number\n /** Turn about the horizontal axis, degrees — positive brings the top toward the viewer. */\n pitch: number\n /** Turn about the view axis, degrees clockwise. */\n roll: number\n facing: SphereFacing\n /** The camera's distance from the sphere's centre plane, px — smaller is more dramatic. */\n focalLength: number\n /** How much the back half fades, `0..1`. */\n depthFade: number\n /** Hide the items whose faces point away from the viewer. */\n cullBackfaces: boolean\n /** Degrees per second of yaw the sphere turns on its own. */\n spinSpeed: number\n}\n\nconst GOLDEN_ANGLE = Math.PI * (3 - Math.sqrt(5))\nconst DEG = 180 / Math.PI\n\n/** Point `k` of `count` on the unit sphere — a Fibonacci lattice, as even as `count` points get. */\nexport function fibonacciPoint(k: number, count: number): [number, number, number] {\n if (count <= 1) return [0, 0, 1]\n const y = 1 - (2 * (k + 0.5)) / count\n const r = Math.sqrt(Math.max(0, 1 - y * y))\n const theta = k * GOLDEN_ANGLE\n return [Math.cos(theta) * r, y, Math.sin(theta) * r]\n}\n\n/** `p` turned by yaw, then pitch, then roll — y-up, z toward the viewer. */\nexport function orient(p: readonly [number, number, number], yaw: number, pitch: number, roll: number): [number, number, number] {\n const [x0, y0, z0] = p\n const ya = yaw / DEG, pa = pitch / DEG, ra = roll / DEG\n const x1 = x0 * Math.cos(ya) + z0 * Math.sin(ya)\n const z1 = -x0 * Math.sin(ya) + z0 * Math.cos(ya)\n const y2 = y0 * Math.cos(pa) - z1 * Math.sin(pa)\n const z2 = y0 * Math.sin(pa) + z1 * Math.cos(pa)\n return [x1 * Math.cos(ra) + y2 * Math.sin(ra), -x1 * Math.sin(ra) + y2 * Math.cos(ra), z2]\n}\n\nexport function sphereSlots(arrangement: SphereArrangement, input: SlotInput): Slot[] {\n const { count } = input\n const radius = arrangement.radius\n const yaw = arrangement.yaw + arrangement.spinSpeed * input.time\n const outward = arrangement.facing === \"outward\"\n const slots: Slot[] = []\n for (let k = 0; k < count; k++) {\n const q = fibonacciPoint(k, count)\n const [nx, ny, nz] = orient(q, yaw, arrangement.pitch, arrangement.roll)\n const s = slot(nx * radius, ny * radius, {\n kind: \"sphere\",\n lat: Math.asin(Math.max(-1, Math.min(1, q[1]))) * DEG,\n lon: Math.atan2(q[2], q[0]) * DEG,\n depth: nz,\n })\n s.depth = nz * radius\n if (outward) {\n // The tilt whose `Rx · Ry` turns a face's normal onto the surface normal.\n s.rotationY = Math.asin(Math.max(-1, Math.min(1, nx))) * DEG\n s.rotationX = Math.atan2(ny, nz) * DEG\n }\n s.opacity = 1 - arrangement.depthFade * (1 - (nz + 1) / 2)\n if (outward && arrangement.cullBackfaces && facesAway(s, [nx, ny, nz], arrangement.focalLength)) s.opacity = 0\n slots.push(s)\n }\n return slots\n}\n\n/** Whether an outward face at `s` shows its back to a viewer `focal` px in front of the centre. */\nfunction facesAway(s: Slot, normal: readonly [number, number, number], focal: number): boolean {\n if (focal <= 0) return normal[2] < 0\n return normal[0] * -s.x + normal[1] * -s.y + normal[2] * (focal - s.depth) < 0\n}\n\n/** The yaw and pitch that bring point `index` of `count` round to face the viewer. */\nexport function sphereFaceForward(count: number, index: number): { yaw: number; pitch: number } {\n const [x, y, z] = fibonacciPoint(index, count)\n return {\n yaw: -Math.atan2(x, z) * DEG,\n pitch: Math.atan2(y, Math.hypot(x, z)) * DEG,\n }\n}\n", "import type { PathCommand, Size2D } from \"@motionscript/sdk\"\n\n/**\n * The shapes a path grid can follow without a path of its own, each drawn to\n * fill the grid's box. Centred and y-up, like every path in the library; the\n * closed ones run clockwise, so an item flowing along any of them travels the\n * same way round.\n */\nexport const PATH_TEMPLATES = [\n \"circle\",\n \"square\",\n \"star\",\n \"heart\",\n \"infinity\",\n \"wave\",\n \"spiral\",\n \"arc\",\n \"line\",\n] as const\nexport type PathTemplate = (typeof PATH_TEMPLATES)[number]\n\n/** What a template is drawn at when the grid has no box to fill. */\nconst FALLBACK = 400\n\nconst DRAWN = new Map<string, PathCommand[]>()\nconst DRAWN_CACHE = 64\n\n/**\n * `template` drawn to fill `box`. The same template at the same size is the\n * same array, which is what lets the path's measurement be kept between frames.\n */\nexport function templatePath(template: PathTemplate, box: Size2D): PathCommand[] {\n const key = `${template}:${Math.round(box.width * 100)}:${Math.round(box.height * 100)}`\n const hit = DRAWN.get(key)\n if (hit) return hit\n const path = drawTemplate(template, box)\n if (DRAWN.size >= DRAWN_CACHE) DRAWN.delete(DRAWN.keys().next().value!)\n DRAWN.set(key, path)\n return path\n}\n\nfunction drawTemplate(template: PathTemplate, box: Size2D): PathCommand[] {\n const w = box.width > 0 ? box.width : FALLBACK\n const h = box.height > 0 ? box.height : FALLBACK\n const rx = w / 2\n const ry = h / 2\n switch (template) {\n case \"square\":\n return closed([\n [-rx, ry], [rx, ry], [rx, -ry], [-rx, -ry],\n ])\n case \"star\": {\n const points: [number, number][] = []\n for (let i = 0; i < 10; i++) {\n const angle = (i * Math.PI) / 5\n const r = i % 2 === 0 ? 1 : 0.45\n points.push([Math.sin(angle) * rx * r, Math.cos(angle) * ry * r])\n }\n return closed(points)\n }\n case \"heart\":\n return closed(sample(96, (t) => {\n // The classic heart curve, from its top notch, clockwise.\n const a = t * 2 * Math.PI\n const x = 16 * Math.sin(a) ** 3\n const y = 13 * Math.cos(a) - 5 * Math.cos(2 * a) - 2 * Math.cos(3 * a) - Math.cos(4 * a)\n return [(x / 17) * rx, ((y + 2.5) / 15.5) * ry]\n }).slice(0, -1))\n case \"infinity\":\n return closed(sample(96, (t) => {\n const a = t * 2 * Math.PI\n const d = 1 + Math.sin(a) ** 2\n return [(Math.cos(a) / d) * rx, ((Math.sin(a) * Math.cos(a)) / d) * ry * 2]\n }).slice(0, -1))\n case \"wave\":\n return open(sample(96, (t) => [(-1 + 2 * t) * rx, Math.sin(t * 4 * Math.PI) * ry * 0.6]))\n case \"spiral\":\n return open(sample(160, (t) => {\n const a = t * 3 * 2 * Math.PI\n const r = 0.08 + 0.92 * t\n return [Math.sin(a) * rx * r, Math.cos(a) * ry * r]\n }))\n case \"arc\":\n return open(sample(64, (t) => {\n const a = -Math.PI / 2 + t * Math.PI\n return [Math.sin(a) * rx, -ry + Math.cos(a) * h]\n }))\n case \"line\":\n return [{ type: \"M\", x: -rx, y: 0 }, { type: \"L\", x: rx, y: 0 }]\n default:\n return ellipse(rx, ry)\n }\n}\n\n/** Four quarter-arcs from the top, clockwise. */\nfunction ellipse(rx: number, ry: number): PathCommand[] {\n const k = 0.5522847498\n return [\n { type: \"M\", x: 0, y: ry },\n { type: \"C\", x1: k * rx, y1: ry, x2: rx, y2: k * ry, x: rx, y: 0 },\n { type: \"C\", x1: rx, y1: -k * ry, x2: k * rx, y2: -ry, x: 0, y: -ry },\n { type: \"C\", x1: -k * rx, y1: -ry, x2: -rx, y2: -k * ry, x: -rx, y: 0 },\n { type: \"C\", x1: -rx, y1: k * ry, x2: -k * rx, y2: ry, x: 0, y: ry },\n { type: \"Z\" },\n ]\n}\n\nfunction sample(steps: number, at: (t: number) => [number, number]): [number, number][] {\n const points: [number, number][] = []\n for (let i = 0; i <= steps; i++) points.push(at(i / steps))\n return points\n}\n\nfunction open(points: [number, number][]): PathCommand[] {\n return points.map(([x, y], i) => (i === 0 ? { type: \"M\", x, y } : { type: \"L\", x, y }))\n}\n\nfunction closed(points: [number, number][]): PathCommand[] {\n return [...open(points), { type: \"Z\" }]\n}\n", "import { pathSlots, type PathArrangement } from \"./path\"\nimport { radialSlots, type RadialArrangement } from \"./radial\"\nimport { rectangularSlots, type RectangularArrangement } from \"./rectangular\"\nimport type { Slot, SlotInput } from \"./slot\"\nimport { sphereSlots, type SphereArrangement } from \"./sphere\"\n\nexport * from \"./slot\"\nexport * from \"./rectangular\"\nexport * from \"./radial\"\nexport * from \"./path\"\nexport * from \"./path-templates\"\nexport * from \"./sphere\"\n\n/**\n * Everything an arrangement needs to place items, as plain data — so a\n * transition can keep the one it is leaving, and a grid can borrow another's.\n */\nexport type Arrangement = RectangularArrangement | RadialArrangement | PathArrangement | SphereArrangement\n\nexport type ArrangementKind = Arrangement[\"kind\"]\n\n/** Where each of `input.count` items sits under `arrangement`, in slot order. */\nexport function slotsOf(arrangement: Arrangement, input: SlotInput): Slot[] {\n switch (arrangement.kind) {\n case \"rectangular\":\n return rectangularSlots(arrangement, input)\n case \"radial\":\n return radialSlots(arrangement, input)\n case \"path\":\n return pathSlots(arrangement, input)\n case \"sphere\":\n return sphereSlots(arrangement, input)\n }\n}\n\n/** The camera distance an arrangement is seen through, or `0` when it is flat. */\nexport function focalLengthOf(arrangement: Arrangement): number {\n return arrangement.kind === \"sphere\" ? Math.max(1, arrangement.focalLength) : 0\n}\n", "/** A seeded generator in `[0, 1)` — mulberry32, so a shuffle is the same on every frame and every machine. */\nexport function seededRandom(seed: number): () => number {\n let a = Math.floor(seed) >>> 0\n return () => {\n a = (a + 0x6d2b79f5) >>> 0\n let t = a\n t = Math.imul(t ^ (t >>> 15), t | 1)\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61)\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n }\n}\n\n/** `values` in a seeded random order. */\nexport function shuffled<T>(values: readonly T[], seed: number): T[] {\n const out = [...values]\n const random = seededRandom(seed)\n for (let i = out.length - 1; i > 0; i--) {\n const j = Math.floor(random() * (i + 1))\n ;[out[i], out[j]] = [out[j], out[i]]\n }\n return out\n}\n\n/** A stable number for a string — a node's id, so its \"random\" stagger never changes between builds. */\nexport function hashSeed(text: string): number {\n let h = 2166136261\n for (let i = 0; i < text.length; i++) h = Math.imul(h ^ text.charCodeAt(i), 16777619)\n return h >>> 0\n}\n", "import { shuffled } from \"./random\"\nimport type { Slot } from \"./slots\"\n\n/**\n * The order a per-item effect sweeps through a grid's items. The first five\n * work on any grid; the rest follow one arrangement's own geometry — rows and\n * columns of a rectangular grid (or top-to-bottom and left-to-right of any\n * other), the way round a ring, the way along a path, front to back of a sphere\n * — and fall back to item order where the grid has no such thing.\n */\nexport const STAGGER_ORDERS = [\n \"index\",\n \"reverse\",\n \"random\",\n \"centerOut\",\n \"edgesIn\",\n \"row\",\n \"column\",\n \"angle\",\n \"path\",\n \"depth\",\n] as const\nexport type StaggerOrder = (typeof STAGGER_ORDERS)[number]\n\n/** The most of a command's length the offsets may take; the rest is each item's own motion. */\nconst MAX_STAGGER = 0.95\n\n/**\n * Each item's start, `0..1`, as a share of the stagger: `0` goes first, `1`\n * last, and items that tie go together — a ring revealed `centerOut` from its\n * centre appears all at once, which is what that means.\n */\nexport function staggerRanks(order: StaggerOrder, slots: readonly Slot[], seed: number): number[] {\n const n = slots.length\n const keys = keysOf(order, slots, seed)\n let min = Infinity\n let max = -Infinity\n for (const key of keys) {\n if (key < min) min = key\n if (key > max) max = key\n }\n const range = max - min\n if (!(range > 1e-9)) return new Array<number>(n).fill(0)\n return keys.map((key) => (key - min) / range)\n}\n\n/**\n * Item progress at command time `t`: each item runs over the same length of\n * time, starting `rank · stagger` in. The stagger lives inside the command's\n * duration, so a one-second reveal takes one second for four items or four\n * hundred.\n */\nexport function staggerProgress(rank: number, t: number, stagger: number): number {\n const s = Math.max(0, Math.min(MAX_STAGGER, stagger))\n const p = s === 0 ? t : (t - rank * s) / (1 - s)\n return p < 0 ? 0 : p > 1 ? 1 : p\n}\n\nfunction keysOf(order: StaggerOrder, slots: readonly Slot[], seed: number): number[] {\n switch (order) {\n case \"reverse\":\n return slots.map((_, i) => -i)\n case \"random\": {\n const sequence = shuffled(slots.map((_, i) => i), seed)\n const keys = new Array<number>(slots.length)\n sequence.forEach((item, rank) => {\n keys[item] = rank\n })\n return keys\n }\n case \"centerOut\":\n return slots.map((s) => Math.round(Math.hypot(s.x, s.y, s.depth) * 1000) / 1000)\n case \"edgesIn\":\n return slots.map((s) => -Math.round(Math.hypot(s.x, s.y, s.depth) * 1000) / 1000)\n case \"row\":\n return slots.map((s) => (s.meta.kind === \"rectangular\" ? s.meta.row : -Math.round(s.y)))\n case \"column\":\n return slots.map((s) => (s.meta.kind === \"rectangular\" ? s.meta.column : Math.round(s.x)))\n case \"angle\":\n return slots.map((s, i) =>\n s.meta.kind === \"radial\" ? s.meta.angle : s.meta.kind === \"rectangular\" || s.meta.kind === \"sphere\" ? clockAngle(s) : i\n )\n case \"path\":\n return slots.map((s, i) => (s.meta.kind === \"path\" ? s.meta.t : i))\n case \"depth\":\n return slots.map((s, i) => (s.meta.kind === \"sphere\" ? -s.meta.depth : i))\n default:\n return slots.map((_, i) => i)\n }\n}\n\n/** Degrees clockwise from twelve o'clock to where `s` sits. */\nfunction clockAngle(s: Slot): number {\n const angle = (Math.atan2(s.x, s.y) * 180) / Math.PI\n return angle < 0 ? angle + 360 : angle\n}\n", "import type { Size2D } from \"@motionscript/sdk\"\n\nimport type { Slot } from \"./slots\"\n\n/**\n * What an item does on its way in (or out): grow from nothing, fade, fly out of\n * the grid's centre, rise into place, flip up, or spin in.\n */\nexport const REVEAL_STYLES = [\"scale\", \"fade\", \"center\", \"rise\", \"flip\", \"spin\"] as const\nexport type RevealStyle = (typeof REVEAL_STYLES)[number]\n\n/** What a wave does to each item as it passes. */\nexport const WAVE_STYLES = [\"scale\", \"lift\", \"fade\", \"spin\"] as const\nexport type WaveStyle = (typeof WAVE_STYLES)[number]\n\n/**\n * How far into view each item is, `1` shown and `0` gone — past `1` on the\n * way to it under an overshooting ease. Absent means every item is shown.\n */\nexport interface RevealState {\n style: RevealStyle\n values: readonly number[]\n}\n\n/** Each item's share of the wave passing through it, `0` at rest and `1` at the crest. */\nexport interface WaveState {\n style: WaveStyle\n /** How big the crest is — a share of the item's size, opacity or a turn, by style. */\n amount: number\n values: readonly number[]\n}\n\n/** Each item's emphasis: `1` the focus, `-1` pushed back, `0` untouched. */\nexport interface FocusState {\n /** How far the others fade, `0..1`. */\n dim: number\n /** How much the focus grows, as a share of its size; the others shrink by half that. */\n grow: number\n values: readonly number[]\n}\n\n/** Layer item `i`'s reveal, wave and focus onto its slot, in place. */\nexport function applyItemEffects(\n s: Slot,\n i: number,\n size: Size2D,\n reveal: RevealState | null | undefined,\n wave: WaveState | null | undefined,\n focus: FocusState | null | undefined,\n): void {\n if (reveal) applyReveal(s, reveal.style, reveal.values[i] ?? 1, size)\n if (wave) applyWave(s, wave, wave.values[i] ?? 0, size)\n if (focus) applyFocus(s, focus, focus.values[i] ?? 0)\n}\n\nfunction applyReveal(s: Slot, style: RevealStyle, v: number, size: Size2D): void {\n if (v === 1) return\n const shown = clamp01(v)\n switch (style) {\n case \"fade\":\n s.opacity *= shown\n break\n case \"center\":\n s.x *= v\n s.y *= v\n s.depth *= v\n s.opacity *= clamp01(v * 4)\n break\n case \"rise\":\n s.y -= (1 - v) * Math.max(40, size.height)\n s.opacity *= shown\n break\n case \"flip\":\n s.rotationX += (1 - v) * 90\n break\n case \"spin\":\n s.rotation -= (1 - v) * 180\n s.scale *= Math.max(0, v)\n break\n default:\n s.scale *= Math.max(0, v)\n }\n}\n\nfunction applyWave(s: Slot, wave: WaveState, w: number, size: Size2D): void {\n if (w === 0) return\n switch (wave.style) {\n case \"lift\":\n s.y += wave.amount * w * Math.max(40, size.height)\n break\n case \"fade\":\n s.opacity *= clamp01(1 - wave.amount * w)\n break\n case \"spin\":\n s.rotation += wave.amount * w * 360\n break\n default:\n s.scale *= 1 + wave.amount * w\n }\n}\n\nfunction applyFocus(s: Slot, focus: FocusState, f: number): void {\n if (f === 0) return\n if (f > 0) {\n s.scale *= 1 + focus.grow * f\n return\n }\n s.opacity *= clamp01(1 - focus.dim * -f)\n s.scale *= Math.max(0, 1 + focus.grow * 0.5 * f)\n}\n\nfunction clamp01(v: number): number {\n return v < 0 ? 0 : v > 1 ? 1 : v\n}\n", "/**\n * A grid's `order` lists items in slot order: slot `k` holds item `order[k]`.\n * These keep it a permutation whatever it was written as — a stale entry past\n * the count, a repeat, or nothing at all — so a child added or removed never\n * leaves a slot empty or two items in one.\n */\n\n/** `order` repaired into a permutation of `0..count-1`: its valid entries first, then the rest in item order. */\nexport function normalizeOrder(order: readonly number[] | undefined, count: number): number[] {\n const out: number[] = []\n const taken = new Array<boolean>(count).fill(false)\n for (const entry of order ?? []) {\n const item = Math.round(entry)\n if (item >= 0 && item < count && !taken[item]) {\n taken[item] = true\n out.push(item)\n }\n }\n for (let item = 0; item < count; item++) if (!taken[item]) out.push(item)\n return out\n}\n\n/** For each item, the slot it sits in. */\nexport function slotOfItem(order: readonly number[]): number[] {\n const slots = new Array<number>(order.length)\n order.forEach((item, slot) => {\n slots[item] = slot\n })\n return slots\n}\n\n/** An order written as `\"2, 0, 1\"` or as numbers. */\nexport function parseOrder(value: unknown): number[] {\n if (Array.isArray(value)) return value.map(Number).filter(Number.isFinite)\n if (typeof value !== \"string\") return []\n return value\n .split(/[\\s,]+/)\n .filter((part) => part !== \"\")\n .map(Number)\n .filter(Number.isFinite)\n}\n", "import {\n commandsFor,\n easeIn,\n easeInOut,\n easeOut,\n flowOps,\n insetsOps,\n Types,\n type ChildView,\n type InsetsResolved,\n type LayoutBox,\n type LayoutItem,\n type Measurer,\n type Node2D,\n type NodeFrame,\n type NodeView,\n type Piece,\n type Placement2D,\n type RenderContext,\n type Size2D,\n type SpaceCamera,\n type Timeline,\n type Values,\n} from \"@motionscript/sdk\"\n\nimport {\n applyItemEffects,\n REVEAL_STYLES,\n WAVE_STYLES,\n type FocusState,\n type RevealState,\n type WaveState,\n} from \"./item-effects\"\nimport { normalizeOrder, parseOrder, slotOfItem } from \"./order\"\nimport { hashSeed, shuffled } from \"./random\"\nimport { blendSlot, focalLengthOf, slotsOf, spreadSlot, type Arrangement, type Slot } from \"./slots\"\nimport { STAGGER_ORDERS, staggerProgress, staggerRanks, type StaggerOrder } from \"./stagger\"\n\n/**\n * What every grid is built from: a container that places each of its children\n * in a slot of an arrangement — a rectangular grid, a ring, a path, a sphere.\n * Spread `state` and `commands` in, take `defaults`, hand `fields` the\n * {@link Arranger} that makes this grid's arrangement from its state, and pass\n * the finished component and its arranger through {@link define}.\n *\n * ## Children only\n *\n * The items are the children, in layer order. A child's slot is a parent\n * transform on it, so its own `x`/`y`/`rotation`/`scale` — and any command on\n * them — still work, relative to the slot. A group is one item; a grid of\n * grids is a grid of items that happen to be grids.\n *\n * ## One pass\n *\n * Every frame: measure the children, ask the arrangement for its slots (a pure\n * function of the state, the sizes and the clock), blend them from where a\n * transition is leaving, and layer on the per-item effects — reveal, wave,\n * focus. What is left is each child's box and slot, which the renderer,\n * picking and `global` all read, so a selection outline lands on the pixels\n * even on a sphere.\n *\n * ## Commands\n *\n * Every command is a pure function of time. The per-item ones stagger *inside*\n * their duration — a one-second reveal takes one second for four children or\n * four hundred — and write their per-item state into entries\n * (`revealState` and its siblings), which is what keeps them seekable. The ones\n * that change the arrangement itself (a reorder, a morph, a column count) keep\n * the arrangement they are leaving as data and blend each item from its old\n * slot to its new one.\n */\n\n/** An arrangement a grid is leaving, kept as data so its slots can be worked out afresh every frame. */\nexport interface GridSnapshot {\n arrangement: Arrangement\n /** The grid the arrangement was borrowed from, or `\"\"` for the grid's own. */\n source: string\n order: readonly number[]\n spread: number\n}\n\n/** A change of arrangement under way: where the items are coming from, and how far each has come. */\nexport interface GridTransition {\n from: GridSnapshot\n /** Each item's eased, staggered progress, `0..1`. */\n mix: readonly number[]\n}\n\n/** The stagger options every per-item command takes. */\nexport interface StaggerArgs {\n staggerOrder?: StaggerOrder\n /** `0..0.95`: how much of the command's length the items' offsets take up. */\n stagger?: number\n}\n\n/**\n * Every grid's document key — what a reference to \"another grid\" may name. A\n * `nodeRef` descriptor carries it as `nodeTypes`, for a host's picker to offer\n * only those.\n */\nexport const ITEM_GRID_TYPES = [\"rectangularGrid\", \"radialGrid\", \"pathGrid\", \"sphereGrid\"] as const\n\n/** The stagger a move to new slots takes when its command states none. */\nexport const TRANSITION_STAGGER = 0.3\n\n/** A reference to another node, a host's picker offering only `types`. Its fields read a view of it. */\nexport function nodeRef(types: readonly string[]) {\n const described = { kind: \"nodeRef\", nodeTypes: types, animatable: false }\n return Types.custom<string, NodeView | null>(\"\", described)\n}\n\n/** The stagger args every per-item command takes, `stagger` defaulting to `fallback`. */\nexport function staggerArgs(fallback: number) {\n return {\n staggerOrder: Types.oneOf(STAGGER_ORDERS, { default: \"index\" }),\n stagger: Types.number(fallback, { min: 0, max: 0.95, step: 0.05 }),\n }\n}\n\n/**\n * A command arg a host fills in with `hint`, which a row may leave out: the\n * command then keeps what the grid has. A run arg's default is both what a\n * host offers and what an omitted arg means, so the hint rides on the arg's\n * description alone, and an omitted arg reads `undefined`.\n */\nexport function hinted<T extends number | string>(hint: T, options: object = {}) {\n const described: Record<string, unknown> = { ...options, default: hint }\n return Types.custom<T | undefined>(undefined, described as never)\n}\n\n/** A command arg naming another node, a host's picker offering only `types`; left out, it reads `undefined`. */\nexport function nodeRefArg(types: readonly string[]) {\n const described = { kind: \"nodeRef\", nodeTypes: types }\n return Types.custom<string | undefined>(undefined, described)\n}\n\n/** The state every grid shares. */\nexport const state = {\n /** Items in slot order: slot `k` holds child `order[k]`. Empty is the children's own order. */\n order: Types.custom<number[]>([], { kind: \"order\", animatable: false }),\n /** `0` gathers every item at the centre, `1` is the arrangement, past `1` pushes them apart. */\n spread: Types.number(1, { min: 0, max: 3, step: 0.05 }),\n /** Another grid whose arrangement this one takes on — what `morphInto` animates. */\n arrangeLike: nodeRef(ITEM_GRID_TYPES),\n // What the per-item commands write. State rather than settings: a command\n // owns each while it runs, and a document has no reason to name them. Unset\n // until a command writes one, so a fresh node's row does not state them.\n revealState: Types.custom<RevealState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n waveState: Types.custom<WaveState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n focusState: Types.custom<FocusState | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n transition: Types.custom<GridTransition | null | undefined>(undefined, { kind: \"state\", animatable: false }),\n /** The grid a transition's leaving arrangement was borrowed from, followed while the items travel. */\n transitionSource: Types.custom<string, NodeView | null, { readonly private: true }>(\"\", { kind: \"nodeRef\", private: true }),\n}\n\n/** A grid's size is what its items come to, whether it was built with children or they arrive after it. */\nexport const defaults = { width: \"hug\", height: \"hug\" } as const\n\n/** What a grid's commands read of its state, beyond its own arrangement's entries. */\nexport type GridValues = Values<typeof state> & { readonly padding: InsetsResolved }\n\n/** What a grid's measure, layout and render read of its state, beyond its own arrangement's entries. */\nexport type GridState = GridValues & {\n readonly width: LayoutItem[\"width\"]\n readonly height: LayoutItem[\"height\"]\n readonly children: readonly ChildView[]\n}\n\n/** What makes one grid's arrangement from its state: the rest of a grid is this module. */\nexport interface Arranger<S = unknown> {\n /** This grid's own arrangement, for a content box of `box`. */\n arrangement(state: S, box: Size2D): Arrangement\n /** The room each item is measured in — the whole content box, unless the arrangement has cells. */\n itemSpace?(state: S, count: number, space: Size2D): Size2D\n}\n\ntype GridComponent = { readonly key: string; readonly node: abstract new (...args: never[]) => object }\n\nconst GRIDS = new Map<string, { readonly component: GridComponent; readonly arranger: Arranger<never> }>()\n\n/**\n * `component` as a grid: registers its `arranger`, which another grid borrowing\n * its arrangement or morphing into it reads it by, and which {@link isGrid} knows it by.\n */\nexport function define<C extends GridComponent, S>(component: C, arranger: Arranger<S>): C {\n GRIDS.set(component.key, { component, arranger: arranger as Arranger<never> })\n return component\n}\n\n/** Whether `value` is a node of one of the grids {@link define} has seen. */\nexport function isGrid(value: unknown): boolean {\n for (const { component } of GRIDS.values()) if (value instanceof component.node) return true\n return false\n}\n\n/** The grid's measure, layout and render, for `arranger`'s arrangement: spread them into the component. */\nexport function fields<S>(arranger: Arranger<S>) {\n return {\n measure: (measurer: Measurer, s: GridState & S, children: readonly ChildView[]) => measure(measurer, s, children, arranger),\n layout: (box: LayoutBox, s: GridState & S, children: readonly ChildView[]) => layout(box, s, children, arranger),\n render: (ctx: RenderContext, s: GridState & S) => render(ctx, s, arranger),\n }\n}\n\nconst NO_CONTENT: Size2D = { width: 0, height: 0 }\nconst CENTRE = { x: 0, y: 0 }\n\n/** What `measure` found, for `layout` to reuse in the same pass. Keyed by the grid's state, one object per node. */\nconst measured = new WeakMap<object, { space: Size2D; sizes: Size2D[] }>()\n\nexport function measure<S>(measurer: Measurer, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): Size2D {\n const constraints = { maxWidth: measurer.max.width, maxHeight: measurer.max.height }\n const padding = s.padding\n if (children.length === 0) {\n measured.delete(s)\n return flowOps.size(s, constraints, padding, NO_CONTENT)\n }\n const space = flowOps.contentBox(s, constraints, padding)\n const sizes = measureItems(children, space, s, arranger)\n measured.set(s, { space, sizes })\n const grid = { state: s, arranger, children, isSelf: sharesChildren(children) }\n const target = targetSlots(grid, sizes.length, sizes, space, measurer.time.total)\n return flowOps.size(s, constraints, padding, extentOf(target.slots, sizes, focalOf(s, target.arrangement)))\n}\n\nexport function layout<S>(box: LayoutBox, s: GridState & S, children: readonly ChildView[], arranger: Arranger<S>): readonly Placement2D[] {\n const kept = measured.get(s)\n measured.delete(s)\n if (children.length === 0) return []\n const inner = insetsOps.insetBounds(box.width, box.height, s.padding)\n const sizes = kept && kept.sizes.length === children.length && sameSize(kept.space, inner)\n ? kept.sizes\n : measureItems(children, inner, s, arranger)\n const slots = resolve({ state: s, arranger, children, isSelf: sharesChildren(children) }, sizes, inner, box.time.total)\n return slots.map((slot, i) => placement(inner, slot, sizes[i]))\n}\n\n/**\n * A grid whose arrangement has depth is seen through a camera of its own,\n * which paints its items far to near — unless it already sits in a space (an\n * orbit camera, a 3D stage), where its items join that one and its camera.\n */\nexport function render<S>(ctx: RenderContext, s: GridState & S, arranger: Arranger<S>): void {\n // With no items there is nothing to see through a camera.\n const focal = s.children.length === 0 ? 0 : focalOf(s, arrangementOf({ state: s, arranger, children: [], isSelf: () => false }, contentBox(ctx.size, s.padding)))\n if (focal > 0 && !ctx.inSpace) ctx.space(cameraAt(focal))\n else ctx.children()\n}\n\n/** A node's content box: its laid-out size inside its padding. */\nexport function contentBoxOf(grid: Node2D): Size2D {\n const b = grid.layoutBounds\n return contentBox({ width: b.width, height: b.height }, grid.effectivePadding())\n}\n\n// ---- what commands share --------------------------------------------------\n\ntype GridTimeline = Timeline<StaggerArgs, never>\n\n/**\n * Each item's slot in its arrangement as it stands, for a command being built,\n * at the clock commands are built against (the tree stands at time 0 while a\n * timeline compiles): what its stagger is ranked by.\n */\nexport function itemSlots(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Slot[] {\n const grid = commandGrid(timeline, s, children)\n const sizes = children.map((child) => child.size)\n return targetSlots(grid, children.length, sizes, contentBox(timeline.node.size, s.padding), 0).slots\n}\n\n/** Each item's start in a stagger. A random order is seeded by the node's id, so it never changes between builds. */\nexport function ranks(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[], order: StaggerOrder | undefined): number[] {\n return staggerRanks(order ?? \"index\", itemSlots(timeline, s, children), hashSeed(timeline.node.id))\n}\n\n/**\n * Write `changes` to the arrangement and move each item from its slot in the\n * one being left to its slot in the new one, staggered.\n */\nexport function transitionTo(\n timeline: GridTimeline,\n s: GridValues,\n children: readonly ChildView[],\n changes: Record<string, unknown>,\n stagger = TRANSITION_STAGGER,\n): Piece {\n const from = snapshot(timeline, s, children)\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n const order = ranks(timeline, s, children, timeline.args.staggerOrder)\n const spread = timeline.args.stagger ?? stagger\n return timeline.animate((t) => {\n if (t >= 1) return { ...changes, transition: null, transitionSource: \"\" } as never\n const mix = order.map((rank) => ease(staggerProgress(rank, t, spread)))\n return { ...changes, transition: { from, mix }, transitionSource: from.source } as never\n }, { eased: false })\n}\n\n/** Emphasise the items `isFocus` picks and push the rest back. */\nexport function focusOn(\n timeline: Timeline<object, never>,\n s: GridValues,\n isFocus: (item: number) => boolean,\n count: number,\n dim: number,\n grow: number,\n): Piece {\n const from = s.focusState\n const target = Array.from({ length: count }, (_, i) => (isFocus(i) ? 1 : -1))\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n return timeline.animate((t) => {\n const e = ease(t)\n return {\n focusState: {\n dim: lerp(from?.dim ?? dim, dim, e),\n grow: lerp(from?.grow ?? grow, grow, e),\n values: target.map((v, i) => lerp(from?.values[i] ?? 0, v, e)),\n },\n } as never\n }, { eased: false })\n}\n\n// What the commands are typed against: the shared state, and the padding every node has.\nconst GRID_STATE = { ...state, padding: Types.insets }\n\nexport const commands = commandsFor(GRID_STATE, {\n /**\n * Bring the items in, one after another. Every item starts hidden, so place\n * it where the grid enters — or after a `conceal`.\n */\n reveal: {\n args: { style: Types.oneOf(REVEAL_STYLES, { default: \"scale\" }), ...staggerArgs(0.5) },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const ease = timeline.easing ?? (style === \"scale\" || style === \"flip\" ? easeOut(\"back\") : easeOut(\"cubic\"))\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.5\n return timeline.animate((t) => {\n if (t >= 1) return { revealState: null }\n return { revealState: { style, values: order.map((rank) => ease(staggerProgress(rank, t, stagger))) } }\n }, { eased: false })\n },\n },\n /** Take the items out, one after another — `reveal` in reverse. They stay hidden after. */\n conceal: {\n args: { style: Types.oneOf(REVEAL_STYLES, { default: \"scale\" }), ...staggerArgs(0.5) },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const ease = timeline.easing ?? (style === \"scale\" || style === \"flip\" ? easeIn(\"back\") : easeInOut(\"cubic\"))\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.5\n const from = s.revealState?.values\n return timeline.animate((t) => ({\n revealState: {\n style,\n values: order.map((rank, i) => (from?.[i] ?? 1) * (1 - ease(staggerProgress(rank, t, stagger)))),\n },\n }), { eased: false })\n },\n },\n /** Send a ripple through the items that swells each in turn and settles back. */\n wave: {\n args: {\n style: Types.oneOf(WAVE_STYLES, { default: \"scale\" }),\n amount: Types.number(0.3, { min: 0, max: 2, step: 0.05 }),\n ...staggerArgs(0.7),\n },\n run: (timeline, s, children) => {\n const style = timeline.args.style ?? \"scale\"\n const amount = timeline.args.amount ?? 0.3\n const ease = timeline.easing ?? easeInOut(\"sine\")\n const order = ranks(timeline as never, s, children, timeline.args.staggerOrder)\n const stagger = timeline.args.stagger ?? 0.7\n return timeline.animate((t) => {\n if (t >= 1) return { waveState: null }\n return { waveState: { style, amount, values: order.map((rank) => Math.sin(Math.PI * ease(staggerProgress(rank, t, stagger)))) } }\n }, { eased: false })\n },\n },\n /** Bring one item (by its place in the layers, from 0) forward and push the rest back. */\n focus: {\n args: {\n item: Types.number(0, { min: 0, step: 1 }),\n dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),\n grow: Types.number(0.15, { min: 0, max: 1, step: 0.05 }),\n },\n run: (timeline, s, children) => {\n const item = Math.round(timeline.args.item ?? 0)\n return focusOn(timeline as never, s, (i) => i === item, children.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\n },\n },\n /** Bring every item back to even. */\n unfocus: (timeline, s) => {\n const from = s.focusState\n const ease = timeline.easing ?? easeInOut(\"cubic\")\n return timeline.animate((t) => {\n if (t >= 1 || !from) return { focusState: null }\n const k = 1 - ease(t)\n return { focusState: { ...from, values: from.values.map((v) => v * k) } }\n }, { eased: false })\n },\n /** Gather the items toward the centre (`0`), back to the arrangement (`1`), or push them apart. */\n spreadTo: {\n args: { spread: Types.number(1, { min: 0, max: 3, step: 0.05 }) },\n run: (timeline) => timeline.tween({ spread: timeline.args.spread ?? 1 }),\n },\n /** Send every item to a random slot. The same `seed` always deals the same way. */\n shuffle: {\n args: { seed: Types.number(1, { min: 0, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => {\n const current = normalizeOrder(s.order, children.length)\n let next = shuffled(current, timeline.args.seed ?? 1)\n // A shuffle that deals everything back where it was would look like nothing happened.\n if (next.length > 1 && next.every((item, k) => item === current[k])) next = [...next.slice(1), next[0]]\n return transitionTo(timeline as never, s, children, { order: next })\n },\n },\n /** Two items trade places, by their place in the layers. */\n swap: {\n args: {\n first: Types.number(0, { min: 0, step: 1 }),\n second: Types.number(1, { min: 0, step: 1 }),\n ...staggerArgs(0),\n },\n run: (timeline, s, children) => {\n const order = normalizeOrder(s.order, children.length)\n const a = order.indexOf(Math.round(timeline.args.first ?? 0))\n const b = order.indexOf(Math.round(timeline.args.second ?? 1))\n if (a >= 0 && b >= 0) [order[a], order[b]] = [order[b], order[a]]\n return transitionTo(timeline as never, s, children, { order }, 0)\n },\n },\n /** Move the items into a new order — a list of layer indices, first slot first, like `\"2, 0, 1\"`. */\n reorder: {\n args: { order: Types.text(\"\"), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => {\n const order = normalizeOrder(parseOrder(timeline.args.order), children.length)\n return transitionTo(timeline as never, s, children, { order })\n },\n },\n /**\n * Move every item into another grid's arrangement — a grid into a ring, a ring\n * onto a sphere — and keep following it. An empty `target` morphs back to\n * this grid's own.\n */\n morphInto: {\n args: { target: nodeRefArg(ITEM_GRID_TYPES), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => transitionTo(timeline as never, s, children, { arrangeLike: timeline.args.target ?? \"\" }),\n },\n})\n\n// ---- the one pass ------------------------------------------------------------\n\ninterface Grid {\n readonly state: GridValues\n readonly arranger: Arranger<never>\n readonly children: readonly ChildView[]\n /** Whether a view is this grid itself, which borrows nothing from itself. */\n readonly isSelf: (view: NodeView) => boolean\n}\n\nfunction arrangerOf(key: string): Arranger<never> {\n const grid = GRIDS.get(key)\n if (!grid) throw new Error(`\"${key}\" is no grid: pass its component through ItemGrid.define.`)\n return grid.arranger\n}\n\n/** A grid `view` names, when it is one this kit can arrange and not the reader itself. */\nfunction gridIn(view: NodeView | null | undefined, grid: Grid): { view: NodeView; arranger: Arranger<never> } | null {\n if (!view) return null\n const found = GRIDS.get(view.key)\n if (!found || grid.isSelf(view)) return null\n return { view, arranger: found.arranger }\n}\n\n/** In layout, a view is this grid when it holds the same children: a child has one parent. */\nfunction sharesChildren(children: readonly ChildView[]): (view: NodeView) => boolean {\n return (view) => {\n if (children.length === 0) return false\n const theirs = (view.state as { readonly children?: readonly ChildView[] }).children\n return theirs?.[0] === children[0]\n }\n}\n\nfunction commandGrid(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): Grid {\n return { state: s, arranger: arrangerOf(timeline.node.key), children, isSelf: (view) => view.id === timeline.node.id }\n}\n\nfunction snapshot(timeline: Timeline<object, never>, s: GridValues, children: readonly ChildView[]): GridSnapshot {\n const grid = commandGrid(timeline, s, children)\n const source = gridIn(s.arrangeLike, grid)\n return {\n arrangement: source\n ? source.arranger.arrangement(source.view.state as never, viewBox(source.view))\n : grid.arranger.arrangement(s as never, contentBox(timeline.node.size, s.padding)),\n source: source?.view.id ?? \"\",\n order: normalizeOrder(s.order, children.length),\n spread: s.spread,\n }\n}\n\nfunction measureItems(children: readonly ChildView[], space: Size2D, s: unknown, arranger: Arranger<never>): Size2D[] {\n const sizes = children.map((child) => child.measure(space))\n const cell = arranger.itemSpace ? arranger.itemSpace(s as never, children.length, space) : space\n if (cell === space) return sizes\n return children.map((child) => child.measure(cell))\n}\n\n/** The arrangement the grid is heading for: the one it borrows, or its own. */\nfunction arrangementOf(grid: Grid, box: Size2D): Arrangement {\n const source = gridIn(grid.state.arrangeLike, grid)\n return source ? source.arranger.arrangement(source.view.state as never, viewBox(source.view)) : grid.arranger.arrangement(grid.state as never, box)\n}\n\n/** Where each item sits in the arrangement it is heading for, before any transition or effect. */\nfunction targetSlots(grid: Grid, count: number, sizes: readonly Size2D[], box: Size2D, time: number): { slots: Slot[]; arrangement: Arrangement } {\n const s = grid.state\n const source = gridIn(s.arrangeLike, grid)\n const sourceBox = source ? viewBox(source.view) : box\n const arrangement = source ? source.arranger.arrangement(source.view.state as never, sourceBox) : grid.arranger.arrangement(s as never, box)\n let slots = slotsOf(arrangement, { count, sizes, box: sourceBox, time })\n if (source) slots = inFrame(source.view.frame, slots)\n const slotOf = slotOfItem(normalizeOrder(s.order, count))\n return { slots: slotOf.map((k) => spreadSlot(slots[k], s.spread)), arrangement }\n}\n\n/** Each item's final slot this frame: the target, blended from any transition, with its effects on. */\nfunction resolve(grid: Grid, sizes: readonly Size2D[], box: Size2D, time: number): Slot[] {\n const s = grid.state\n const count = sizes.length\n const slots = targetSlots(grid, count, sizes, box, time).slots\n const transition = s.transition\n if (transition) {\n const { from } = transition\n const named = from.source ? s.transitionSource : null\n const source = named && named.id === from.source && GRIDS.has(named.key) ? named : null\n const self = source !== null && grid.isSelf(source)\n const fromBox = source && !self ? viewBox(source) : box\n let leaving = slotsOf(from.arrangement, { count, sizes, box: fromBox, time })\n if (source && !self) leaving = inFrame(source.frame, leaving)\n const slotOf = slotOfItem(normalizeOrder(from.order, count))\n for (let i = 0; i < count; i++) {\n slots[i] = blendSlot(spreadSlot(leaving[slotOf[i]], from.spread), slots[i], transition.mix[i] ?? 1)\n }\n }\n const reveal = s.revealState\n const wave = s.waveState\n const focus = s.focusState\n if (reveal || wave || focus) {\n for (let i = 0; i < count; i++) applyItemEffects(slots[i], i, sizes[i], reveal, wave, focus)\n }\n return slots\n}\n\n/** The camera distance the grid is seen through: the target's, or, while a morph runs, the one it is leaving. */\nfunction focalOf(s: GridValues, target: Arrangement): number {\n // A morph into or out of depth keeps the camera for its whole length.\n return focalLengthOf(target) || (s.transition ? focalLengthOf(s.transition.from.arrangement) : 0)\n}\n\nfunction cameraAt(focal: number): SpaceCamera {\n return {\n perspective: focal,\n orbit: 0,\n elevation: 0,\n dolly: 0,\n lookAt: CENTRE,\n zoom: 1,\n heading: 0,\n viewportX: 0,\n viewportY: 0,\n }\n}\n\n/** A slot as a child's placement: its box centred on the slot, and the slot's transform when it has one. */\nfunction placement(inner: { x: number; y: number }, s: Slot, size: Size2D): Placement2D {\n const box = { x: inner.x + s.x, y: s.y - inner.y, width: size.width, height: size.height }\n if (s.rotation === 0 && s.scale === 1 && s.rotationX === 0 && s.rotationY === 0 && s.depth === 0 && s.opacity === 1) return box\n return {\n ...box,\n rotation: s.rotation,\n scale: s.scale,\n rotationX: s.rotationX,\n rotationY: s.rotationY,\n depth: s.depth,\n opacity: s.opacity,\n }\n}\n\n/** `slots`, laid out in another grid's frame, moved into this grid's. */\nfunction inFrame(frame: NodeFrame, slots: Slot[]): Slot[] {\n return slots.map((s) => {\n const p = rotateClockwise(s.x * frame.scale, s.y * frame.scale, frame.rotation)\n return {\n ...s,\n x: frame.x + p.x,\n y: frame.y + p.y,\n depth: s.depth * frame.scale,\n rotation: s.rotation + frame.rotation,\n scale: s.scale * frame.scale,\n }\n })\n}\n\nfunction viewBox(view: NodeView): Size2D {\n return contentBox(view.size, (view.state as { readonly padding: InsetsResolved }).padding)\n}\n\n/** A box of `size` inside `padding`: what a command reads as its grid's content box from `timeline.node.size`. */\nexport function contentBox(size: Size2D, padding: InsetsResolved): Size2D {\n const inner = insetsOps.insetBounds(size.width, size.height, padding)\n return { width: inner.width, height: inner.height }\n}\n\n/** The box, centred on the grid, that holds every item where its slot puts it. */\nfunction extentOf(slots: readonly Slot[], sizes: readonly Size2D[], focal: number): Size2D {\n let halfWidth = 0\n let halfHeight = 0\n for (let i = 0; i < slots.length; i++) {\n const s = slots[i]\n const size = sizes[i]\n const rad = (s.rotation * Math.PI) / 180\n const cos = Math.abs(Math.cos(rad))\n const sin = Math.abs(Math.sin(rad))\n // What the camera does to a slot at depth, so a sphere hugs its front.\n const lens = focal > 0 && focal - s.depth > 1 ? focal / (focal - s.depth) : 1\n const w = ((size.width * cos + size.height * sin) / 2) * s.scale * lens\n const h = ((size.width * sin + size.height * cos) / 2) * s.scale * lens\n halfWidth = Math.max(halfWidth, Math.abs(s.x) * lens + w)\n halfHeight = Math.max(halfHeight, Math.abs(s.y) * lens + h)\n }\n return { width: halfWidth * 2, height: halfHeight * 2 }\n}\n\nfunction rotateClockwise(x: number, y: number, degrees: number): { x: number; y: number } {\n if (degrees === 0) return { x, y }\n const rad = (degrees * Math.PI) / 180\n const cos = Math.cos(rad)\n const sin = Math.sin(rad)\n return { x: x * cos + y * sin, y: -x * sin + y * cos }\n}\n\nfunction sameSize(a: Size2D, b: Size2D): boolean {\n return Math.abs(a.width - b.width) < 1e-6 && Math.abs(a.height - b.height) < 1e-6\n}\n\nfunction lerp(a: number, b: number, t: number): number {\n return a + (b - a) * t\n}\n", "export * from \"./slots\"\nexport * from \"./stagger\"\nexport * from \"./item-effects\"\nexport * from \"./order\"\nexport * from \"./random\"\nexport * as ItemGrid from \"./item-grid\"\nexport {\n contentBoxOf,\n ITEM_GRID_TYPES,\n staggerArgs,\n TRANSITION_STAGGER,\n type GridSnapshot,\n type GridTransition,\n type StaggerArgs,\n} from \"./item-grid\"\n\n// Once this kit's own; kept on its barrel for whoever imports them from it.\nexport { findNode2D, frameIn } from \"@motionscript/sdk\"\n"],
|
|
5
|
+
"mappings": "6FAAA,OAAS,WAAAA,OAAgD,oBC4CnD,SAAUC,EAAKC,EAAWC,EAAWC,EAAc,CACvD,MAAO,CAAE,EAAAF,EAAG,EAAAC,EAAG,M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", "meta", "blendSlot", "a", "b", "t", "mix", "p", "q", "spreadSlot", "s", "spread", "largest", "sizes", "width", "height", "size", "PATH_SPACINGS", "SAMPLERS", "SAMPLER_CACHE", "measured", "path", "hit", "contours", "pathOps", "entry", "pathSlots", "arrangement", "input", "count", "sampler", "closed", "length", "a", "clamp01", "b", "start", "span", "loops", "offset", "place", "rad", "cos", "sin", "slots", "k", "u", "visible", "at", "s", "slot", "flip", "px", "py", "v", "RADIAL_DIRECTIONS", "radialAngles", "arrangement", "count", "time", "sweep", "closing", "step", "sign", "start", "angles", "k", "radialSlots", "input", "angle", "rad", "slot", "radialTurnToTop", "index", "wrapDegrees", "degrees", "wrapped", "FILL_DIRECTIONS", "CELL_MODES", "LINE_ALIGNS", "rectangularShape", "arrangement", "count", "columns", "rows", "rectangularCell", "sizes", "box", "largest", "rectangularSlots", "input", "byColumn", "lines", "perLine", "cell", "pitchX", "pitchY", "lastLine", "lastCount", "shortBy", "lead", "shiftX", "shiftY", "slots", "i", "line", "along", "row", "column", "rowIndex", "columnIndex", "x", "y", "slot", "SPHERE_FACINGS", "SPHERE_AXES", "GOLDEN_ANGLE", "DEG", "fibonacciPoint", "k", "count", "y", "r", "theta", "orient", "p", "yaw", "pitch", "roll", "x0", "y0", "z0", "ya", "pa", "ra", "x1", "z1", "y2", "z2", "sphereSlots", "arrangement", "input", "radius", "outward", "slots", "q", "nx", "ny", "nz", "s", "slot", "facesAway", "normal", "focal", "sphereFaceForward", "index", "x", "z", "PATH_TEMPLATES", "DRAWN", "DRAWN_CACHE", "templatePath", "template", "box", "key", "hit", "path", "drawTemplate", "w", "h", "rx", "ry", "closed", "points", "i", "angle", "r", "sample", "t", "a", "x", "y", "d", "open", "ellipse", "k", "steps", "at", "slotsOf", "arrangement", "input", "rectangularSlots", "radialSlots", "pathSlots", "sphereSlots", "focalLengthOf", "seededRandom", "seed", "a", "t", "shuffled", "values", "out", "random", "i", "j", "hashSeed", "text", "h", "STAGGER_ORDERS", "MAX_STAGGER", "staggerRanks", "order", "slots", "seed", "n", "keys", "keysOf", "min", "max", "key", "range", "staggerProgress", "rank", "t", "stagger", "s", "p", "_", "i", "sequence", "shuffled", "item", "clockAngle", "angle", "REVEAL_STYLES", "WAVE_STYLES", "applyItemEffects", "s", "i", "size", "reveal", "wave", "focus", "applyReveal", "applyWave", "applyFocus", "style", "v", "shown", "clamp01", "w", "f", "normalizeOrder", "order", "count", "out", "taken", "entry", "item", "slotOfItem", "slots", "slot", "parseOrder", "value", "part", "item_grid_exports", "__export", "ITEM_GRID_TYPES", "TRANSITION_STAGGER", "commands", "contentBox", "contentBoxOf", "defaults", "define", "fields", "focusOn", "hinted", "isGrid", "itemSlots", "layout", "measure", "nodeRef", "nodeRefArg", "ranks", "render", "staggerArgs", "state", "transitionTo", "commandsFor", "easeIn", "easeInOut", "easeOut", "flowOps", "insetsOps", "Types", "ITEM_GRID_TYPES", "TRANSITION_STAGGER", "nodeRef", "types", "described", "Types", "staggerArgs", "fallback", "STAGGER_ORDERS", "hinted", "hint", "options", "nodeRefArg", "state", "defaults", "GRIDS", "define", "component", "arranger", "isGrid", "value", "fields", "measurer", "s", "children", "measure", "box", "layout", "ctx", "render", "NO_CONTENT", "CENTRE", "measured", "constraints", "padding", "flowOps", "space", "sizes", "measureItems", "grid", "sharesChildren", "target", "targetSlots", "extentOf", "focalOf", "kept", "inner", "insetsOps", "sameSize", "resolve", "slot", "i", "placement", "focal", "arrangementOf", "contentBox", "cameraAt", "contentBoxOf", "b", "itemSlots", "timeline", "commandGrid", "child", "ranks", "order", "staggerRanks", "hashSeed", "transitionTo", "changes", "stagger", "from", "snapshot", "ease", "easeInOut", "spread", "t", "mix", "rank", "staggerProgress", "focusOn", "isFocus", "count", "dim", "grow", "_", "e", "lerp", "v", "GRID_STATE", "commands", "commandsFor", "REVEAL_STYLES", "style", "easeOut", "easeIn", "WAVE_STYLES", "amount", "item", "k", "current", "normalizeOrder", "next", "shuffled", "a", "parseOrder", "arrangerOf", "key", "gridIn", "view", "found", "source", "viewBox", "cell", "time", "sourceBox", "arrangement", "slots", "slotsOf", "inFrame", "slotOfItem", "spreadSlot", "transition", "named", "self", "fromBox", "leaving", "slotOf", "blendSlot", "reveal", "wave", "focus", "applyItemEffects", "focalLengthOf", "size", "frame", "p", "rotateClockwise", "halfWidth", "halfHeight", "rad", "cos", "sin", "lens", "w", "h", "x", "y", "degrees", "findNode2D", "frameIn"]
|
|
7
|
+
}
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as Gt,B as Tt,C as bt,D as Ot,E as At,F as yt,G as It,H as Et,I as kt,J as Lt,K as l,L as Pt,M as Rt,N as Nt,O as g,P as h,Q as Dt,R as n,S as _t,T as Mt,a as it,b as ct,c as dt,d as ut,e as T,f as pt,g as b,h as mt,i as lt,j as O,k as w,l as A,m as y,n as I,o as gt,p as S,q as ht,r as E,s as k,t as ft,u as wt,v as St,w as L,x as P,y as R,z as xt}from"./chunks/chunk-
|
|
1
|
+
import{A as Gt,B as Tt,C as bt,D as Ot,E as At,F as yt,G as It,H as Et,I as kt,J as Lt,K as l,L as Pt,M as Rt,N as Nt,O as g,P as h,Q as Dt,R as n,S as _t,T as Mt,a as it,b as ct,c as dt,d as ut,e as T,f as pt,g as b,h as mt,i as lt,j as O,k as w,l as A,m as y,n as I,o as gt,p as S,q as ht,r as E,s as k,t as ft,u as wt,v as St,w as L,x as P,y as R,z as xt}from"./chunks/chunk-TYNFMZ3D.js";import{component2d as j,easeInOut as q,Types as c}from"@motionscript/sdk";var J={columns:c.number(3,{min:1,step:1}),fillDirection:c.oneOf(A,{default:"row"}),cellMode:c.oneOf(y,{default:"fit"}),cellWidth:c.number(120,{min:0,step:1}),cellHeight:c.number(120,{min:0,step:1}),columnGap:c.number(24,{step:1}),rowGap:c.number(24,{step:1}),lastLineAlign:c.oneOf(I,{default:"start"}),rowOffset:c.number(0,{min:-1,max:1,step:.05}),columnOffset:c.number(0,{min:-1,max:1,step:.05})};function x(t){return{kind:"rectangular",columns:t.columns,fillDirection:t.fillDirection,cellMode:t.cellMode,cellWidth:t.cellWidth,cellHeight:t.cellHeight,columnGap:t.columnGap,rowGap:t.rowGap,lastLineAlign:t.lastLineAlign,rowOffset:t.rowOffset,columnOffset:t.columnOffset}}var N={arrangement:x,itemSpace:(t,e,r)=>t.cellMode==="fit"?r:S(x(t),e,[],r)},D={dim:c.number(.7,{min:0,max:1,step:.05}),grow:n.hinted(.1,{min:0,max:1,step:.05})},_=n.define(j({key:"rectangularGrid",state:{...n.state,...J},defaults:n.defaults,commands:{...n.commands,columnsTo:{args:{columns:n.hinted(4,{min:1,step:1}),...h(g)},run:(t,e,r)=>{let a=Math.max(1,Math.round(t.args.columns??e.columns));return n.transitionTo(t,e,r,{columns:a})}},gapTo:{args:{columnGap:n.hinted(48),rowGap:n.hinted(48)},run:t=>{let e={};return t.args.columnGap!==void 0&&(e.columnGap=t.args.columnGap),t.args.rowGap!==void 0&&(e.rowGap=t.args.rowGap),t.tween(e)}},cellSizeTo:{args:{cellWidth:n.hinted(160,{min:0}),cellHeight:n.hinted(160,{min:0})},easing:q("cubic"),run:(t,e,r)=>{let a=r.map(m=>m.size),o=n.contentBox(t.node.size,e.padding),s=S(x(e),a.length,a,o),i=t.args.cellWidth??s.width,Z=t.args.cellHeight??s.height;return t.animate(m=>({cellMode:"fixed",cellWidth:s.width+(i-s.width)*m,cellHeight:s.height+(Z-s.height)*m}))}},focusRow:{args:{row:c.number(0,{min:0,step:1}),...D},run:(t,e,r)=>{let a=n.itemSlots(t,e,r),o=Math.round(t.args.row??0),s=i=>a[i]?.meta.kind==="rectangular"&&a[i].meta.row===o;return n.focusOn(t,e,s,a.length,t.args.dim??.7,t.args.grow??.15)}},focusColumn:{args:{column:c.number(0,{min:0,step:1}),...D},run:(t,e,r)=>{let a=n.itemSlots(t,e,r),o=Math.round(t.args.column??0),s=i=>a[i]?.meta.kind==="rectangular"&&a[i].meta.column===o;return n.focusOn(t,e,s,a.length,t.args.dim??.7,t.args.grow??.15)}}},...n.fields(N)}),N);import{component2d as K,Types as p}from"@motionscript/sdk";var Q={radius:p.number(200,{min:0,step:1}),startAngle:p.number(0,{step:1,unit:"\xB0"}),sweep:p.number(360,{min:-360,max:360,step:1,unit:"\xB0"}),direction:p.oneOf(b,{default:"clockwise"}),rotateItems:!1,spinSpeed:p.number(0,{step:1,unit:"\xB0/s"})};function H(t){return{kind:"radial",radius:t.radius,startAngle:t.startAngle,sweep:t.sweep,direction:t.direction,rotateItems:t.rotateItems,spinSpeed:t.spinSpeed}}var M={arrangement:H},C=n.define(K({key:"radialGrid",state:{...n.state,...Q},defaults:n.defaults,commands:{...n.commands,spin:{args:{degrees:p.number(360,{step:15,unit:"\xB0"})},run:(t,e)=>t.tween({startAngle:e.startAngle+(t.args.degrees??360)})},turnTo:{args:{item:p.number(0,{min:0,step:1})},run:(t,e,r)=>{let a=r.length,o=l(e.order,a).indexOf(Math.round(t.args.item??0)),s=o<0?0:O(H(e),a,o);return t.tween({startAngle:e.startAngle+s})}},radiusTo:{args:{radius:n.hinted(280,{min:0})},run:(t,e)=>t.tween({radius:t.args.radius??e.radius})},sweepTo:{args:{sweep:n.hinted(360,{min:-360,max:360,unit:"\xB0"})},run:(t,e)=>t.tween({sweep:t.args.sweep??e.sweep})}},...n.fields(M)}),M);import{component2d as V,pathOps as f,Types as u}from"@motionscript/sdk";var z=[...P,"custom"],$={shape:u.oneOf(z,{default:"circle"}),path:u.path,pathNode:n.nodeRef(["path"]),spacing:u.oneOf(T,{default:"distribute"}),spacingDistance:u.number(80,{min:0,step:1}),offset:u.number(0,{step:.01}),flowSpeed:u.number(0,{step:.01,unit:"/s"}),trimStart:u.number(0,{min:0,max:1,step:.01}),trimEnd:u.number(1,{min:0,max:1,step:.01}),alignToPath:!0},G={originX:0,originY:0,x:0,y:0,rotation:0,scale:1},v={width:640,height:400},F={arrangement:(t,e)=>{let{path:r,placement:a}=tt(t,e);return{kind:"path",path:r,placement:a,spacing:t.spacing,spacingDistance:t.spacingDistance,offset:t.offset,flowSpeed:t.flowSpeed,trimStart:t.trimStart,trimEnd:t.trimEnd,alignToPath:t.alignToPath}}},Y=n.define(V({key:"pathGrid",state:{...n.state,...$},defaults:{...v},commands:{...n.commands,flow:{args:{loops:u.number(1,{step:.25})},run:(t,e)=>t.tween({offset:e.offset+(t.args.loops??1)})},trimTo:{args:{trimStart:n.hinted(.25,{min:0,max:1,step:.01}),trimEnd:n.hinted(.75,{min:0,max:1,step:.01})},run:(t,e)=>t.tween({trimStart:t.args.trimStart??e.trimStart,trimEnd:t.args.trimEnd??e.trimEnd})},setPath:{args:{shape:n.hinted("heart",{kind:"enum",options:z}),pathNode:n.nodeRefArg(["path"]),...h(g)},run:(t,e,r)=>{let a=t.args.pathNode??"",o=a?{pathNode:a}:{shape:t.args.shape??e.shape,pathNode:""};return n.transitionTo(t,e,r,o)}}},...n.fields(F)}),F);function tt(t,e){let r=t.pathNode;if(r?.key==="path")return{path:et(r),placement:{...G,...r.frame}};let a=r?.key==="facePath"?W(r):void 0,o=a!==void 0?f.bounds(a):null;if(r&&a!==void 0&&o)return{path:a,placement:{originX:(o.minX+o.maxX)/2,originY:(o.minY+o.maxY)/2,...r.frame}};if(t.shape==="custom"){let i=f.bounds(t.path);if(i)return{path:t.path,placement:{...G,originX:(i.minX+i.maxX)/2,originY:(i.minY+i.maxY)/2,flipY:!0}}}let s=t.shape==="custom"?"circle":t.shape;return{path:R(s,e),placement:G}}function W(t){return t.state.data}var X=new WeakMap;function et(t){let e=W(t),{width:r,height:a}=t.size,o=X.get(t);if(o&&o.data===e&&o.width===r&&o.height===a)return o.path;let s=f.anchorCommands(f.anchors(e),i=>({x:i.x*r,y:-i.y*a}));return X.set(t,{data:e,width:r,height:a,path:s}),s}import{component2d as nt,Types as d}from"@motionscript/sdk";var rt={radius:d.number(220,{min:0,step:1}),yaw:d.number(0,{step:1,unit:"\xB0"}),pitch:d.number(0,{step:1,unit:"\xB0"}),roll:d.number(0,{step:1,unit:"\xB0"}),facing:d.oneOf(E,{default:"outward"}),focalLength:d.number(900,{min:100,step:10}),depthFade:d.number(.5,{min:0,max:1,step:.05}),cullBackfaces:!1,spinSpeed:d.number(0,{step:1,unit:"\xB0/s"})};function at(t){return{kind:"sphere",radius:t.radius,yaw:t.yaw,pitch:t.pitch,roll:t.roll,facing:t.facing,focalLength:t.focalLength,depthFade:t.depthFade,cullBackfaces:t.cullBackfaces,spinSpeed:t.spinSpeed}}var B={arrangement:at},ot={x:"pitch",y:"yaw",z:"roll"},U=n.define(nt({key:"sphereGrid",state:{...n.state,...rt},defaults:n.defaults,commands:{...n.commands,spin:{args:{axis:d.oneOf(k,{default:"y"}),degrees:d.number(360,{step:15,unit:"\xB0"})},run:(t,e)=>{let r=ot[t.args.axis??"y"]??"yaw";return t.tween({[r]:e[r]+(t.args.degrees??360)})}},orientTo:{args:{yaw:n.hinted(45,{unit:"\xB0"}),pitch:n.hinted(20,{unit:"\xB0"}),roll:n.hinted(0,{unit:"\xB0"})},run:(t,e)=>t.tween({yaw:t.args.yaw??e.yaw,pitch:t.args.pitch??e.pitch,roll:t.args.roll??e.roll})},turnTo:{args:{item:d.number(0,{min:0,step:1})},run:(t,e,r)=>{let a=r.length,o=l(e.order,a).indexOf(Math.round(t.args.item??0));if(o<0)return t.tween({});let s=L(a,o);return t.tween({yaw:e.yaw+w(s.yaw-e.yaw),pitch:e.pitch+w(s.pitch-e.pitch),roll:0})}},radiusTo:{args:{radius:n.hinted(300,{min:0})},run:(t,e)=>t.tween({radius:t.args.radius??e.radius})},focalLengthTo:{args:{focalLength:n.hinted(600,{min:100})},run:(t,e)=>t.tween({focalLength:t.args.focalLength??e.focalLength})}},...n.fields(B)}),B);var st=[_,C,Y,U];export{y as CELL_MODES,A as FILL_DIRECTIONS,Nt as ITEM_GRID_TYPES,n as ItemGrid,I as LINE_ALIGNS,st as NODES,z as PATH_GRID_SHAPES,T as PATH_SPACINGS,P as PATH_TEMPLATES,Y as PathGrid,b as RADIAL_DIRECTIONS,Et as REVEAL_STYLES,C as RadialGrid,_ as RectangularGrid,k as SPHERE_AXES,E as SPHERE_FACINGS,At as STAGGER_ORDERS,U as SphereGrid,g as TRANSITION_STAGGER,kt as WAVE_STYLES,Lt as applyItemEffects,ct as blendSlot,Dt as contentBoxOf,ft as fibonacciPoint,_t as findNode2D,Gt as focalLengthOf,Mt as frameIn,Ot as hashSeed,ut as largest,l as normalizeOrder,wt as orient,Rt as parseOrder,pt as pathSlots,mt as radialAngles,lt as radialSlots,O as radialTurnToTop,S as rectangularCell,gt as rectangularShape,ht as rectangularSlots,Tt as seededRandom,bt as shuffled,it as slot,Pt as slotOfItem,xt as slotsOf,L as sphereFaceForward,St as sphereSlots,dt as spreadSlot,h as staggerArgs,It as staggerProgress,yt as staggerRanks,R as templatePath,w as wrapDegrees};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|