@motionscript/patterns 0.1.0-alpha.7 → 0.1.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -48
- package/README.md +83 -83
- package/dist/browser/chunks/{chunk-REWLNFZ2.js → chunk-FXDYEY4R.js} +1 -1
- package/dist/browser/chunks/chunk-FXDYEY4R.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/kit.js +1 -1
- package/dist/browser/manifest.json +1 -1
- package/dist/dot-grid-pattern/dot-grid-pattern.js.map +1 -1
- package/dist/dot-grid-pattern/index.js.map +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.js +1 -1
- package/dist/engine.js.map +1 -1
- package/dist/grid-pattern/grid-pattern.js.map +1 -1
- package/dist/grid-pattern/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/kit/grid-lines.js.map +1 -1
- package/dist/kit/index.js.map +1 -1
- package/dist/kit/viewport-pattern.d.ts.map +1 -1
- package/dist/kit/viewport-pattern.js.map +1 -1
- package/dist/line-grid-pattern/index.js.map +1 -1
- package/dist/line-grid-pattern/line-grid-pattern.js.map +1 -1
- package/dist/nodes.js.map +1 -1
- package/package.json +5 -4
- package/registry.json +26 -26
- package/src/dot-grid-pattern/dot-grid-pattern.ts +155 -155
- package/src/dot-grid-pattern/index.ts +1 -1
- package/src/engine.ts +11 -11
- package/src/grid-pattern/grid-pattern.ts +176 -176
- package/src/grid-pattern/index.ts +1 -1
- package/src/index.ts +5 -5
- package/src/kit/grid-lines.ts +223 -223
- package/src/kit/index.ts +2 -2
- package/src/kit/viewport-pattern.ts +109 -109
- package/src/line-grid-pattern/index.ts +1 -1
- package/src/line-grid-pattern/line-grid-pattern.ts +117 -117
- package/src/nodes.ts +27 -27
- package/dist/browser/chunks/chunk-REWLNFZ2.js.map +0 -7
|
@@ -1,176 +1,176 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Graphics2D,
|
|
3
|
-
Types,
|
|
4
|
-
component2d,
|
|
5
|
-
lerpNumber,
|
|
6
|
-
lerpVector2,
|
|
7
|
-
type BoxBounds,
|
|
8
|
-
type NodeOf,
|
|
9
|
-
type PathCommand,
|
|
10
|
-
type RenderContext,
|
|
11
|
-
type ShadowResolved,
|
|
12
|
-
type FillResolved,
|
|
13
|
-
type StrokeResolved,
|
|
14
|
-
type Vector2,
|
|
15
|
-
// Named so the emitted declaration reaches these through the sdk, not core.
|
|
16
|
-
type Alignment as _Alignment,
|
|
17
|
-
type Fill as _Fill,
|
|
18
|
-
type FlowMode as _FlowMode,
|
|
19
|
-
type FlowResolved as _FlowResolved,
|
|
20
|
-
type GapSize as _GapSize,
|
|
21
|
-
type Node2D as _Node2D,
|
|
22
|
-
type Node2DProps as _Node2DProps,
|
|
23
|
-
type Shadow as _Shadow,
|
|
24
|
-
type Stroke as _Stroke,
|
|
25
|
-
} from "@motionscript/sdk";
|
|
26
|
-
|
|
27
|
-
import { centered, defaultSubStroke, gridLines, maxWeight, ViewportPattern, type GridAxis } from "../kit";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* An infinite line grid that fills the camera's visible region. Like
|
|
31
|
-
* `LineGridPattern` it draws major and minor strokes over a fill and pans
|
|
32
|
-
* with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across
|
|
33
|
-
* what the nearest `Camera` above it can see, regenerated each frame. With no
|
|
34
|
-
* camera it fills its own layout rect.
|
|
35
|
-
*/
|
|
36
|
-
export const GridPattern = component2d({
|
|
37
|
-
key: "gridPattern",
|
|
38
|
-
state: {
|
|
39
|
-
...ViewportPattern.state,
|
|
40
|
-
/** Spacing between grid lines in world units: one number for both axes, or `{ x, y }`. */
|
|
41
|
-
cellSize: Types.custom<number | Vector2>(100, { lerp: lerpCellSize }),
|
|
42
|
-
/** Finer cells each cell is split into, as in `LineGridPattern.subdivisions`. */
|
|
43
|
-
subdivisions: 1,
|
|
44
|
-
/** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */
|
|
45
|
-
subStroke: Types.stroke,
|
|
46
|
-
/** Scrolls the pattern relative to the world, which it is otherwise anchored to. */
|
|
47
|
-
offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),
|
|
48
|
-
},
|
|
49
|
-
defaults: { subStroke: (_state, given) => defaultSubStroke(given) },
|
|
50
|
-
commands: { ...ViewportPattern.commands },
|
|
51
|
-
measure: ViewportPattern.measure,
|
|
52
|
-
layout: ViewportPattern.layout,
|
|
53
|
-
render: (ctx, state) => ViewportPattern.draw(ctx, (bounds) => drawGrid(ctx, state, bounds)),
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
export type GridPattern = NodeOf<typeof GridPattern>;
|
|
57
|
-
/** What a call or a document row may set. */
|
|
58
|
-
export type GridPatternProps = NonNullable<Parameters<typeof GridPattern>[0]>;
|
|
59
|
-
|
|
60
|
-
interface GridState {
|
|
61
|
-
readonly fill: FillResolved[];
|
|
62
|
-
readonly stroke: StrokeResolved[];
|
|
63
|
-
readonly shadow: ShadowResolved[];
|
|
64
|
-
readonly start: number;
|
|
65
|
-
readonly end: number;
|
|
66
|
-
readonly cellSize: number | Vector2;
|
|
67
|
-
readonly subdivisions: number;
|
|
68
|
-
readonly subStroke: StrokeResolved[];
|
|
69
|
-
readonly offset: Vector2;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function drawGrid(ctx: RenderContext, s: GridState, bounds: BoxBounds): void {
|
|
73
|
-
const halfW = bounds.width / 2;
|
|
74
|
-
const halfH = bounds.height / 2;
|
|
75
|
-
// `bounds` is centred on (x, y) in y-up world space: descriptor coordinates are y-up
|
|
76
|
-
// and the renderer applies the single flip.
|
|
77
|
-
const left = bounds.x - halfW;
|
|
78
|
-
const right = bounds.x + halfW;
|
|
79
|
-
const top = bounds.y - halfH;
|
|
80
|
-
const bottom = bounds.y + halfH;
|
|
81
|
-
|
|
82
|
-
ctx.draw(new Graphics2D()
|
|
83
|
-
.rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, start: s.start, end: s.end })
|
|
84
|
-
.shadow(s.shadow)
|
|
85
|
-
.fill(s.fill));
|
|
86
|
-
|
|
87
|
-
const subdivisions = Math.max(1, Math.floor(s.subdivisions));
|
|
88
|
-
const cell = s.cellSize;
|
|
89
|
-
const cellX = Math.max(1e-3, typeof cell === "number" ? cell : cell.x);
|
|
90
|
-
const cellY = Math.max(1e-3, typeof cell === "number" ? cell : cell.y);
|
|
91
|
-
const stepX = cellX / subdivisions;
|
|
92
|
-
const stepY = cellY / subdivisions;
|
|
93
|
-
|
|
94
|
-
const major = centered(s.stroke);
|
|
95
|
-
const minorStroke = centered(s.subStroke);
|
|
96
|
-
const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;
|
|
97
|
-
|
|
98
|
-
const xAxis: GridAxis = { min: left, max: right, step: stepX, offset: s.offset.x };
|
|
99
|
-
const yAxis: GridAxis = { min: top, max: bottom, step: stepY, offset: s.offset.y };
|
|
100
|
-
|
|
101
|
-
// Minor lines first so the major lines sit on top.
|
|
102
|
-
if (subdivisions > 1 && minorStroke.length > 0) {
|
|
103
|
-
drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, minorStroke, false);
|
|
104
|
-
}
|
|
105
|
-
if (major.length > 0) {
|
|
106
|
-
drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, major, true);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// A solid stroke paints the group as one union path. A dashed one draws each line on
|
|
111
|
-
// its own with its dash phase anchored to the line's world coordinate, so dashes never
|
|
112
|
-
// crawl as the camera pans or new lines scroll in.
|
|
113
|
-
function drawGroup(
|
|
114
|
-
ctx: RenderContext,
|
|
115
|
-
xAxis: GridAxis,
|
|
116
|
-
yAxis: GridAxis,
|
|
117
|
-
subdivisions: number,
|
|
118
|
-
overscan: number,
|
|
119
|
-
stroke: StrokeResolved[],
|
|
120
|
-
isMajor: boolean,
|
|
121
|
-
): void {
|
|
122
|
-
// Each line spans a whole number of dash cycles, so the renderer's per-path dash-fit
|
|
123
|
-
// is a no-op and every line dashes identically.
|
|
124
|
-
const cycle = dashCycle(stroke);
|
|
125
|
-
const g = gridLines(xAxis, yAxis, subdivisions, overscan, cycle);
|
|
126
|
-
const verticals = isMajor ? g.verticalMajor : g.verticalMinor;
|
|
127
|
-
const horizontals = isMajor ? g.horizontalMajor : g.horizontalMinor;
|
|
128
|
-
|
|
129
|
-
// Symmetric centerBounds give a zero recentre offset, so local coordinates draw verbatim.
|
|
130
|
-
const centerBounds = [-1, -1, 1, 1] as const;
|
|
131
|
-
|
|
132
|
-
if (cycle <= 0) {
|
|
133
|
-
const data: PathCommand[] = [];
|
|
134
|
-
for (const px of verticals) data.push({ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom });
|
|
135
|
-
for (const py of horizontals) data.push({ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py });
|
|
136
|
-
if (data.length > 0) ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(stroke));
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
for (const px of verticals) {
|
|
141
|
-
const data: PathCommand[] = [{ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom }];
|
|
142
|
-
ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.top)));
|
|
143
|
-
}
|
|
144
|
-
for (const py of horizontals) {
|
|
145
|
-
const data: PathCommand[] = [{ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py }];
|
|
146
|
-
ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.left)));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// The largest dash-array sum across the layers, or 0 when none is dashed.
|
|
151
|
-
function dashCycle(strokes: StrokeResolved[]): number {
|
|
152
|
-
let cycle = 0;
|
|
153
|
-
for (const s of strokes) {
|
|
154
|
-
if (s.dash && s.dash.length > 0) {
|
|
155
|
-
const sum = s.dash.reduce((a, b) => a + b, 0);
|
|
156
|
-
if (sum > cycle) cycle = sum;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return cycle;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// `dashOffset` advances the pattern, so it is negated to put the "on" run at the phase one
|
|
163
|
-
// infinite line would have at this world coordinate.
|
|
164
|
-
function phaseShift(strokes: StrokeResolved[], worldStart: number): StrokeResolved[] {
|
|
165
|
-
return strokes.map(s => (s.dash && s.dash.length > 0)
|
|
166
|
-
? { ...s, dashOffset: (s.dashOffset ?? 0) - worldStart }
|
|
167
|
-
: s);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// A number and a vector tween by promoting the number to a uniform vector.
|
|
171
|
-
function lerpCellSize(from: number | Vector2, to: number | Vector2, t: number): number | Vector2 {
|
|
172
|
-
if (typeof from === "number" && typeof to === "number") return lerpNumber(from, to, t);
|
|
173
|
-
const a = typeof from === "number" ? { x: from, y: from } : from;
|
|
174
|
-
const b = typeof to === "number" ? { x: to, y: to } : to;
|
|
175
|
-
return lerpVector2(a, b, t);
|
|
176
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Graphics2D,
|
|
3
|
+
Types,
|
|
4
|
+
component2d,
|
|
5
|
+
lerpNumber,
|
|
6
|
+
lerpVector2,
|
|
7
|
+
type BoxBounds,
|
|
8
|
+
type NodeOf,
|
|
9
|
+
type PathCommand,
|
|
10
|
+
type RenderContext,
|
|
11
|
+
type ShadowResolved,
|
|
12
|
+
type FillResolved,
|
|
13
|
+
type StrokeResolved,
|
|
14
|
+
type Vector2,
|
|
15
|
+
// Named so the emitted declaration reaches these through the sdk, not core.
|
|
16
|
+
type Alignment as _Alignment,
|
|
17
|
+
type Fill as _Fill,
|
|
18
|
+
type FlowMode as _FlowMode,
|
|
19
|
+
type FlowResolved as _FlowResolved,
|
|
20
|
+
type GapSize as _GapSize,
|
|
21
|
+
type Node2D as _Node2D,
|
|
22
|
+
type Node2DProps as _Node2DProps,
|
|
23
|
+
type Shadow as _Shadow,
|
|
24
|
+
type Stroke as _Stroke,
|
|
25
|
+
} from "@motionscript/sdk";
|
|
26
|
+
|
|
27
|
+
import { centered, defaultSubStroke, gridLines, maxWeight, ViewportPattern, type GridAxis } from "../kit";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An infinite line grid that fills the camera's visible region. Like
|
|
31
|
+
* `LineGridPattern` it draws major and minor strokes over a fill and pans
|
|
32
|
+
* with `offset`, but it tiles a world-anchored grid (spacing `cellSize`) across
|
|
33
|
+
* what the nearest `Camera` above it can see, regenerated each frame. With no
|
|
34
|
+
* camera it fills its own layout rect.
|
|
35
|
+
*/
|
|
36
|
+
export const GridPattern = component2d({
|
|
37
|
+
key: "gridPattern",
|
|
38
|
+
state: {
|
|
39
|
+
...ViewportPattern.state,
|
|
40
|
+
/** Spacing between grid lines in world units: one number for both axes, or `{ x, y }`. */
|
|
41
|
+
cellSize: Types.custom<number | Vector2>(100, { lerp: lerpCellSize }),
|
|
42
|
+
/** Finer cells each cell is split into, as in `LineGridPattern.subdivisions`. */
|
|
43
|
+
subdivisions: 1,
|
|
44
|
+
/** Stroke for the minor lines. Unset, the major `stroke` at half opacity when `subdivisions > 1`. */
|
|
45
|
+
subStroke: Types.stroke,
|
|
46
|
+
/** Scrolls the pattern relative to the world, which it is otherwise anchored to. */
|
|
47
|
+
offset: Types.custom<Vector2>({ x: 0, y: 0 }, { lerp: lerpVector2 }),
|
|
48
|
+
},
|
|
49
|
+
defaults: { subStroke: (_state, given) => defaultSubStroke(given) },
|
|
50
|
+
commands: { ...ViewportPattern.commands },
|
|
51
|
+
measure: ViewportPattern.measure,
|
|
52
|
+
layout: ViewportPattern.layout,
|
|
53
|
+
render: (ctx, state) => ViewportPattern.draw(ctx, (bounds) => drawGrid(ctx, state, bounds)),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export type GridPattern = NodeOf<typeof GridPattern>;
|
|
57
|
+
/** What a call or a document row may set. */
|
|
58
|
+
export type GridPatternProps = NonNullable<Parameters<typeof GridPattern>[0]>;
|
|
59
|
+
|
|
60
|
+
interface GridState {
|
|
61
|
+
readonly fill: FillResolved[];
|
|
62
|
+
readonly stroke: StrokeResolved[];
|
|
63
|
+
readonly shadow: ShadowResolved[];
|
|
64
|
+
readonly start: number;
|
|
65
|
+
readonly end: number;
|
|
66
|
+
readonly cellSize: number | Vector2;
|
|
67
|
+
readonly subdivisions: number;
|
|
68
|
+
readonly subStroke: StrokeResolved[];
|
|
69
|
+
readonly offset: Vector2;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function drawGrid(ctx: RenderContext, s: GridState, bounds: BoxBounds): void {
|
|
73
|
+
const halfW = bounds.width / 2;
|
|
74
|
+
const halfH = bounds.height / 2;
|
|
75
|
+
// `bounds` is centred on (x, y) in y-up world space: descriptor coordinates are y-up
|
|
76
|
+
// and the renderer applies the single flip.
|
|
77
|
+
const left = bounds.x - halfW;
|
|
78
|
+
const right = bounds.x + halfW;
|
|
79
|
+
const top = bounds.y - halfH;
|
|
80
|
+
const bottom = bounds.y + halfH;
|
|
81
|
+
|
|
82
|
+
ctx.draw(new Graphics2D()
|
|
83
|
+
.rect({ x: bounds.x, y: bounds.y, width: bounds.width, height: bounds.height, start: s.start, end: s.end })
|
|
84
|
+
.shadow(s.shadow)
|
|
85
|
+
.fill(s.fill));
|
|
86
|
+
|
|
87
|
+
const subdivisions = Math.max(1, Math.floor(s.subdivisions));
|
|
88
|
+
const cell = s.cellSize;
|
|
89
|
+
const cellX = Math.max(1e-3, typeof cell === "number" ? cell : cell.x);
|
|
90
|
+
const cellY = Math.max(1e-3, typeof cell === "number" ? cell : cell.y);
|
|
91
|
+
const stepX = cellX / subdivisions;
|
|
92
|
+
const stepY = cellY / subdivisions;
|
|
93
|
+
|
|
94
|
+
const major = centered(s.stroke);
|
|
95
|
+
const minorStroke = centered(s.subStroke);
|
|
96
|
+
const overscan = Math.max(maxWeight(major), maxWeight(minorStroke)) / 2;
|
|
97
|
+
|
|
98
|
+
const xAxis: GridAxis = { min: left, max: right, step: stepX, offset: s.offset.x };
|
|
99
|
+
const yAxis: GridAxis = { min: top, max: bottom, step: stepY, offset: s.offset.y };
|
|
100
|
+
|
|
101
|
+
// Minor lines first so the major lines sit on top.
|
|
102
|
+
if (subdivisions > 1 && minorStroke.length > 0) {
|
|
103
|
+
drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, minorStroke, false);
|
|
104
|
+
}
|
|
105
|
+
if (major.length > 0) {
|
|
106
|
+
drawGroup(ctx, xAxis, yAxis, subdivisions, overscan, major, true);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// A solid stroke paints the group as one union path. A dashed one draws each line on
|
|
111
|
+
// its own with its dash phase anchored to the line's world coordinate, so dashes never
|
|
112
|
+
// crawl as the camera pans or new lines scroll in.
|
|
113
|
+
function drawGroup(
|
|
114
|
+
ctx: RenderContext,
|
|
115
|
+
xAxis: GridAxis,
|
|
116
|
+
yAxis: GridAxis,
|
|
117
|
+
subdivisions: number,
|
|
118
|
+
overscan: number,
|
|
119
|
+
stroke: StrokeResolved[],
|
|
120
|
+
isMajor: boolean,
|
|
121
|
+
): void {
|
|
122
|
+
// Each line spans a whole number of dash cycles, so the renderer's per-path dash-fit
|
|
123
|
+
// is a no-op and every line dashes identically.
|
|
124
|
+
const cycle = dashCycle(stroke);
|
|
125
|
+
const g = gridLines(xAxis, yAxis, subdivisions, overscan, cycle);
|
|
126
|
+
const verticals = isMajor ? g.verticalMajor : g.verticalMinor;
|
|
127
|
+
const horizontals = isMajor ? g.horizontalMajor : g.horizontalMinor;
|
|
128
|
+
|
|
129
|
+
// Symmetric centerBounds give a zero recentre offset, so local coordinates draw verbatim.
|
|
130
|
+
const centerBounds = [-1, -1, 1, 1] as const;
|
|
131
|
+
|
|
132
|
+
if (cycle <= 0) {
|
|
133
|
+
const data: PathCommand[] = [];
|
|
134
|
+
for (const px of verticals) data.push({ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom });
|
|
135
|
+
for (const py of horizontals) data.push({ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py });
|
|
136
|
+
if (data.length > 0) ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(stroke));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for (const px of verticals) {
|
|
141
|
+
const data: PathCommand[] = [{ type: "M", x: px, y: g.top }, { type: "L", x: px, y: g.bottom }];
|
|
142
|
+
ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.top)));
|
|
143
|
+
}
|
|
144
|
+
for (const py of horizontals) {
|
|
145
|
+
const data: PathCommand[] = [{ type: "M", x: g.left, y: py }, { type: "L", x: g.right, y: py }];
|
|
146
|
+
ctx.draw(new Graphics2D().path({ data, centerBounds }).stroke(phaseShift(stroke, g.left)));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// The largest dash-array sum across the layers, or 0 when none is dashed.
|
|
151
|
+
function dashCycle(strokes: StrokeResolved[]): number {
|
|
152
|
+
let cycle = 0;
|
|
153
|
+
for (const s of strokes) {
|
|
154
|
+
if (s.dash && s.dash.length > 0) {
|
|
155
|
+
const sum = s.dash.reduce((a, b) => a + b, 0);
|
|
156
|
+
if (sum > cycle) cycle = sum;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return cycle;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// `dashOffset` advances the pattern, so it is negated to put the "on" run at the phase one
|
|
163
|
+
// infinite line would have at this world coordinate.
|
|
164
|
+
function phaseShift(strokes: StrokeResolved[], worldStart: number): StrokeResolved[] {
|
|
165
|
+
return strokes.map(s => (s.dash && s.dash.length > 0)
|
|
166
|
+
? { ...s, dashOffset: (s.dashOffset ?? 0) - worldStart }
|
|
167
|
+
: s);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// A number and a vector tween by promoting the number to a uniform vector.
|
|
171
|
+
function lerpCellSize(from: number | Vector2, to: number | Vector2, t: number): number | Vector2 {
|
|
172
|
+
if (typeof from === "number" && typeof to === "number") return lerpNumber(from, to, t);
|
|
173
|
+
const a = typeof from === "number" ? { x: from, y: from } : from;
|
|
174
|
+
const b = typeof to === "number" ? { x: to, y: to } : to;
|
|
175
|
+
return lerpVector2(a, b, t);
|
|
176
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./grid-pattern"
|
|
1
|
+
export * from "./grid-pattern"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./line-grid-pattern"
|
|
2
|
-
export * from "./dot-grid-pattern"
|
|
3
|
-
export * from "./grid-pattern"
|
|
4
|
-
export * from "./engine"
|
|
5
|
-
export { NODES } from "./nodes"
|
|
1
|
+
export * from "./line-grid-pattern"
|
|
2
|
+
export * from "./dot-grid-pattern"
|
|
3
|
+
export * from "./grid-pattern"
|
|
4
|
+
export * from "./engine"
|
|
5
|
+
export { NODES } from "./nodes"
|