@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,51 +1,177 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { ItemGrid
|
|
3
|
-
export interface RadialGridProps extends ItemGridProps {
|
|
4
|
-
radius: number;
|
|
5
|
-
startAngle: number;
|
|
6
|
-
sweep: number;
|
|
7
|
-
direction: RadialDirection;
|
|
8
|
-
rotateItems: boolean;
|
|
9
|
-
spinSpeed: number;
|
|
10
|
-
}
|
|
1
|
+
import { type NodeOf, type Node2D as _Node2D, type Node2DProps as _Node2DProps } from "@motionscript/sdk";
|
|
2
|
+
import { ItemGrid } from "../kit/index.js";
|
|
11
3
|
/**
|
|
12
4
|
* Children round a circle, or along an arc of one.
|
|
13
5
|
*
|
|
14
6
|
* A full circle spaces the items evenly with none on top of another; an arc
|
|
15
|
-
* puts one at each end. Angles run clockwise from twelve o'clock, so
|
|
16
|
-
*
|
|
7
|
+
* puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`
|
|
8
|
+
* can bring any item to the top like a dial.
|
|
17
9
|
*/
|
|
18
|
-
export declare
|
|
19
|
-
radius: number
|
|
20
|
-
startAngle: number
|
|
21
|
-
sweep: number
|
|
22
|
-
direction:
|
|
23
|
-
rotateItems: boolean;
|
|
24
|
-
spinSpeed: number
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
10
|
+
export declare const RadialGrid: import("@motionscript/sdk").Component<"radialGrid", import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
11
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
12
|
+
readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
|
|
13
|
+
readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
|
|
14
|
+
readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
|
|
15
|
+
readonly rotateItems: boolean;
|
|
16
|
+
readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
|
|
17
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
18
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
19
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
20
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
21
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
22
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
23
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
24
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
25
|
+
}>, {
|
|
26
|
+
readonly spin: {
|
|
27
|
+
readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
|
|
28
|
+
};
|
|
29
|
+
readonly turnTo: {
|
|
30
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
31
|
+
};
|
|
32
|
+
readonly radiusTo: {
|
|
33
|
+
readonly radius: import("@motionscript/sdk").Type<280 | undefined, 280 | undefined, false>;
|
|
34
|
+
};
|
|
35
|
+
readonly sweepTo: {
|
|
36
|
+
readonly sweep: import("@motionscript/sdk").Type<360 | undefined, 360 | undefined, false>;
|
|
37
|
+
};
|
|
38
|
+
readonly reveal: {
|
|
39
|
+
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>;
|
|
40
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
41
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
42
|
+
};
|
|
43
|
+
readonly conceal: {
|
|
44
|
+
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>;
|
|
45
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
46
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
47
|
+
};
|
|
48
|
+
readonly wave: {
|
|
49
|
+
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>;
|
|
50
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
51
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
52
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
53
|
+
};
|
|
54
|
+
readonly focus: {
|
|
55
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
56
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
57
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
58
|
+
};
|
|
59
|
+
readonly unfocus: unknown;
|
|
60
|
+
readonly spreadTo: {
|
|
61
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
62
|
+
};
|
|
63
|
+
readonly shuffle: {
|
|
64
|
+
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>;
|
|
65
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
66
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
67
|
+
};
|
|
68
|
+
readonly swap: {
|
|
69
|
+
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>;
|
|
70
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
71
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
72
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
73
|
+
};
|
|
74
|
+
readonly reorder: {
|
|
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 order: import("@motionscript/sdk").Type<string, string, false>;
|
|
78
|
+
};
|
|
79
|
+
readonly morphInto: {
|
|
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 target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
83
|
+
};
|
|
84
|
+
}, null, _Node2D<_Node2DProps>, import("@motionscript/sdk").CallProps<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
85
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
86
|
+
readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
|
|
87
|
+
readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
|
|
88
|
+
readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
|
|
89
|
+
readonly rotateItems: boolean;
|
|
90
|
+
readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
|
|
91
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
92
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
93
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
94
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
95
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
96
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
97
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
98
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
99
|
+
}>, null, import("@motionscript/sdk").BuiltNode<import("@motionscript/sdk").Merge<import("@motionscript/sdk").Box2DState, {
|
|
100
|
+
readonly radius: import("@motionscript/sdk").Type<number, number, false>;
|
|
101
|
+
readonly startAngle: import("@motionscript/sdk").Type<number, number, false>;
|
|
102
|
+
readonly sweep: import("@motionscript/sdk").Type<number, number, false>;
|
|
103
|
+
readonly direction: import("@motionscript/sdk").Type<"clockwise" | "counterclockwise", "clockwise" | "counterclockwise", false>;
|
|
104
|
+
readonly rotateItems: boolean;
|
|
105
|
+
readonly spinSpeed: import("@motionscript/sdk").Type<number, number, false>;
|
|
106
|
+
readonly order: import("@motionscript/sdk").Type<number[], number[], false>;
|
|
107
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
108
|
+
readonly arrangeLike: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, false>;
|
|
109
|
+
readonly revealState: import("@motionscript/sdk").Type<import("../index.js").RevealState | null | undefined, import("../index.js").RevealState | null | undefined, false>;
|
|
110
|
+
readonly waveState: import("@motionscript/sdk").Type<import("../index.js").WaveState | null | undefined, import("../index.js").WaveState | null | undefined, false>;
|
|
111
|
+
readonly focusState: import("@motionscript/sdk").Type<import("../index.js").FocusState | null | undefined, import("../index.js").FocusState | null | undefined, false>;
|
|
112
|
+
readonly transition: import("@motionscript/sdk").Type<ItemGrid.GridTransition | null | undefined, ItemGrid.GridTransition | null | undefined, false>;
|
|
113
|
+
readonly transitionSource: import("@motionscript/sdk").Type<string, import("@motionscript/sdk").NodeView<import("@motionscript/sdk").Element<string, unknown, unknown>> | null, true>;
|
|
114
|
+
}>, {
|
|
115
|
+
readonly spin: {
|
|
116
|
+
readonly degrees: import("@motionscript/sdk").Type<number, number, false>;
|
|
117
|
+
};
|
|
118
|
+
readonly turnTo: {
|
|
119
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
120
|
+
};
|
|
121
|
+
readonly radiusTo: {
|
|
122
|
+
readonly radius: import("@motionscript/sdk").Type<280 | undefined, 280 | undefined, false>;
|
|
123
|
+
};
|
|
124
|
+
readonly sweepTo: {
|
|
125
|
+
readonly sweep: import("@motionscript/sdk").Type<360 | undefined, 360 | undefined, false>;
|
|
126
|
+
};
|
|
127
|
+
readonly reveal: {
|
|
128
|
+
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>;
|
|
129
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
130
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
131
|
+
};
|
|
132
|
+
readonly conceal: {
|
|
133
|
+
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>;
|
|
134
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
135
|
+
readonly style: import("@motionscript/sdk").Type<"center" | "scale" | "fade" | "rise" | "flip" | "spin", "center" | "scale" | "fade" | "rise" | "flip" | "spin", false>;
|
|
136
|
+
};
|
|
137
|
+
readonly wave: {
|
|
138
|
+
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>;
|
|
139
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
140
|
+
readonly style: import("@motionscript/sdk").Type<"scale" | "fade" | "spin" | "lift", "scale" | "fade" | "spin" | "lift", false>;
|
|
141
|
+
readonly amount: import("@motionscript/sdk").Type<number, number, false>;
|
|
142
|
+
};
|
|
143
|
+
readonly focus: {
|
|
144
|
+
readonly item: import("@motionscript/sdk").Type<number, number, false>;
|
|
145
|
+
readonly dim: import("@motionscript/sdk").Type<number, number, false>;
|
|
146
|
+
readonly grow: import("@motionscript/sdk").Type<number, number, false>;
|
|
147
|
+
};
|
|
148
|
+
readonly unfocus: unknown;
|
|
149
|
+
readonly spreadTo: {
|
|
150
|
+
readonly spread: import("@motionscript/sdk").Type<number, number, false>;
|
|
151
|
+
};
|
|
152
|
+
readonly shuffle: {
|
|
153
|
+
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>;
|
|
154
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
155
|
+
readonly seed: import("@motionscript/sdk").Type<number, number, false>;
|
|
156
|
+
};
|
|
157
|
+
readonly swap: {
|
|
158
|
+
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>;
|
|
159
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
160
|
+
readonly first: import("@motionscript/sdk").Type<number, number, false>;
|
|
161
|
+
readonly second: import("@motionscript/sdk").Type<number, number, false>;
|
|
162
|
+
};
|
|
163
|
+
readonly reorder: {
|
|
164
|
+
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>;
|
|
165
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
166
|
+
readonly order: import("@motionscript/sdk").Type<string, string, false>;
|
|
167
|
+
};
|
|
168
|
+
readonly morphInto: {
|
|
169
|
+
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>;
|
|
170
|
+
readonly stagger: import("@motionscript/sdk").Type<number, number, false>;
|
|
171
|
+
readonly target: import("@motionscript/sdk").Type<string | undefined, string | undefined, false>;
|
|
172
|
+
};
|
|
173
|
+
}, _Node2D<_Node2DProps>>>>;
|
|
174
|
+
export type RadialGrid = NodeOf<typeof RadialGrid>;
|
|
175
|
+
/** What a call or a document row may set. */
|
|
176
|
+
export type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>;
|
|
51
177
|
//# sourceMappingURL=radial-grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radial-grid.d.ts","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"radial-grid.d.ts","sourceRoot":"","sources":["../../src/radial-grid/radial-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,EAAE,QAAQ,EAA8E,MAAM,QAAQ,CAAA;AA2B7G;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAgCV,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,95 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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" }),
|
|
6
10
|
};
|
|
7
|
-
|
|
8
|
-
|
|
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 };
|
|
9
23
|
/**
|
|
10
24
|
* Children round a circle, or along an arc of one.
|
|
11
25
|
*
|
|
12
26
|
* A full circle spaces the items evenly with none on top of another; an arc
|
|
13
|
-
* puts one at each end. Angles run clockwise from twelve o'clock, so
|
|
14
|
-
*
|
|
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.
|
|
15
29
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
sweep:
|
|
45
|
-
direction: this.direction,
|
|
46
|
-
rotateItems: this.rotateItems,
|
|
47
|
-
spinSpeed: this.spinSpeed,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
__decorate([
|
|
52
|
-
property({ default: 200, min: 0, step: 1 })
|
|
53
|
-
], RadialGrid.prototype, "radius", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
property({ default: 0, step: 1, unit: "°" })
|
|
56
|
-
], RadialGrid.prototype, "startAngle", void 0);
|
|
57
|
-
__decorate([
|
|
58
|
-
property({ default: 360, min: -360, max: 360, step: 1, unit: "°" })
|
|
59
|
-
], RadialGrid.prototype, "sweep", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
property({ default: "clockwise", kind: "enum", options: RADIAL_DIRECTIONS })
|
|
62
|
-
], RadialGrid.prototype, "direction", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
property({ default: false })
|
|
65
|
-
], RadialGrid.prototype, "rotateItems", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
property({ default: 0, step: 1, unit: "°/s" })
|
|
68
|
-
], RadialGrid.prototype, "spinSpeed", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
command({ args: [{ key: "degrees", step: 15, unit: "°", default: 360 }] })
|
|
71
|
-
], RadialGrid.prototype, "spin", null);
|
|
72
|
-
__decorate([
|
|
73
|
-
command({ args: [{ key: "item", min: 0, step: 1, default: 0 }] })
|
|
74
|
-
], RadialGrid.prototype, "turnTo", null);
|
|
75
|
-
__decorate([
|
|
76
|
-
command({ args: [{ key: "radius", min: 0, default: 280 }] })
|
|
77
|
-
], RadialGrid.prototype, "radiusTo", null);
|
|
78
|
-
__decorate([
|
|
79
|
-
command({ args: [{ key: "sweep", min: -360, max: 360, unit: "°", default: 360 }] })
|
|
80
|
-
], RadialGrid.prototype, "sweepTo", null);
|
|
81
|
-
RadialGrid = __decorate([
|
|
82
|
-
node({
|
|
83
|
-
key: "radialGrid",
|
|
84
|
-
parentKey: "node",
|
|
85
|
-
forkable: true,
|
|
86
|
-
layout: {
|
|
87
|
-
children: "freeform",
|
|
88
|
-
acceptsChildren: true,
|
|
89
|
-
defaultWidthMode: "hug",
|
|
90
|
-
defaultHeightMode: "hug",
|
|
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 }),
|
|
91
59
|
},
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
60
|
+
},
|
|
61
|
+
...ItemGrid.fields(arranger),
|
|
62
|
+
}), arranger);
|
|
95
63
|
//# sourceMappingURL=radial-grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radial-grid.js","sourceRoot":"","sources":["../../src/radial-grid/radial-grid.ts"],"names":[],"mappings":"
|
|
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,EAA0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IAAI,EAAE,EAAE,MAAM,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 {\r\n component2d,\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 { ItemGrid, normalizeOrder, RADIAL_DIRECTIONS, radialTurnToTop, type RadialArrangement } from \"../kit\"\r\n\r\nconst own = {\r\n radius: Types.number(200, { min: 0, step: 1 }),\r\n startAngle: Types.number(0, { step: 1, unit: \"°\" }),\r\n sweep: Types.number(360, { min: -360, max: 360, step: 1, unit: \"°\" }),\r\n direction: Types.oneOf(RADIAL_DIRECTIONS, { default: \"clockwise\" }),\r\n rotateItems: false,\r\n spinSpeed: Types.number(0, { step: 1, unit: \"°/s\" }),\r\n}\r\n\r\ntype Own = Values<typeof own>\r\n\r\nfunction arrangement(s: Own): RadialArrangement {\r\n return {\r\n kind: \"radial\",\r\n radius: s.radius,\r\n startAngle: s.startAngle,\r\n sweep: s.sweep,\r\n direction: s.direction,\r\n rotateItems: s.rotateItems,\r\n spinSpeed: s.spinSpeed,\r\n }\r\n}\r\n\r\nconst arranger: ItemGrid.Arranger<Own> = { arrangement }\r\n\r\n/**\r\n * Children round a circle, or along an arc of one.\r\n *\r\n * A full circle spaces the items evenly with none on top of another; an arc\r\n * puts one at each end. Angles run clockwise from twelve o'clock, so `turnTo`\r\n * can bring any item to the top like a dial.\r\n */\r\nexport const RadialGrid = ItemGrid.define(component2d({\r\n key: \"radialGrid\",\r\n state: { ...ItemGrid.state, ...own },\r\n defaults: ItemGrid.defaults,\r\n commands: {\r\n ...ItemGrid.commands,\r\n /** Orbit the items round the centre by `degrees` — `360` is one full turn. */\r\n spin: {\r\n args: { degrees: Types.number(360, { step: 15, unit: \"°\" }) },\r\n run: (timeline, s) => timeline.tween({ startAngle: s.startAngle + (timeline.args.degrees ?? 360) }),\r\n },\r\n /** Turn the ring the shorter way round until an item (by its place in the layers) sits at the top. */\r\n turnTo: {\r\n args: { item: Types.number(0, { min: 0, step: 1 }) },\r\n run: (timeline, s, children) => {\r\n const count = children.length\r\n const slot = normalizeOrder(s.order, count).indexOf(Math.round(timeline.args.item ?? 0))\r\n const turn = slot < 0 ? 0 : radialTurnToTop(arrangement(s), count, slot)\r\n return timeline.tween({ startAngle: s.startAngle + turn })\r\n },\r\n },\r\n radiusTo: {\r\n args: { radius: ItemGrid.hinted(280, { min: 0 }) },\r\n run: (timeline, s) => timeline.tween({ radius: timeline.args.radius ?? s.radius }),\r\n },\r\n /** Open or close the arc like a fan — from `0` to `360` is a reveal of its own. */\r\n sweepTo: {\r\n args: { sweep: ItemGrid.hinted(360, { min: -360, max: 360, unit: \"°\" }) },\r\n run: (timeline, s) => timeline.tween({ sweep: timeline.args.sweep ?? s.sweep }),\r\n },\r\n },\r\n ...ItemGrid.fields(arranger),\r\n}), arranger)\r\n\r\nexport type RadialGrid = NodeOf<typeof RadialGrid>\r\n/** What a call or a document row may set. */\r\nexport type RadialGridProps = NonNullable<Parameters<typeof RadialGrid>[0]>\r\n"]}
|