@motionscript/grids 0.0.0-stage → 0.1.0-alpha.10
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 +87 -0
- package/LICENSE +201 -0
- package/NOTICE +49 -0
- package/README.md +117 -2
- package/dist/browser/chunks/chunk-TYNFMZ3D.js +2 -0
- package/dist/browser/chunks/chunk-TYNFMZ3D.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/kit.js +2 -0
- package/dist/browser/kit.js.map +7 -0
- package/dist/browser/manifest.json +13 -0
- package/dist/engine.d.ts +13 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +13 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/index.d.ts +9 -0
- package/dist/kit/index.d.ts.map +1 -0
- package/dist/kit/index.js +10 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/kit/item-effects.d.ts +37 -0
- package/dist/kit/item-effects.d.ts.map +1 -0
- package/dist/kit/item-effects.js +76 -0
- package/dist/kit/item-effects.js.map +1 -0
- package/dist/kit/item-grid.d.ts +240 -0
- package/dist/kit/item-grid.d.ts.map +1 -0
- package/dist/kit/item-grid.js +492 -0
- package/dist/kit/item-grid.js.map +1 -0
- package/dist/kit/order.d.ts +13 -0
- package/dist/kit/order.d.ts.map +1 -0
- package/dist/kit/order.js +43 -0
- package/dist/kit/order.js.map +1 -0
- package/dist/kit/random.d.ts +7 -0
- package/dist/kit/random.d.ts.map +1 -0
- package/dist/kit/random.js +29 -0
- package/dist/kit/random.js.map +1 -0
- package/dist/kit/slots/index.d.ts +22 -0
- package/dist/kit/slots/index.d.ts.map +1 -0
- package/dist/kit/slots/index.js +28 -0
- package/dist/kit/slots/index.js.map +1 -0
- package/dist/kit/slots/path-templates.d.ts +15 -0
- package/dist/kit/slots/path-templates.d.ts.map +1 -0
- package/dist/kit/slots/path-templates.js +113 -0
- package/dist/kit/slots/path-templates.js.map +1 -0
- package/dist/kit/slots/path.d.ts +45 -0
- package/dist/kit/slots/path.d.ts.map +1 -0
- package/dist/kit/slots/path.js +87 -0
- package/dist/kit/slots/path.js.map +1 -0
- package/dist/kit/slots/radial.d.ts +30 -0
- package/dist/kit/slots/radial.d.ts.map +1 -0
- package/dist/kit/slots/radial.js +45 -0
- package/dist/kit/slots/radial.js.map +1 -0
- package/dist/kit/slots/rectangular.d.ts +42 -0
- package/dist/kit/slots/rectangular.d.ts.map +1 -0
- package/dist/kit/slots/rectangular.js +79 -0
- package/dist/kit/slots/rectangular.js.map +1 -0
- package/dist/kit/slots/slot.d.ts +62 -0
- package/dist/kit/slots/slot.d.ts.map +1 -0
- package/dist/kit/slots/slot.js +41 -0
- package/dist/kit/slots/slot.js.map +1 -0
- package/dist/kit/slots/sphere.d.ts +36 -0
- package/dist/kit/slots/sphere.d.ts.map +1 -0
- package/dist/kit/slots/sphere.js +68 -0
- package/dist/kit/slots/sphere.js.map +1 -0
- package/dist/kit/stagger.d.ts +24 -0
- package/dist/kit/stagger.d.ts.map +1 -0
- package/dist/kit/stagger.js +90 -0
- package/dist/kit/stagger.js.map +1 -0
- package/dist/nodes.d.ts +20 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +11 -0
- package/dist/nodes.js.map +1 -0
- package/dist/path-grid/index.d.ts +2 -0
- package/dist/path-grid/index.d.ts.map +1 -0
- package/dist/path-grid/index.js +2 -0
- package/dist/path-grid/index.js.map +1 -0
- package/dist/path-grid/path-grid.d.ts +196 -0
- package/dist/path-grid/path-grid.d.ts.map +1 -0
- package/dist/path-grid/path-grid.js +149 -0
- package/dist/path-grid/path-grid.js.map +1 -0
- package/dist/radial-grid/index.d.ts +2 -0
- package/dist/radial-grid/index.d.ts.map +1 -0
- package/dist/radial-grid/index.js +2 -0
- package/dist/radial-grid/index.js.map +1 -0
- package/dist/radial-grid/radial-grid.d.ts +177 -0
- package/dist/radial-grid/radial-grid.d.ts.map +1 -0
- package/dist/radial-grid/radial-grid.js +63 -0
- package/dist/radial-grid/radial-grid.js.map +1 -0
- package/dist/rectangular-grid/index.d.ts +2 -0
- package/dist/rectangular-grid/index.d.ts.map +1 -0
- package/dist/rectangular-grid/index.js +2 -0
- package/dist/rectangular-grid/index.js.map +1 -0
- package/dist/rectangular-grid/rectangular-grid.d.ts +212 -0
- package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -0
- package/dist/rectangular-grid/rectangular-grid.js +118 -0
- package/dist/rectangular-grid/rectangular-grid.js.map +1 -0
- package/dist/sphere-grid/index.d.ts +2 -0
- package/dist/sphere-grid/index.d.ts.map +1 -0
- package/dist/sphere-grid/index.js +2 -0
- package/dist/sphere-grid/index.js.map +1 -0
- package/dist/sphere-grid/sphere-grid.d.ts +200 -0
- package/dist/sphere-grid/sphere-grid.d.ts.map +1 -0
- package/dist/sphere-grid/sphere-grid.js +102 -0
- package/dist/sphere-grid/sphere-grid.js.map +1 -0
- package/package.json +72 -3
- package/registry.json +32 -0
- package/src/engine.ts +12 -0
- package/src/index.ts +6 -0
- package/src/kit/index.ts +18 -0
- package/src/kit/item-effects.ts +114 -0
- package/src/kit/item-grid.ts +648 -0
- package/src/kit/order.ts +41 -0
- package/src/kit/random.ts +29 -0
- package/src/kit/slots/index.ts +39 -0
- package/src/kit/slots/path-templates.ts +120 -0
- package/src/kit/slots/path.ts +120 -0
- package/src/kit/slots/radial.ts +62 -0
- package/src/kit/slots/rectangular.ts +108 -0
- package/src/kit/slots/slot.ts +82 -0
- package/src/kit/slots/sphere.ts +94 -0
- package/src/kit/stagger.ts +96 -0
- package/src/nodes.ts +30 -0
- package/src/path-grid/index.ts +1 -0
- package/src/path-grid/path-grid.ts +186 -0
- package/src/radial-grid/index.ts +1 -0
- package/src/radial-grid/radial-grid.ts +81 -0
- package/src/rectangular-grid/index.ts +1 -0
- package/src/rectangular-grid/rectangular-grid.ts +145 -0
- package/src/sphere-grid/index.ts +1 -0
- package/src/sphere-grid/sphere-grid.ts +129 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { component2d, Types, } from "@motionscript/sdk";
|
|
2
|
+
import { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop } from "../kit/index.js";
|
|
3
|
+
const own = {
|
|
4
|
+
radius: Types.number(200, { min: 0, step: 1 }),
|
|
5
|
+
startAngle: Types.number(0, { step: 1, unit: "°" }),
|
|
6
|
+
sweep: Types.number(360, { min: -360, max: 360, step: 1, unit: "°" }),
|
|
7
|
+
direction: Types.oneOf(RADIAL_DIRECTIONS, { default: "clockwise" }),
|
|
8
|
+
rotateItems: false,
|
|
9
|
+
spinSpeed: Types.number(0, { step: 1, unit: "°/s" }),
|
|
10
|
+
};
|
|
11
|
+
function arrangement(s) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "radial",
|
|
14
|
+
radius: s.radius,
|
|
15
|
+
startAngle: s.startAngle,
|
|
16
|
+
sweep: s.sweep,
|
|
17
|
+
direction: s.direction,
|
|
18
|
+
rotateItems: s.rotateItems,
|
|
19
|
+
spinSpeed: s.spinSpeed,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const arranger = { arrangement };
|
|
23
|
+
/**
|
|
24
|
+
* Children round a circle, or along an arc of one.
|
|
25
|
+
*
|
|
26
|
+
* A full circle spaces the items evenly with none on top of another; an arc
|
|
27
|
+
* puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`
|
|
28
|
+
* can bring any item to the top like a dial.
|
|
29
|
+
*/
|
|
30
|
+
export const RadialGrid = ItemGrid.define(component2d({
|
|
31
|
+
key: "radialGrid",
|
|
32
|
+
state: { ...ItemGrid.state, ...own },
|
|
33
|
+
defaults: ItemGrid.defaults,
|
|
34
|
+
commands: {
|
|
35
|
+
...ItemGrid.commands,
|
|
36
|
+
/** Orbit the items round the centre by `degrees` — `360` is one full turn. */
|
|
37
|
+
spin: {
|
|
38
|
+
args: { degrees: Types.number(360, { step: 15, unit: "°" }) },
|
|
39
|
+
run: (timeline, s) => timeline.tween({ startAngle: s.startAngle + (timeline.args.degrees ?? 360) }),
|
|
40
|
+
},
|
|
41
|
+
/** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */
|
|
42
|
+
turnTo: {
|
|
43
|
+
args: { item: Types.number(0, { min: 0, step: 1 }) },
|
|
44
|
+
run: (timeline, s, children) => {
|
|
45
|
+
const count = children.length;
|
|
46
|
+
const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0));
|
|
47
|
+
const turn = slot < 0 ? 0 : radialTurnToTop(arrangement(s), count, slot);
|
|
48
|
+
return timeline.tween({ startAngle: s.startAngle + turn });
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
radiusTo: {
|
|
52
|
+
args: { radius: ItemGrid.hinted(280, { min: 0 }) },
|
|
53
|
+
run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),
|
|
54
|
+
},
|
|
55
|
+
/** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */
|
|
56
|
+
sweepTo: {
|
|
57
|
+
args: { sweep: ItemGrid.hinted(360, { min: -360, max: 360, unit: "°" }) },
|
|
58
|
+
run: (timeline, s) => timeline.tween({ sweep: timeline.args.sweep ?? s.sweep }),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
...ItemGrid.fields(arranger),
|
|
62
|
+
}), arranger);
|
|
63
|
+
//# sourceMappingURL=radial-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radial-grid.js","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,GAMN,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAA0B,MAAM,QAAQ,CAAA;A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,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE;YAClD,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;SACnF;QACD,mFAAmF;QACnF,OAAO,EAAE;YACP,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE;YACzE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;SAChF;KACF;IACD,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;CAC7B,CAAC,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["import {\n component2d,\n Types,\n type NodeOf,\n type Values,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n} from \"@motionscript/sdk\"\n\nimport { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop, type RadialArrangement } from \"../kit\"\n\nconst own = {\n radius: Types.number(200, { min: 0, step: 1 }),\n startAngle: Types.number(0, { step: 1, unit: \"°\" }),\n sweep: Types.number(360, { min: -360, max: 360, step: 1, unit: \"°\" }),\n direction: Types.oneOf(RADIAL_DIRECTIONS, { default: \"clockwise\" }),\n rotateItems: false,\n spinSpeed: Types.number(0, { step: 1, unit: \"°/s\" }),\n}\n\ntype Own = Values<typeof own>\n\nfunction arrangement(s: Own): RadialArrangement {\n return {\n kind: \"radial\",\n radius: s.radius,\n startAngle: s.startAngle,\n sweep: s.sweep,\n direction: s.direction,\n rotateItems: s.rotateItems,\n spinSpeed: s.spinSpeed,\n }\n}\n\nconst arranger: ItemGrid.Arranger<Own> = { arrangement }\n\n/**\n * Children round a circle, or along an arc of one.\n *\n * A full circle spaces the items evenly with none on top of another; an arc\n * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`\n * can bring any item to the top like a dial.\n */\nexport const RadialGrid = ItemGrid.define(component2d({\n key: \"radialGrid\",\n state: { ...ItemGrid.state, ...own },\n defaults: ItemGrid.defaults,\n commands: {\n ...ItemGrid.commands,\n /** Orbit the items round the centre by `degrees` — `360` is one full turn. */\n spin: {\n args: { degrees: Types.number(360, { step: 15, unit: \"°\" }) },\n run: (timeline, s) => timeline.tween({ startAngle: s.startAngle + (timeline.args.degrees ?? 360) }),\n },\n /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */\n turnTo: {\n args: { item: Types.number(0, { min: 0, step: 1 }) },\n run: (timeline, s, children) => {\n const count = children.length\n const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0))\n const turn = slot < 0 ? 0 : radialTurnToTop(arrangement(s), count, slot)\n return timeline.tween({ startAngle: s.startAngle + turn })\n },\n },\n radiusTo: {\n args: { radius: ItemGrid.hinted(280, { min: 0 }) },\n run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),\n },\n /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */\n sweepTo: {\n args: { sweep: ItemGrid.hinted(360, { min: -360, max: 360, unit: \"°\" }) },\n run: (timeline, s) => timeline.tween({ sweep: timeline.args.sweep ?? s.sweep }),\n },\n },\n ...ItemGrid.fields(arranger),\n}), arranger)\n\nexport type RadialGrid = NodeOf<typeof RadialGrid>\n/** What a call or a document row may set. */\nexport type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rectangular-grid/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rectangular-grid/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA","sourcesContent":["export * from \"./rectangular-grid\"\n"]}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
|
|
2
|
+
import { ItemGrid } from "../kit/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Children in rows and columns — the grid the other three are variations on.
|
|
5
|
+
*
|
|
6
|
+
* Cells are as big as the largest child (`fit`), a size of their own
|
|
7
|
+
* (`fixed`), or an equal share of the node's box (`fill`), which is also the
|
|
8
|
+
* room a child set to fill grows into. Shift every other row by half a cell
|
|
9
|
+
* for a brick bond or a hex pack.
|
|
10
|
+
*/
|
|
11
|
+
export declare const RectangularGrid: import("@motionscript/sdk").Component<"rectangularGrid", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
12
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
13
|
+
readonly fillDirection: import("@motionscript/sdk").Type<"row" | "column", "row" | "column", false>;
|
|
14
|
+
readonly cellMode: import("@motionscript/sdk").Type<"fixed" | "fit" | "fill", "fixed" | "fit" | "fill", false>;
|
|
15
|
+
readonly cellWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
16
|
+
readonly cellHeight: import("@motionscript/sdk").Type<number, number, false>;
|
|
17
|
+
readonly columnGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
18
|
+
readonly rowGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
19
|
+
readonly lastLineAlign: import("@motionscript/sdk").Type<"start" | "center" | "end", "start" | "center" | "end", false>;
|
|
20
|
+
readonly rowOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
21
|
+
readonly columnOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
22
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
23
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
24
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
25
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
26
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
27
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
28
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
29
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
30
|
+
}>, {
|
|
31
|
+
readonly columnsTo: {
|
|
32
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
33
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
34
|
+
readonly columns: import("@motionscript/sdk").Type<4 | undefined, 4 | undefined, false>;
|
|
35
|
+
};
|
|
36
|
+
readonly gapTo: {
|
|
37
|
+
readonly columnGap: import("@motionscript/sdk").Type<48 | undefined, 48 | undefined, false>;
|
|
38
|
+
readonly rowGap: import("@motionscript/sdk").Type<48 | undefined, 48 | undefined, false>;
|
|
39
|
+
};
|
|
40
|
+
readonly cellSizeTo: {
|
|
41
|
+
readonly cellWidth: import("@motionscript/sdk").Type<160 | undefined, 160 | undefined, false>;
|
|
42
|
+
readonly cellHeight: import("@motionscript/sdk").Type<160 | undefined, 160 | undefined, false>;
|
|
43
|
+
};
|
|
44
|
+
readonly focusRow: {
|
|
45
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
|
+
readonly grow: import("@motionscript/sdk").Type<0.1 | undefined, 0.1 | undefined, false>;
|
|
47
|
+
readonly row: import("@motionscript/sdk").Type<number, number, false>;
|
|
48
|
+
};
|
|
49
|
+
readonly focusColumn: {
|
|
50
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
51
|
+
readonly grow: import("@motionscript/sdk").Type<0.1 | undefined, 0.1 | undefined, false>;
|
|
52
|
+
readonly column: import("@motionscript/sdk").Type<number, number, false>;
|
|
53
|
+
};
|
|
54
|
+
readonly reveal: {
|
|
55
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
56
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
57
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
58
|
+
};
|
|
59
|
+
readonly conceal: {
|
|
60
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
61
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
63
|
+
};
|
|
64
|
+
readonly wave: {
|
|
65
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
66
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
67
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
68
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
69
|
+
};
|
|
70
|
+
readonly focus: {
|
|
71
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
72
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
73
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
74
|
+
};
|
|
75
|
+
readonly unfocus: unknown;
|
|
76
|
+
readonly spreadTo: {
|
|
77
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
78
|
+
};
|
|
79
|
+
readonly shuffle: {
|
|
80
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
81
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
82
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
83
|
+
};
|
|
84
|
+
readonly swap: {
|
|
85
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
86
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
87
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
88
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
89
|
+
};
|
|
90
|
+
readonly reorder: {
|
|
91
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
92
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
93
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
94
|
+
};
|
|
95
|
+
readonly morphInto: {
|
|
96
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
97
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
98
|
+
readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
99
|
+
};
|
|
100
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
101
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
102
|
+
readonly fillDirection: import("@motionscript/sdk").Type<"row" | "column", "row" | "column", false>;
|
|
103
|
+
readonly cellMode: import("@motionscript/sdk").Type<"fixed" | "fit" | "fill", "fixed" | "fit" | "fill", false>;
|
|
104
|
+
readonly cellWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
105
|
+
readonly cellHeight: import("@motionscript/sdk").Type<number, number, false>;
|
|
106
|
+
readonly columnGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
107
|
+
readonly rowGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
108
|
+
readonly lastLineAlign: import("@motionscript/sdk").Type<"start" | "center" | "end", "start" | "center" | "end", false>;
|
|
109
|
+
readonly rowOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
110
|
+
readonly columnOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
111
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
112
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
113
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
114
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
115
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
116
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
117
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
118
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
119
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
120
|
+
readonly columns: import("@motionscript/sdk").Type<number, number, false>;
|
|
121
|
+
readonly fillDirection: import("@motionscript/sdk").Type<"row" | "column", "row" | "column", false>;
|
|
122
|
+
readonly cellMode: import("@motionscript/sdk").Type<"fixed" | "fit" | "fill", "fixed" | "fit" | "fill", false>;
|
|
123
|
+
readonly cellWidth: import("@motionscript/sdk").Type<number, number, false>;
|
|
124
|
+
readonly cellHeight: import("@motionscript/sdk").Type<number, number, false>;
|
|
125
|
+
readonly columnGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
126
|
+
readonly rowGap: import("@motionscript/sdk").Type<number, number, false>;
|
|
127
|
+
readonly lastLineAlign: import("@motionscript/sdk").Type<"start" | "center" | "end", "start" | "center" | "end", false>;
|
|
128
|
+
readonly rowOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
129
|
+
readonly columnOffset: import("@motionscript/sdk").Type<number, number, false>;
|
|
130
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
131
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
132
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
133
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
134
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
135
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
136
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
137
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
138
|
+
}>, {
|
|
139
|
+
readonly columnsTo: {
|
|
140
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
141
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
142
|
+
readonly columns: import("@motionscript/sdk").Type<4 | undefined, 4 | undefined, false>;
|
|
143
|
+
};
|
|
144
|
+
readonly gapTo: {
|
|
145
|
+
readonly columnGap: import("@motionscript/sdk").Type<48 | undefined, 48 | undefined, false>;
|
|
146
|
+
readonly rowGap: import("@motionscript/sdk").Type<48 | undefined, 48 | undefined, false>;
|
|
147
|
+
};
|
|
148
|
+
readonly cellSizeTo: {
|
|
149
|
+
readonly cellWidth: import("@motionscript/sdk").Type<160 | undefined, 160 | undefined, false>;
|
|
150
|
+
readonly cellHeight: import("@motionscript/sdk").Type<160 | undefined, 160 | undefined, false>;
|
|
151
|
+
};
|
|
152
|
+
readonly focusRow: {
|
|
153
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
154
|
+
readonly grow: import("@motionscript/sdk").Type<0.1 | undefined, 0.1 | undefined, false>;
|
|
155
|
+
readonly row: import("@motionscript/sdk").Type<number, number, false>;
|
|
156
|
+
};
|
|
157
|
+
readonly focusColumn: {
|
|
158
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
159
|
+
readonly grow: import("@motionscript/sdk").Type<0.1 | undefined, 0.1 | undefined, false>;
|
|
160
|
+
readonly column: import("@motionscript/sdk").Type<number, number, false>;
|
|
161
|
+
};
|
|
162
|
+
readonly reveal: {
|
|
163
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
164
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
165
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
166
|
+
};
|
|
167
|
+
readonly conceal: {
|
|
168
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
169
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
170
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
171
|
+
};
|
|
172
|
+
readonly wave: {
|
|
173
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
174
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
175
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
176
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
177
|
+
};
|
|
178
|
+
readonly focus: {
|
|
179
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
180
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
181
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
182
|
+
};
|
|
183
|
+
readonly unfocus: unknown;
|
|
184
|
+
readonly spreadTo: {
|
|
185
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
186
|
+
};
|
|
187
|
+
readonly shuffle: {
|
|
188
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
189
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
190
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
191
|
+
};
|
|
192
|
+
readonly swap: {
|
|
193
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
194
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
195
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
196
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
197
|
+
};
|
|
198
|
+
readonly reorder: {
|
|
199
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
200
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
201
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
202
|
+
};
|
|
203
|
+
readonly morphInto: {
|
|
204
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
205
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
206
|
+
readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
207
|
+
};
|
|
208
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
209
|
+
export type RectangularGrid = NodeOf<typeof RectangularGrid>;
|
|
210
|
+
/** What a call or a document row may set. */
|
|
211
|
+
export type RectangularGridProps = NonNullable<Parameters<typeof RectangularGrid>[0]>;
|
|
212
|
+
//# sourceMappingURL=rectangular-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangular-grid.d.ts","sourceRoot":"","sources":["../../src/rectangular-grid/rectangular-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,MAAM,EAGX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAGL,QAAQ,EAMT,MAAM,QAAQ,CAAA;AA6Cf;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAmEf,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA;AAC5D,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { component2d, easeInOut, Types, } from "@motionscript/sdk";
|
|
2
|
+
import { CELL_MODES, FILL_DIRECTIONS, ItemGrid, LINE_ALIGNS, rectangularCell, staggerArgs, TRANSITION_STAGGER, } from "../kit/index.js";
|
|
3
|
+
const own = {
|
|
4
|
+
columns: Types.number(3, { min: 1, step: 1 }),
|
|
5
|
+
fillDirection: Types.oneOf(FILL_DIRECTIONS, { default: "row" }),
|
|
6
|
+
cellMode: Types.oneOf(CELL_MODES, { default: "fit" }),
|
|
7
|
+
cellWidth: Types.number(120, { min: 0, step: 1 }),
|
|
8
|
+
cellHeight: Types.number(120, { min: 0, step: 1 }),
|
|
9
|
+
columnGap: Types.number(24, { step: 1 }),
|
|
10
|
+
rowGap: Types.number(24, { step: 1 }),
|
|
11
|
+
lastLineAlign: Types.oneOf(LINE_ALIGNS, { default: "start" }),
|
|
12
|
+
rowOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),
|
|
13
|
+
columnOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),
|
|
14
|
+
};
|
|
15
|
+
function arrangement(s) {
|
|
16
|
+
return {
|
|
17
|
+
kind: "rectangular",
|
|
18
|
+
columns: s.columns,
|
|
19
|
+
fillDirection: s.fillDirection,
|
|
20
|
+
cellMode: s.cellMode,
|
|
21
|
+
cellWidth: s.cellWidth,
|
|
22
|
+
cellHeight: s.cellHeight,
|
|
23
|
+
columnGap: s.columnGap,
|
|
24
|
+
rowGap: s.rowGap,
|
|
25
|
+
lastLineAlign: s.lastLineAlign,
|
|
26
|
+
rowOffset: s.rowOffset,
|
|
27
|
+
columnOffset: s.columnOffset,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const arranger = {
|
|
31
|
+
arrangement,
|
|
32
|
+
// A child set to fill takes its cell, where the cell is not simply the largest child.
|
|
33
|
+
itemSpace: (s, count, space) => (s.cellMode === "fit" ? space : rectangularCell(arrangement(s), count, [], space)),
|
|
34
|
+
};
|
|
35
|
+
/** The focus args of a row or a column: the grow a row leaves out is the shared focus's. */
|
|
36
|
+
const lineFocus = {
|
|
37
|
+
dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),
|
|
38
|
+
grow: ItemGrid.hinted(0.1, { min: 0, max: 1, step: 0.05 }),
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Children in rows and columns — the grid the other three are variations on.
|
|
42
|
+
*
|
|
43
|
+
* Cells are as big as the largest child (`fit`), a size of their own
|
|
44
|
+
* (`fixed`), or an equal share of the node's box (`fill`), which is also the
|
|
45
|
+
* room a child set to fill grows into. Shift every other row by half a cell
|
|
46
|
+
* for a brick bond or a hex pack.
|
|
47
|
+
*/
|
|
48
|
+
export const RectangularGrid = ItemGrid.define(component2d({
|
|
49
|
+
key: "rectangularGrid",
|
|
50
|
+
state: { ...ItemGrid.state, ...own },
|
|
51
|
+
defaults: ItemGrid.defaults,
|
|
52
|
+
commands: {
|
|
53
|
+
...ItemGrid.commands,
|
|
54
|
+
/** Re-flow the items into `columns` columns, each moving to its new cell. */
|
|
55
|
+
columnsTo: {
|
|
56
|
+
args: { columns: ItemGrid.hinted(4, { min: 1, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },
|
|
57
|
+
run: (timeline, s, children) => {
|
|
58
|
+
const columns = Math.max(1, Math.round(timeline.args.columns ?? s.columns));
|
|
59
|
+
return ItemGrid.transitionTo(timeline, s, children, { columns });
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
/** Animate the spacing between columns and rows. */
|
|
63
|
+
gapTo: {
|
|
64
|
+
args: { columnGap: ItemGrid.hinted(48), rowGap: ItemGrid.hinted(48) },
|
|
65
|
+
run: (timeline) => {
|
|
66
|
+
const data = {};
|
|
67
|
+
if (timeline.args.columnGap !== undefined)
|
|
68
|
+
data.columnGap = timeline.args.columnGap;
|
|
69
|
+
if (timeline.args.rowGap !== undefined)
|
|
70
|
+
data.rowGap = timeline.args.rowGap;
|
|
71
|
+
return timeline.tween(data);
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* Animate the cell size, from whatever the cells measure now. The grid
|
|
76
|
+
* switches to `fixed` cells as it starts, since a size of its own is what
|
|
77
|
+
* `fixed` means.
|
|
78
|
+
*/
|
|
79
|
+
cellSizeTo: {
|
|
80
|
+
args: { cellWidth: ItemGrid.hinted(160, { min: 0 }), cellHeight: ItemGrid.hinted(160, { min: 0 }) },
|
|
81
|
+
easing: easeInOut("cubic"),
|
|
82
|
+
run: (timeline, s, children) => {
|
|
83
|
+
const sizes = children.map((child) => child.size);
|
|
84
|
+
const box = ItemGrid.contentBox(timeline.node.size, s.padding);
|
|
85
|
+
const from = rectangularCell(arrangement(s), sizes.length, sizes, box);
|
|
86
|
+
const width = timeline.args.cellWidth ?? from.width;
|
|
87
|
+
const height = timeline.args.cellHeight ?? from.height;
|
|
88
|
+
return timeline.animate((t) => ({
|
|
89
|
+
cellMode: "fixed",
|
|
90
|
+
cellWidth: from.width + (width - from.width) * t,
|
|
91
|
+
cellHeight: from.height + (height - from.height) * t,
|
|
92
|
+
}));
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
/** Bring one row (from 0 at the top) forward and push the rest back. */
|
|
96
|
+
focusRow: {
|
|
97
|
+
args: { row: Types.number(0, { min: 0, step: 1 }), ...lineFocus },
|
|
98
|
+
run: (timeline, s, children) => {
|
|
99
|
+
const slots = ItemGrid.itemSlots(timeline, s, children);
|
|
100
|
+
const row = Math.round(timeline.args.row ?? 0);
|
|
101
|
+
const inRow = (i) => slots[i]?.meta.kind === "rectangular" && slots[i].meta.row === row;
|
|
102
|
+
return ItemGrid.focusOn(timeline, s, inRow, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
/** Bring one column (from 0 at the left) forward and push the rest back. */
|
|
106
|
+
focusColumn: {
|
|
107
|
+
args: { column: Types.number(0, { min: 0, step: 1 }), ...lineFocus },
|
|
108
|
+
run: (timeline, s, children) => {
|
|
109
|
+
const slots = ItemGrid.itemSlots(timeline, s, children);
|
|
110
|
+
const column = Math.round(timeline.args.column ?? 0);
|
|
111
|
+
const inColumn = (i) => slots[i]?.meta.kind === "rectangular" && slots[i].meta.column === column;
|
|
112
|
+
return ItemGrid.focusOn(timeline, s, inColumn, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15);
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
...ItemGrid.fields(arranger),
|
|
117
|
+
}), arranger);
|
|
118
|
+
//# sourceMappingURL=rectangular-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangular-grid.js","sourceRoot":"","sources":["../../src/rectangular-grid/rectangular-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,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AS,CAAC,QAAiB,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAChE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAA;gBACpD,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,MAAM,CAAA;gBACxG,OAAO,QAAQ,CAAC,OAAO,CAAC,QAAiB,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAA;YAC7H,CAAC;SACF;KACF;IACD,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC;CAC7B,CAAC,EAAE,QAAQ,CAAC,CAAA","sourcesContent":["import {\n component2d,\n easeInOut,\n Types,\n type NodeOf,\n type Values,\n // Named so the emitted declaration reaches these through the sdk, not core.\n type Node2D as _Node2D,\n type Node2DProps as _Node2DProps,\n} from \"@motionscript/sdk\"\n\nimport {\n CELL_MODES,\n FILL_DIRECTIONS,\n ItemGrid,\n LINE_ALIGNS,\n rectangularCell,\n staggerArgs,\n TRANSITION_STAGGER,\n type RectangularArrangement,\n} from \"../kit\"\n\nconst own = {\n columns: Types.number(3, { min: 1, step: 1 }),\n fillDirection: Types.oneOf(FILL_DIRECTIONS, { default: \"row\" }),\n cellMode: Types.oneOf(CELL_MODES, { default: \"fit\" }),\n cellWidth: Types.number(120, { min: 0, step: 1 }),\n cellHeight: Types.number(120, { min: 0, step: 1 }),\n columnGap: Types.number(24, { step: 1 }),\n rowGap: Types.number(24, { step: 1 }),\n lastLineAlign: Types.oneOf(LINE_ALIGNS, { default: \"start\" }),\n rowOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),\n columnOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),\n}\n\ntype Own = Values<typeof own>\n\nfunction arrangement(s: Own): RectangularArrangement {\n return {\n kind: \"rectangular\",\n columns: s.columns,\n fillDirection: s.fillDirection,\n cellMode: s.cellMode,\n cellWidth: s.cellWidth,\n cellHeight: s.cellHeight,\n columnGap: s.columnGap,\n rowGap: s.rowGap,\n lastLineAlign: s.lastLineAlign,\n rowOffset: s.rowOffset,\n columnOffset: s.columnOffset,\n }\n}\n\nconst arranger: ItemGrid.Arranger<Own> = {\n arrangement,\n // A child set to fill takes its cell, where the cell is not simply the largest child.\n itemSpace: (s, count, space) => (s.cellMode === \"fit\" ? space : rectangularCell(arrangement(s), count, [], space)),\n}\n\n/** The focus args of a row or a column: the grow a row leaves out is the shared focus's. */\nconst lineFocus = {\n dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),\n grow: ItemGrid.hinted(0.1, { min: 0, max: 1, step: 0.05 }),\n}\n\n/**\n * Children in rows and columns — the grid the other three are variations on.\n *\n * Cells are as big as the largest child (`fit`), a size of their own\n * (`fixed`), or an equal share of the node's box (`fill`), which is also the\n * room a child set to fill grows into. Shift every other row by half a cell\n * for a brick bond or a hex pack.\n */\nexport const RectangularGrid = ItemGrid.define(component2d({\n key: \"rectangularGrid\",\n state: { ...ItemGrid.state, ...own },\n defaults: ItemGrid.defaults,\n commands: {\n ...ItemGrid.commands,\n /** Re-flow the items into `columns` columns, each moving to its new cell. */\n columnsTo: {\n args: { columns: ItemGrid.hinted(4, { min: 1, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },\n run: (timeline, s, children) => {\n const columns = Math.max(1, Math.round(timeline.args.columns ?? s.columns))\n return ItemGrid.transitionTo(timeline as never, s, children, { columns })\n },\n },\n /** Animate the spacing between columns and rows. */\n gapTo: {\n args: { columnGap: ItemGrid.hinted(48), rowGap: ItemGrid.hinted(48) },\n run: (timeline) => {\n const data: { columnGap?: number; rowGap?: number } = {}\n if (timeline.args.columnGap !== undefined) data.columnGap = timeline.args.columnGap\n if (timeline.args.rowGap !== undefined) data.rowGap = timeline.args.rowGap\n return timeline.tween(data)\n },\n },\n /**\n * Animate the cell size, from whatever the cells measure now. The grid\n * switches to `fixed` cells as it starts, since a size of its own is what\n * `fixed` means.\n */\n cellSizeTo: {\n args: { cellWidth: ItemGrid.hinted(160, { min: 0 }), cellHeight: ItemGrid.hinted(160, { min: 0 }) },\n easing: easeInOut(\"cubic\"),\n run: (timeline, s, children) => {\n const sizes = children.map((child) => child.size)\n const box = ItemGrid.contentBox(timeline.node.size, s.padding)\n const from = rectangularCell(arrangement(s), sizes.length, sizes, box)\n const width = timeline.args.cellWidth ?? from.width\n const height = timeline.args.cellHeight ?? from.height\n return timeline.animate((t) => ({\n cellMode: \"fixed\",\n cellWidth: from.width + (width - from.width) * t,\n cellHeight: from.height + (height - from.height) * t,\n }))\n },\n },\n /** Bring one row (from 0 at the top) forward and push the rest back. */\n focusRow: {\n args: { row: Types.number(0, { min: 0, step: 1 }), ...lineFocus },\n run: (timeline, s, children) => {\n const slots = ItemGrid.itemSlots(timeline as never, s, children)\n const row = Math.round(timeline.args.row ?? 0)\n const inRow = (i: number) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.row === row\n return ItemGrid.focusOn(timeline as never, s, inRow, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\n },\n },\n /** Bring one column (from 0 at the left) forward and push the rest back. */\n focusColumn: {\n args: { column: Types.number(0, { min: 0, step: 1 }), ...lineFocus },\n run: (timeline, s, children) => {\n const slots = ItemGrid.itemSlots(timeline as never, s, children)\n const column = Math.round(timeline.args.column ?? 0)\n const inColumn = (i: number) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.column === column\n return ItemGrid.focusOn(timeline as never, s, inColumn, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\n },\n },\n },\n ...ItemGrid.fields(arranger),\n}), arranger)\n\nexport type RectangularGrid = NodeOf<typeof RectangularGrid>\n/** What a call or a document row may set. */\nexport type RectangularGridProps = NonNullable<Parameters<typeof RectangularGrid>[0]>\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sphere-grid/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sphere-grid/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA","sourcesContent":["export * from \"./sphere-grid\"\n"]}
|