@motionscript/grids 0.1.0-alpha.5 → 0.1.0-alpha.7
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 +24 -0
- package/README.md +47 -15
- package/dist/browser/chunks/chunk-J62D7EFZ.js +2 -0
- package/dist/browser/chunks/chunk-J62D7EFZ.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/engine.d.ts +4 -4
- package/dist/engine.js +4 -4
- package/dist/engine.js.map +1 -1
- package/dist/kit/index.d.ts +3 -1
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +4 -1
- package/dist/kit/index.js.map +1 -1
- package/dist/kit/item-grid.d.ts +203 -198
- package/dist/kit/item-grid.d.ts.map +1 -1
- package/dist/kit/item-grid.js +413 -440
- package/dist/kit/item-grid.js.map +1 -1
- package/dist/nodes.d.ts +8 -3
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +6 -10
- package/dist/nodes.js.map +1 -1
- package/dist/path-grid/path-grid.d.ts +187 -73
- package/dist/path-grid/path-grid.d.ts.map +1 -1
- package/dist/path-grid/path-grid.js +129 -172
- package/dist/path-grid/path-grid.js.map +1 -1
- package/dist/radial-grid/radial-grid.d.ts +171 -45
- package/dist/radial-grid/radial-grid.d.ts.map +1 -1
- package/dist/radial-grid/radial-grid.js +55 -87
- package/dist/radial-grid/radial-grid.js.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.d.ts +203 -70
- package/dist/rectangular-grid/rectangular-grid.d.ts.map +1 -1
- package/dist/rectangular-grid/rectangular-grid.js +107 -145
- package/dist/rectangular-grid/rectangular-grid.js.map +1 -1
- package/dist/sphere-grid/sphere-grid.d.ts +192 -60
- package/dist/sphere-grid/sphere-grid.d.ts.map +1 -1
- package/dist/sphere-grid/sphere-grid.js +90 -137
- package/dist/sphere-grid/sphere-grid.js.map +1 -1
- package/package.json +4 -4
- package/src/engine.ts +4 -4
- package/src/kit/index.ts +13 -1
- package/src/kit/item-grid.ts +505 -442
- package/src/nodes.ts +18 -3
- package/src/path-grid/path-grid.ts +137 -164
- package/src/radial-grid/radial-grid.ts +69 -78
- package/src/rectangular-grid/rectangular-grid.ts +118 -133
- package/src/sphere-grid/sphere-grid.ts +103 -117
- package/dist/browser/chunks/chunk-XDUDKWM7.js +0 -2
- package/dist/browser/chunks/chunk-XDUDKWM7.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangular-grid.js","sourceRoot":"","sources":["../../src/rectangular-grid/rectangular-grid.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,IAAI,EACJ,QAAQ,GAKT,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,WAAW,EACX,QAAQ,EACR,eAAe,EACf,WAAW,EACX,kBAAkB,GAOnB,MAAM,QAAQ,CAAA;AAef;;;;;;;GAOG;AAYI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,QAA8B;IAYjE,YAAY,KAAyD;QACnE,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;IAED,6EAA6E;IAE7E,SAAS,CAAC,IAA2E;QACnF,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;QAC3E,OAAO,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,CAAC,CAAA;IAC9C,CAAC;IAED,oDAAoD;IAEpD,KAAK,CAAC,IAAiF;QACrF,MAAM,IAAI,GAAkC,EAAE,CAAA;QAC9C,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS;YAAE,IAA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AE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;SAC1D;KACF,CAAC;+CAKD;AAUD;IAPC,OAAO,CAAC;QACP,IAAI,EAAE;YACJ,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;YAC9C,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;YACxD,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE;SAC1D;KACF,CAAC;kDAKD;AA5EU,eAAe;IAX3B,IAAI,CAAC;QACJ,GAAG,EAAE,iBAAiB;QACtB,SAAS,EAAE,MAAM;QACjB,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,UAAU;YACpB,eAAe,EAAE,IAAI;YACrB,gBAAgB,EAAE,KAAK;YACvB,iBAAiB,EAAE,KAAK;SACzB;KACF,CAAC;GACW,eAAe,CAmG3B","sourcesContent":["import {\r\n command,\r\n easeInOut,\r\n node,\r\n property,\r\n type Command,\r\n type CommandArgs,\r\n type NodeConfig,\r\n type Size2D,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n CELL_MODES,\r\n contentBoxOf,\r\n FILL_DIRECTIONS,\r\n LINE_ALIGNS,\r\n ItemGrid,\r\n rectangularCell,\r\n staggerArgs,\r\n TRANSITION_STAGGER,\r\n type CellMode,\r\n type FillDirection,\r\n type ItemGridProps,\r\n type LineAlign,\r\n type RectangularArrangement,\r\n type StaggerArgs,\r\n} from \"../kit\"\r\n\r\nexport interface RectangularGridProps extends ItemGridProps {\r\n columns: number\r\n fillDirection: FillDirection\r\n cellMode: CellMode\r\n cellWidth: number\r\n cellHeight: number\r\n columnGap: number\r\n rowGap: number\r\n lastLineAlign: LineAlign\r\n rowOffset: number\r\n columnOffset: number\r\n}\r\n\r\n/**\r\n * Children in rows and columns — the grid the other three are variations on.\r\n *\r\n * Cells are as big as the largest child (`fit`), a size of their own\r\n * (`fixed`), or an equal share of the node's box (`fill`), which is also the\r\n * room a child set to fill grows into. Shift every other row by half a cell\r\n * for a brick bond or a hex pack.\r\n */\r\n@node({\r\n key: \"rectangularGrid\",\r\n parentKey: \"node\",\r\n forkable: true,\r\n layout: {\r\n children: \"freeform\",\r\n acceptsChildren: true,\r\n defaultWidthMode: \"hug\",\r\n defaultHeightMode: \"hug\",\r\n },\r\n})\r\nexport class RectangularGrid extends ItemGrid<RectangularGridProps> {\r\n @property({ default: 3, min: 1, step: 1 }) declare columns: number\r\n @property({ default: \"row\", kind: \"enum\", options: FILL_DIRECTIONS }) declare fillDirection: FillDirection\r\n @property({ default: \"fit\", kind: \"enum\", options: CELL_MODES }) declare cellMode: CellMode\r\n @property({ default: 120, min: 0, step: 1 }) declare cellWidth: number\r\n @property({ default: 120, min: 0, step: 1 }) declare cellHeight: number\r\n @property({ default: 24, step: 1 }) declare columnGap: number\r\n @property({ default: 24, step: 1 }) declare rowGap: number\r\n @property({ default: \"start\", kind: \"enum\", options: LINE_ALIGNS }) declare lastLineAlign: LineAlign\r\n @property({ default: 0, min: -1, max: 1, step: 0.05 }) declare rowOffset: number\r\n @property({ default: 0, min: -1, max: 1, step: 0.05 }) declare columnOffset: number\r\n\r\n constructor(props?: NodeConfig<RectangularGrid, RectangularGridProps>) {\r\n super(props)\r\n }\r\n\r\n /** Re-flow the items into `columns` columns, each moving to its new cell. */\r\n @command({ args: [{ key: \"columns\", min: 1, step: 1, default: 4 }, ...staggerArgs(TRANSITION_STAGGER)] })\r\n columnsTo(args: CommandArgs<{ columns: number } & StaggerArgs> & { duration: number }): Command<RectangularGridProps> {\r\n const columns = Math.max(1, Math.round(args.data?.columns ?? this.columns))\r\n return this._transitionTo({ columns }, args)\r\n }\r\n\r\n /** Animate the spacing between columns and rows. */\r\n @command({ args: [{ key: \"columnGap\", default: 48 }, { key: \"rowGap\", default: 48 }] })\r\n gapTo(args: CommandArgs<{ columnGap?: number; rowGap?: number }> & { duration: number }): Command<RectangularGridProps> {\r\n const data: Partial<RectangularGridProps> = {}\r\n if (args.data?.columnGap !== undefined) data.columnGap = args.data.columnGap\r\n if (args.data?.rowGap !== undefined) data.rowGap = args.data.rowGap\r\n return this.to({ data, duration: args.duration, easing: args.easing })\r\n }\r\n\r\n /**\r\n * Animate the cell size, from whatever the cells measure now. The grid\r\n * switches to `fixed` cells as it starts, since a size of its own is what\r\n * `fixed` means.\r\n */\r\n @command({ args: [{ key: \"cellWidth\", min: 0, default: 160 }, { key: \"cellHeight\", min: 0, default: 160 }] })\r\n cellSizeTo(args: CommandArgs<{ cellWidth?: number; cellHeight?: number }> & { duration: number }): Command<RectangularGridProps> {\r\n const sizes = this._itemSizes()\r\n const from = rectangularCell(this.arrangementFor(), sizes.length, sizes, contentBoxOf(this))\r\n const width = args.data?.cellWidth ?? from.width\r\n const height = args.data?.cellHeight ?? from.height\r\n return this.command<RectangularGridProps>((t) => ({\r\n cellMode: \"fixed\",\r\n cellWidth: from.width + (width - from.width) * t,\r\n cellHeight: from.height + (height - from.height) * t,\r\n }), args.duration, args.easing ?? easeInOut(\"cubic\"))\r\n }\r\n\r\n /** Bring one row (from 0 at the top) forward and push the rest back. */\r\n @command({\r\n args: [\r\n { key: \"row\", min: 0, step: 1, default: 0 },\r\n { key: \"dim\", min: 0, max: 1, step: 0.05, default: 0.7 },\r\n { key: \"grow\", min: 0, max: 1, step: 0.05, default: 0.1 },\r\n ],\r\n })\r\n focusRow(args: CommandArgs<{ row?: number; dim?: number; grow?: number }> & { duration: number }): Command<ItemGridProps> {\r\n const slots = this._itemSlots()\r\n const row = Math.round(args.data?.row ?? 0)\r\n return this._focusOn((i) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.row === row, slots.length, args)\r\n }\r\n\r\n /** Bring one column (from 0 at the left) forward and push the rest back. */\r\n @command({\r\n args: [\r\n { key: \"column\", min: 0, step: 1, default: 0 },\r\n { key: \"dim\", min: 0, max: 1, step: 0.05, default: 0.7 },\r\n { key: \"grow\", min: 0, max: 1, step: 0.05, default: 0.1 },\r\n ],\r\n })\r\n focusColumn(args: CommandArgs<{ column?: number; dim?: number; grow?: number }> & { duration: number }): Command<ItemGridProps> {\r\n const slots = this._itemSlots()\r\n const column = Math.round(args.data?.column ?? 0)\r\n return this._focusOn((i) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.column === column, slots.length, args)\r\n }\r\n\r\n protected override arrangementFor(): RectangularArrangement {\r\n return {\r\n kind: \"rectangular\",\r\n columns: this.columns,\r\n fillDirection: this.fillDirection,\r\n cellMode: this.cellMode,\r\n cellWidth: this.cellWidth,\r\n cellHeight: this.cellHeight,\r\n columnGap: this.columnGap,\r\n rowGap: this.rowGap,\r\n lastLineAlign: this.lastLineAlign,\r\n rowOffset: this.rowOffset,\r\n columnOffset: this.columnOffset,\r\n }\r\n }\r\n\r\n /** A child set to fill takes its cell, where the cell is not simply the largest child. */\r\n protected override itemSpace(count: number, space: Size2D): Size2D {\r\n if (this.cellMode === \"fit\") return space\r\n return rectangularCell(this.arrangementFor(), count, [], space)\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"rectangular-grid.js","sourceRoot":"","sources":["../../src/rectangular-grid/rectangular-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,KAAK,GAMN,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,UAAU,EACV,eAAe,EACf,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,kBAAkB,GAEnB,MAAM,QAAQ,CAAA;AAEf,MAAM,GAAG,GAAG;IACV,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAA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,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 {\r\n component2d,\r\n easeInOut,\r\n Types,\r\n type NodeOf,\r\n type Values,\r\n // Named so the emitted declaration reaches these through the sdk, not core.\r\n type Node2D as _Node2D,\r\n type Node2DProps as _Node2DProps,\r\n} from \"@motionscript/sdk\"\r\n\r\nimport {\r\n CELL_MODES,\r\n FILL_DIRECTIONS,\r\n ItemGrid,\r\n LINE_ALIGNS,\r\n rectangularCell,\r\n staggerArgs,\r\n TRANSITION_STAGGER,\r\n type RectangularArrangement,\r\n} from \"../kit\"\r\n\r\nconst own = {\r\n columns: Types.number(3, { min: 1, step: 1 }),\r\n fillDirection: Types.oneOf(FILL_DIRECTIONS, { default: \"row\" }),\r\n cellMode: Types.oneOf(CELL_MODES, { default: \"fit\" }),\r\n cellWidth: Types.number(120, { min: 0, step: 1 }),\r\n cellHeight: Types.number(120, { min: 0, step: 1 }),\r\n columnGap: Types.number(24, { step: 1 }),\r\n rowGap: Types.number(24, { step: 1 }),\r\n lastLineAlign: Types.oneOf(LINE_ALIGNS, { default: \"start\" }),\r\n rowOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),\r\n columnOffset: Types.number(0, { min: -1, max: 1, step: 0.05 }),\r\n}\r\n\r\ntype Own = Values<typeof own>\r\n\r\nfunction arrangement(s: Own): RectangularArrangement {\r\n return {\r\n kind: \"rectangular\",\r\n columns: s.columns,\r\n fillDirection: s.fillDirection,\r\n cellMode: s.cellMode,\r\n cellWidth: s.cellWidth,\r\n cellHeight: s.cellHeight,\r\n columnGap: s.columnGap,\r\n rowGap: s.rowGap,\r\n lastLineAlign: s.lastLineAlign,\r\n rowOffset: s.rowOffset,\r\n columnOffset: s.columnOffset,\r\n }\r\n}\r\n\r\nconst arranger: ItemGrid.Arranger<Own> = {\r\n arrangement,\r\n // A child set to fill takes its cell, where the cell is not simply the largest child.\r\n itemSpace: (s, count, space) => (s.cellMode === \"fit\" ? space : rectangularCell(arrangement(s), count, [], space)),\r\n}\r\n\r\n/** The focus args of a row or a column: the grow a row leaves out is the shared focus's. */\r\nconst lineFocus = {\r\n dim: Types.number(0.7, { min: 0, max: 1, step: 0.05 }),\r\n grow: ItemGrid.hinted(0.1, { min: 0, max: 1, step: 0.05 }),\r\n}\r\n\r\n/**\r\n * Children in rows and columns — the grid the other three are variations on.\r\n *\r\n * Cells are as big as the largest child (`fit`), a size of their own\r\n * (`fixed`), or an equal share of the node's box (`fill`), which is also the\r\n * room a child set to fill grows into. Shift every other row by half a cell\r\n * for a brick bond or a hex pack.\r\n */\r\nexport const RectangularGrid = ItemGrid.define(component2d({\r\n key: \"rectangularGrid\",\r\n state: { ...ItemGrid.state, ...own },\r\n defaults: ItemGrid.defaults,\r\n commands: {\r\n ...ItemGrid.commands,\r\n /** Re-flow the items into `columns` columns, each moving to its new cell. */\r\n columnsTo: {\r\n args: { columns: ItemGrid.hinted(4, { min: 1, step: 1 }), ...staggerArgs(TRANSITION_STAGGER) },\r\n run: (timeline, s, children) => {\r\n const columns = Math.max(1, Math.round(timeline.args.columns ?? s.columns))\r\n return ItemGrid.transitionTo(timeline as never, s, children, { columns })\r\n },\r\n },\r\n /** Animate the spacing between columns and rows. */\r\n gapTo: {\r\n args: { columnGap: ItemGrid.hinted(48), rowGap: ItemGrid.hinted(48) },\r\n run: (timeline) => {\r\n const data: { columnGap?: number; rowGap?: number } = {}\r\n if (timeline.args.columnGap !== undefined) data.columnGap = timeline.args.columnGap\r\n if (timeline.args.rowGap !== undefined) data.rowGap = timeline.args.rowGap\r\n return timeline.tween(data)\r\n },\r\n },\r\n /**\r\n * Animate the cell size, from whatever the cells measure now. The grid\r\n * switches to `fixed` cells as it starts, since a size of its own is what\r\n * `fixed` means.\r\n */\r\n cellSizeTo: {\r\n args: { cellWidth: ItemGrid.hinted(160, { min: 0 }), cellHeight: ItemGrid.hinted(160, { min: 0 }) },\r\n easing: easeInOut(\"cubic\"),\r\n run: (timeline, s, children) => {\r\n const sizes = children.map((child) => child.size)\r\n const box = ItemGrid.contentBox(timeline.node.size, s.padding)\r\n const from = rectangularCell(arrangement(s), sizes.length, sizes, box)\r\n const width = timeline.args.cellWidth ?? from.width\r\n const height = timeline.args.cellHeight ?? from.height\r\n return timeline.animate((t) => ({\r\n cellMode: \"fixed\",\r\n cellWidth: from.width + (width - from.width) * t,\r\n cellHeight: from.height + (height - from.height) * t,\r\n }))\r\n },\r\n },\r\n /** Bring one row (from 0 at the top) forward and push the rest back. */\r\n focusRow: {\r\n args: { row: Types.number(0, { min: 0, step: 1 }), ...lineFocus },\r\n run: (timeline, s, children) => {\r\n const slots = ItemGrid.itemSlots(timeline as never, s, children)\r\n const row = Math.round(timeline.args.row ?? 0)\r\n const inRow = (i: number) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.row === row\r\n return ItemGrid.focusOn(timeline as never, s, inRow, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\r\n },\r\n },\r\n /** Bring one column (from 0 at the left) forward and push the rest back. */\r\n focusColumn: {\r\n args: { column: Types.number(0, { min: 0, step: 1 }), ...lineFocus },\r\n run: (timeline, s, children) => {\r\n const slots = ItemGrid.itemSlots(timeline as never, s, children)\r\n const column = Math.round(timeline.args.column ?? 0)\r\n const inColumn = (i: number) => slots[i]?.meta.kind === \"rectangular\" && slots[i].meta.column === column\r\n return ItemGrid.focusOn(timeline as never, s, inColumn, slots.length, timeline.args.dim ?? 0.7, timeline.args.grow ?? 0.15)\r\n },\r\n },\r\n },\r\n ...ItemGrid.fields(arranger),\r\n}), arranger)\r\n\r\nexport type RectangularGrid = NodeOf<typeof RectangularGrid>\r\n/** What a call or a document row may set. */\r\nexport type RectangularGridProps = NonNullable<Parameters<typeof RectangularGrid>[0]>\r\n"]}
|
|
@@ -1,68 +1,200 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { ItemGrid
|
|
3
|
-
export interface SphereGridProps extends ItemGridProps {
|
|
4
|
-
radius: number;
|
|
5
|
-
yaw: number;
|
|
6
|
-
pitch: number;
|
|
7
|
-
roll: number;
|
|
8
|
-
facing: SphereFacing;
|
|
9
|
-
focalLength: number;
|
|
10
|
-
depthFade: number;
|
|
11
|
-
cullBackfaces: boolean;
|
|
12
|
-
spinSpeed: number;
|
|
13
|
-
}
|
|
1
|
+
import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
|
|
2
|
+
import { ItemGrid } from "../kit/index.js";
|
|
14
3
|
/**
|
|
15
4
|
* Children spread over a sphere — a Fibonacci lattice, as even as any number
|
|
16
5
|
* of points gets — and seen through a camera of the grid's own, so the far
|
|
17
6
|
* side is smaller, drawn first, and hidden where a face turns away.
|
|
18
7
|
*
|
|
19
8
|
* `outward` lays each item flat on the surface; `billboard` keeps each one
|
|
20
|
-
* facing the viewer, like labels on a globe.
|
|
21
|
-
*
|
|
9
|
+
* facing the viewer, like labels on a globe. `turnTo` brings any item round
|
|
10
|
+
* to the front.
|
|
22
11
|
*/
|
|
23
|
-
export declare
|
|
24
|
-
radius: number
|
|
25
|
-
yaw: number
|
|
26
|
-
pitch: number
|
|
27
|
-
roll: number
|
|
28
|
-
facing:
|
|
29
|
-
focalLength: number
|
|
30
|
-
depthFade: number
|
|
31
|
-
cullBackfaces: boolean;
|
|
32
|
-
spinSpeed: number
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
12
|
+
export declare const SphereGrid: import("@motionscript/sdk").Component<"sphereGrid", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
13
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
14
|
+
readonly yaw: import("@motionscript/sdk").Type<number, number, false>;
|
|
15
|
+
readonly pitch: import("@motionscript/sdk").Type<number, number, false>;
|
|
16
|
+
readonly roll: import("@motionscript/sdk").Type<number, number, false>;
|
|
17
|
+
readonly facing: import("@motionscript/sdk").Type<"outward" | "billboard", "outward" | "billboard", false>;
|
|
18
|
+
readonly focalLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
19
|
+
readonly depthFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
20
|
+
readonly cullBackfaces: boolean;
|
|
21
|
+
readonly spinSpeed: 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 spin: {
|
|
32
|
+
readonly axis: import("@motionscript/sdk").Type<"x" | "y" | "z", "x" | "y" | "z", false>;
|
|
33
|
+
readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
|
|
34
|
+
};
|
|
35
|
+
readonly orientTo: {
|
|
36
|
+
readonly yaw: import("@motionscript/sdk").Type<45 | undefined, 45 | undefined, false>;
|
|
37
|
+
readonly pitch: import("@motionscript/sdk").Type<20 | undefined, 20 | undefined, false>;
|
|
38
|
+
readonly roll: import("@motionscript/sdk").Type<0 | undefined, 0 | undefined, false>;
|
|
39
|
+
};
|
|
40
|
+
readonly turnTo: {
|
|
41
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
42
|
+
};
|
|
43
|
+
readonly radiusTo: {
|
|
44
|
+
readonly radius: import("@motionscript/sdk").Type<300 | undefined, 300 | undefined, false>;
|
|
45
|
+
};
|
|
46
|
+
readonly focalLengthTo: {
|
|
47
|
+
readonly focalLength: import("@motionscript/sdk").Type<600 | undefined, 600 | undefined, false>;
|
|
48
|
+
};
|
|
49
|
+
readonly reveal: {
|
|
50
|
+
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>;
|
|
51
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
52
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
53
|
+
};
|
|
54
|
+
readonly conceal: {
|
|
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 wave: {
|
|
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<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
63
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
64
|
+
};
|
|
65
|
+
readonly focus: {
|
|
66
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
67
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
68
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
69
|
+
};
|
|
70
|
+
readonly unfocus: unknown;
|
|
71
|
+
readonly spreadTo: {
|
|
72
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
73
|
+
};
|
|
74
|
+
readonly shuffle: {
|
|
75
|
+
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>;
|
|
76
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
77
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
78
|
+
};
|
|
79
|
+
readonly swap: {
|
|
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 first: import("@motionscript/sdk").Type<number, number, false>;
|
|
83
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
84
|
+
};
|
|
85
|
+
readonly reorder: {
|
|
86
|
+
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>;
|
|
87
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
88
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
89
|
+
};
|
|
90
|
+
readonly morphInto: {
|
|
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 target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
94
|
+
};
|
|
95
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
96
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
97
|
+
readonly yaw: import("@motionscript/sdk").Type<number, number, false>;
|
|
98
|
+
readonly pitch: import("@motionscript/sdk").Type<number, number, false>;
|
|
99
|
+
readonly roll: import("@motionscript/sdk").Type<number, number, false>;
|
|
100
|
+
readonly facing: import("@motionscript/sdk").Type<"outward" | "billboard", "outward" | "billboard", false>;
|
|
101
|
+
readonly focalLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
102
|
+
readonly depthFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
103
|
+
readonly cullBackfaces: boolean;
|
|
104
|
+
readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
|
|
105
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
106
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
107
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
108
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
109
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
110
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
111
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
112
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
113
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
114
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
115
|
+
readonly yaw: import("@motionscript/sdk").Type<number, number, false>;
|
|
116
|
+
readonly pitch: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
|
+
readonly roll: import("@motionscript/sdk").Type<number, number, false>;
|
|
118
|
+
readonly facing: import("@motionscript/sdk").Type<"outward" | "billboard", "outward" | "billboard", false>;
|
|
119
|
+
readonly focalLength: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
|
+
readonly depthFade: import("@motionscript/sdk").Type<number, number, false>;
|
|
121
|
+
readonly cullBackfaces: boolean;
|
|
122
|
+
readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
|
|
123
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
124
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
125
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
126
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
127
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
128
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
129
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
130
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
131
|
+
}>, {
|
|
132
|
+
readonly spin: {
|
|
133
|
+
readonly axis: import("@motionscript/sdk").Type<"x" | "y" | "z", "x" | "y" | "z", false>;
|
|
134
|
+
readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
|
|
135
|
+
};
|
|
136
|
+
readonly orientTo: {
|
|
137
|
+
readonly yaw: import("@motionscript/sdk").Type<45 | undefined, 45 | undefined, false>;
|
|
138
|
+
readonly pitch: import("@motionscript/sdk").Type<20 | undefined, 20 | undefined, false>;
|
|
139
|
+
readonly roll: import("@motionscript/sdk").Type<0 | undefined, 0 | undefined, false>;
|
|
140
|
+
};
|
|
141
|
+
readonly turnTo: {
|
|
142
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
143
|
+
};
|
|
144
|
+
readonly radiusTo: {
|
|
145
|
+
readonly radius: import("@motionscript/sdk").Type<300 | undefined, 300 | undefined, false>;
|
|
146
|
+
};
|
|
147
|
+
readonly focalLengthTo: {
|
|
148
|
+
readonly focalLength: import("@motionscript/sdk").Type<600 | undefined, 600 | undefined, false>;
|
|
149
|
+
};
|
|
150
|
+
readonly reveal: {
|
|
151
|
+
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>;
|
|
152
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
153
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
154
|
+
};
|
|
155
|
+
readonly conceal: {
|
|
156
|
+
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>;
|
|
157
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
158
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
159
|
+
};
|
|
160
|
+
readonly wave: {
|
|
161
|
+
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>;
|
|
162
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
163
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
164
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
165
|
+
};
|
|
166
|
+
readonly focus: {
|
|
167
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
168
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
169
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
170
|
+
};
|
|
171
|
+
readonly unfocus: unknown;
|
|
172
|
+
readonly spreadTo: {
|
|
173
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
174
|
+
};
|
|
175
|
+
readonly shuffle: {
|
|
176
|
+
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>;
|
|
177
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
178
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
179
|
+
};
|
|
180
|
+
readonly swap: {
|
|
181
|
+
readonly staggerOrder: import("@motionscript/sdk").Type<"path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", "path" | "row" | "column" | "angle" | "depth" | "index" | "reverse" | "random" | "centerOut" | "edgesIn", false>;
|
|
182
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
183
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
184
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
185
|
+
};
|
|
186
|
+
readonly reorder: {
|
|
187
|
+
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>;
|
|
188
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
189
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
190
|
+
};
|
|
191
|
+
readonly morphInto: {
|
|
192
|
+
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>;
|
|
193
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
194
|
+
readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
195
|
+
};
|
|
196
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
197
|
+
export type SphereGrid = NodeOf<typeof SphereGrid>;
|
|
198
|
+
/** What a call or a document row may set. */
|
|
199
|
+
export type SphereGridProps = NonNullable<Parameters<typeof SphereGrid>[0]>;
|
|
68
200
|
//# sourceMappingURL=sphere-grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sphere-grid.d.ts","sourceRoot":"","sources":["../../src/sphere-grid/sphere-grid.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"sphere-grid.d.ts","sourceRoot":"","sources":["../../src/sphere-grid/sphere-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EAGX,KAAK,MAAM,IAAI,OAAO,EACtB,KAAK,WAAW,IAAI,YAAY,EACjC,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EACL,QAAQ,EAQT,MAAM,QAAQ,CAAA;AAmCf;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA6DV,CAAA;AAEb,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,UAAU,CAAC,CAAA;AAClD,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { command, node, property } from "@motionscript/sdk";
|
|
1
|
+
import { component2d, Types, } from "@motionscript/sdk";
|
|
8
2
|
import { ItemGrid, normalizeOrder, SPHERE_AXES, SPHERE_FACINGS, sphereFaceForward, wrapDegrees, } from "../kit/index.js";
|
|
3
|
+
const own = {
|
|
4
|
+
radius: Types.number(220, { min: 0, step: 1 }),
|
|
5
|
+
yaw: Types.number(0, { step: 1, unit: "°" }),
|
|
6
|
+
pitch: Types.number(0, { step: 1, unit: "°" }),
|
|
7
|
+
roll: Types.number(0, { step: 1, unit: "°" }),
|
|
8
|
+
facing: Types.oneOf(SPHERE_FACINGS, { default: "outward" }),
|
|
9
|
+
focalLength: Types.number(900, { min: 100, step: 10 }),
|
|
10
|
+
depthFade: Types.number(0.5, { min: 0, max: 1, step: 0.05 }),
|
|
11
|
+
cullBackfaces: false,
|
|
12
|
+
spinSpeed: Types.number(0, { step: 1, unit: "°/s" }),
|
|
13
|
+
};
|
|
14
|
+
function arrangement(s) {
|
|
15
|
+
return {
|
|
16
|
+
kind: "sphere",
|
|
17
|
+
radius: s.radius,
|
|
18
|
+
yaw: s.yaw,
|
|
19
|
+
pitch: s.pitch,
|
|
20
|
+
roll: s.roll,
|
|
21
|
+
facing: s.facing,
|
|
22
|
+
focalLength: s.focalLength,
|
|
23
|
+
depthFade: s.depthFade,
|
|
24
|
+
cullBackfaces: s.cullBackfaces,
|
|
25
|
+
spinSpeed: s.spinSpeed,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const arranger = { arrangement };
|
|
9
29
|
const AXIS_PROP = { x: "pitch", y: "yaw", z: "roll" };
|
|
10
30
|
/**
|
|
11
31
|
* Children spread over a sphere — a Fibonacci lattice, as even as any number
|
|
@@ -13,137 +33,70 @@ const AXIS_PROP = { x: "pitch", y: "yaw", z: "roll" };
|
|
|
13
33
|
* side is smaller, drawn first, and hidden where a face turns away.
|
|
14
34
|
*
|
|
15
35
|
* `outward` lays each item flat on the surface; `billboard` keeps each one
|
|
16
|
-
* facing the viewer, like labels on a globe.
|
|
17
|
-
*
|
|
36
|
+
* facing the viewer, like labels on a globe. `turnTo` brings any item round
|
|
37
|
+
* to the front.
|
|
18
38
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
orientTo(args) {
|
|
31
|
-
return this.to({
|
|
32
|
-
data: { yaw: args.data?.yaw ?? this.yaw, pitch: args.data?.pitch ?? this.pitch, roll: args.data?.roll ?? this.roll },
|
|
33
|
-
duration: args.duration,
|
|
34
|
-
easing: args.easing,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/** Turn the sphere the shorter way until an item (by its place in the layers) faces the viewer. */
|
|
38
|
-
turnTo(args) {
|
|
39
|
-
const count = this._itemCount();
|
|
40
|
-
const slot = normalizeOrder(this.order, count).indexOf(Math.round(args.data?.item ?? 0));
|
|
41
|
-
if (slot < 0)
|
|
42
|
-
return this.to({ data: {}, duration: args.duration });
|
|
43
|
-
const facing = sphereFaceForward(count, slot);
|
|
44
|
-
// The yaw the clock has added is part of where the item is now.
|
|
45
|
-
const spun = this.spinSpeed * this.time.total;
|
|
46
|
-
return this.to({
|
|
47
|
-
data: {
|
|
48
|
-
yaw: this.yaw + wrapDegrees(facing.yaw - (this.yaw + spun)),
|
|
49
|
-
pitch: this.pitch + wrapDegrees(facing.pitch - this.pitch),
|
|
50
|
-
roll: 0,
|
|
39
|
+
export const SphereGrid = ItemGrid.define(component2d({
|
|
40
|
+
key: "sphereGrid",
|
|
41
|
+
state: { ...ItemGrid.state, ...own },
|
|
42
|
+
defaults: ItemGrid.defaults,
|
|
43
|
+
commands: {
|
|
44
|
+
...ItemGrid.commands,
|
|
45
|
+
/** Turn the sphere about an axis by `degrees` — `y` spins it like a globe. */
|
|
46
|
+
spin: {
|
|
47
|
+
args: {
|
|
48
|
+
axis: Types.oneOf(SPHERE_AXES, { default: "y" }),
|
|
49
|
+
degrees: Types.number(360, { step: 15, unit: "°" }),
|
|
51
50
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
], SphereGrid.prototype, "focalLength", void 0);
|
|
100
|
-
__decorate([
|
|
101
|
-
property({ default: 0.5, min: 0, max: 1, step: 0.05 })
|
|
102
|
-
], SphereGrid.prototype, "depthFade", void 0);
|
|
103
|
-
__decorate([
|
|
104
|
-
property({ default: false })
|
|
105
|
-
], SphereGrid.prototype, "cullBackfaces", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
property({ default: 0, step: 1, unit: "°/s" })
|
|
108
|
-
], SphereGrid.prototype, "spinSpeed", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
command({
|
|
111
|
-
args: [
|
|
112
|
-
{ key: "axis", kind: "enum", options: SPHERE_AXES, default: "y" },
|
|
113
|
-
{ key: "degrees", step: 15, unit: "°", default: 360 },
|
|
114
|
-
],
|
|
115
|
-
})
|
|
116
|
-
], SphereGrid.prototype, "spin", null);
|
|
117
|
-
__decorate([
|
|
118
|
-
command({
|
|
119
|
-
args: [
|
|
120
|
-
{ key: "yaw", unit: "°", default: 45 },
|
|
121
|
-
{ key: "pitch", unit: "°", default: 20 },
|
|
122
|
-
{ key: "roll", unit: "°", default: 0 },
|
|
123
|
-
],
|
|
124
|
-
})
|
|
125
|
-
], SphereGrid.prototype, "orientTo", null);
|
|
126
|
-
__decorate([
|
|
127
|
-
command({ args: [{ key: "item", min: 0, step: 1, default: 0 }] })
|
|
128
|
-
], SphereGrid.prototype, "turnTo", null);
|
|
129
|
-
__decorate([
|
|
130
|
-
command({ args: [{ key: "radius", min: 0, default: 300 }] })
|
|
131
|
-
], SphereGrid.prototype, "radiusTo", null);
|
|
132
|
-
__decorate([
|
|
133
|
-
command({ args: [{ key: "focalLength", min: 100, default: 600 }] })
|
|
134
|
-
], SphereGrid.prototype, "focalLengthTo", null);
|
|
135
|
-
SphereGrid = __decorate([
|
|
136
|
-
node({
|
|
137
|
-
key: "sphereGrid",
|
|
138
|
-
parentKey: "node",
|
|
139
|
-
forkable: true,
|
|
140
|
-
layout: {
|
|
141
|
-
children: "freeform",
|
|
142
|
-
acceptsChildren: true,
|
|
143
|
-
defaultWidthMode: "hug",
|
|
144
|
-
defaultHeightMode: "hug",
|
|
51
|
+
run: (timeline, s) => {
|
|
52
|
+
const key = AXIS_PROP[timeline.args.axis ?? "y"] ?? "yaw";
|
|
53
|
+
return timeline.tween({ [key]: s[key] + (timeline.args.degrees ?? 360) });
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
/** Turn the sphere to a set orientation. */
|
|
57
|
+
orientTo: {
|
|
58
|
+
args: {
|
|
59
|
+
yaw: ItemGrid.hinted(45, { unit: "°" }),
|
|
60
|
+
pitch: ItemGrid.hinted(20, { unit: "°" }),
|
|
61
|
+
roll: ItemGrid.hinted(0, { unit: "°" }),
|
|
62
|
+
},
|
|
63
|
+
run: (timeline, s) => timeline.tween({
|
|
64
|
+
yaw: timeline.args.yaw ?? s.yaw,
|
|
65
|
+
pitch: timeline.args.pitch ?? s.pitch,
|
|
66
|
+
roll: timeline.args.roll ?? s.roll,
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Turn the sphere the shorter way until an item (by its place in the layers)
|
|
71
|
+
* faces the viewer. It turns from the orientation the sphere is given: the
|
|
72
|
+
* yaw its `spinSpeed` adds by the time the command runs is not counted, as
|
|
73
|
+
* commands are built against the tree standing at time 0.
|
|
74
|
+
*/
|
|
75
|
+
turnTo: {
|
|
76
|
+
args: { item: Types.number(0, { min: 0, step: 1 }) },
|
|
77
|
+
run: (timeline, s, children) => {
|
|
78
|
+
const count = children.length;
|
|
79
|
+
const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0));
|
|
80
|
+
if (slot < 0)
|
|
81
|
+
return timeline.tween({});
|
|
82
|
+
const facing = sphereFaceForward(count, slot);
|
|
83
|
+
return timeline.tween({
|
|
84
|
+
yaw: s.yaw + wrapDegrees(facing.yaw - s.yaw),
|
|
85
|
+
pitch: s.pitch + wrapDegrees(facing.pitch - s.pitch),
|
|
86
|
+
roll: 0,
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
radiusTo: {
|
|
91
|
+
args: { radius: ItemGrid.hinted(300, { min: 0 }) },
|
|
92
|
+
run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),
|
|
93
|
+
},
|
|
94
|
+
/** Dolly the camera: a shorter focal length exaggerates the depth, a longer one flattens it. */
|
|
95
|
+
focalLengthTo: {
|
|
96
|
+
args: { focalLength: ItemGrid.hinted(600, { min: 100 }) },
|
|
97
|
+
run: (timeline, s) => timeline.tween({ focalLength: timeline.args.focalLength ?? s.focalLength }),
|
|
145
98
|
},
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
99
|
+
},
|
|
100
|
+
...ItemGrid.fields(arranger),
|
|
101
|
+
}), arranger);
|
|
149
102
|
//# sourceMappingURL=sphere-grid.js.map
|