@sarmal/core 0.25.0 → 0.26.0
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/dist/auto-init.cjs +94 -95
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +94 -95
- package/dist/auto-init.js.map +1 -1
- package/dist/curves/artemis2.cjs +6 -7
- package/dist/curves/artemis2.cjs.map +1 -1
- package/dist/curves/artemis2.d.cts +1 -1
- package/dist/curves/artemis2.d.ts +1 -1
- package/dist/curves/artemis2.js +6 -7
- package/dist/curves/artemis2.js.map +1 -1
- package/dist/curves/astroid.cjs +3 -3
- package/dist/curves/astroid.cjs.map +1 -1
- package/dist/curves/astroid.d.cts +1 -1
- package/dist/curves/astroid.d.ts +1 -1
- package/dist/curves/astroid.js +3 -3
- package/dist/curves/astroid.js.map +1 -1
- package/dist/curves/deltoid.cjs +3 -3
- package/dist/curves/deltoid.cjs.map +1 -1
- package/dist/curves/deltoid.d.cts +1 -1
- package/dist/curves/deltoid.d.ts +1 -1
- package/dist/curves/deltoid.js +3 -3
- package/dist/curves/deltoid.js.map +1 -1
- package/dist/curves/epicycloid3.cjs +3 -3
- package/dist/curves/epicycloid3.cjs.map +1 -1
- package/dist/curves/epicycloid3.d.cts +1 -1
- package/dist/curves/epicycloid3.d.ts +1 -1
- package/dist/curves/epicycloid3.js +3 -3
- package/dist/curves/epicycloid3.js.map +1 -1
- package/dist/curves/epitrochoid7.cjs +7 -7
- package/dist/curves/epitrochoid7.cjs.map +1 -1
- package/dist/curves/epitrochoid7.d.cts +1 -1
- package/dist/curves/epitrochoid7.d.ts +1 -1
- package/dist/curves/epitrochoid7.js +7 -7
- package/dist/curves/epitrochoid7.js.map +1 -1
- package/dist/curves/index.cjs +57 -58
- package/dist/curves/index.cjs.map +1 -1
- package/dist/curves/index.d.cts +1 -1
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/index.js +57 -58
- package/dist/curves/index.js.map +1 -1
- package/dist/curves/lame.cjs +3 -3
- package/dist/curves/lame.cjs.map +1 -1
- package/dist/curves/lame.d.cts +1 -1
- package/dist/curves/lame.d.ts +1 -1
- package/dist/curves/lame.js +3 -3
- package/dist/curves/lame.js.map +1 -1
- package/dist/curves/lissajous32.cjs +4 -4
- package/dist/curves/lissajous32.cjs.map +1 -1
- package/dist/curves/lissajous32.d.cts +1 -1
- package/dist/curves/lissajous32.d.ts +1 -1
- package/dist/curves/lissajous32.js +4 -4
- package/dist/curves/lissajous32.js.map +1 -1
- package/dist/curves/lissajous43.cjs +4 -4
- package/dist/curves/lissajous43.cjs.map +1 -1
- package/dist/curves/lissajous43.d.cts +1 -1
- package/dist/curves/lissajous43.d.ts +1 -1
- package/dist/curves/lissajous43.js +4 -4
- package/dist/curves/lissajous43.js.map +1 -1
- package/dist/curves/rose3.cjs +4 -4
- package/dist/curves/rose3.cjs.map +1 -1
- package/dist/curves/rose3.d.cts +1 -1
- package/dist/curves/rose3.d.ts +1 -1
- package/dist/curves/rose3.js +4 -4
- package/dist/curves/rose3.js.map +1 -1
- package/dist/curves/rose5.cjs +4 -4
- package/dist/curves/rose5.cjs.map +1 -1
- package/dist/curves/rose5.d.cts +1 -1
- package/dist/curves/rose5.d.ts +1 -1
- package/dist/curves/rose5.js +4 -4
- package/dist/curves/rose5.js.map +1 -1
- package/dist/curves/rose52.cjs +4 -4
- package/dist/curves/rose52.cjs.map +1 -1
- package/dist/curves/rose52.d.cts +1 -1
- package/dist/curves/rose52.d.ts +1 -1
- package/dist/curves/rose52.js +4 -4
- package/dist/curves/rose52.js.map +1 -1
- package/dist/curves/star.cjs +4 -4
- package/dist/curves/star.cjs.map +1 -1
- package/dist/curves/star.d.cts +1 -1
- package/dist/curves/star.d.ts +1 -1
- package/dist/curves/star.js +4 -4
- package/dist/curves/star.js.map +1 -1
- package/dist/curves/star4.cjs +4 -4
- package/dist/curves/star4.cjs.map +1 -1
- package/dist/curves/star4.d.cts +2 -2
- package/dist/curves/star4.d.ts +2 -2
- package/dist/curves/star4.js +4 -4
- package/dist/curves/star4.js.map +1 -1
- package/dist/curves/star7.cjs +4 -4
- package/dist/curves/star7.cjs.map +1 -1
- package/dist/curves/star7.d.cts +2 -2
- package/dist/curves/star7.d.ts +2 -2
- package/dist/curves/star7.js +4 -4
- package/dist/curves/star7.js.map +1 -1
- package/dist/index.cjs +94 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +94 -95
- package/dist/index.js.map +1 -1
- package/dist/{types-BZpzgNau.d.cts → types-zbxUgcmZ.d.cts} +30 -37
- package/dist/{types-BZpzgNau.d.ts → types-zbxUgcmZ.d.ts} +30 -37
- package/package.json +1 -1
|
@@ -12,11 +12,11 @@ interface CurveDef {
|
|
|
12
12
|
name: string;
|
|
13
13
|
/**
|
|
14
14
|
* The parametric function that defines the curve shape.
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
15
|
+
* @param phase Current position along the curve, in [0, period)
|
|
16
|
+
* @param elapsed Elapsed actual time in seconds. It is always increasing, and never resets on period wrap
|
|
17
17
|
* @param params Named parameter overrides. intentional forward-compatible parameter
|
|
18
18
|
*/
|
|
19
|
-
fn: (
|
|
19
|
+
fn: (phase: number, elapsed: number, params: Record<string, number>) => Point;
|
|
20
20
|
/**
|
|
21
21
|
* @default (Math.PI * 2)
|
|
22
22
|
*/
|
|
@@ -32,8 +32,8 @@ interface CurveDef {
|
|
|
32
32
|
version?: number;
|
|
33
33
|
/**
|
|
34
34
|
* Skeleton rendering mode:
|
|
35
|
-
* - 'static': Skeleton is computed once at init from `fn(
|
|
36
|
-
* - 'live': Skeleton is recomputed each frame using `fn(
|
|
35
|
+
* - 'static': Skeleton is computed once at init from `fn(phase, 0)` and cached
|
|
36
|
+
* - 'live': Skeleton is recomputed each frame using `fn(phase, actualTime)` specifically for curves whose shape drifts *over time*
|
|
37
37
|
* @default "static"
|
|
38
38
|
*/
|
|
39
39
|
skeleton?: "static" | "live";
|
|
@@ -41,17 +41,10 @@ interface CurveDef {
|
|
|
41
41
|
* An **override** function for computing a skeleton independent of `fn`
|
|
42
42
|
* If provided, this function is used instead of `fn` to sample the skeleton,
|
|
43
43
|
* and the result is cached just like like 'static' mode
|
|
44
|
-
* @param
|
|
45
|
-
* @returns The point on the skeleton at
|
|
44
|
+
* @param phase The parametric position along the curve (0 to period)
|
|
45
|
+
* @returns The point on the skeleton at position `phase`
|
|
46
46
|
*/
|
|
47
|
-
skeletonFn?: (
|
|
48
|
-
/**
|
|
49
|
-
* How the curve was created:
|
|
50
|
-
* - 'parametric': Defined by a mathematical parametric equation
|
|
51
|
-
* - 'drawn': Defined by control points
|
|
52
|
-
* @default "parametric"
|
|
53
|
-
*/
|
|
54
|
-
kind?: "parametric" | "drawn";
|
|
47
|
+
skeletonFn?: (phase: number) => Point;
|
|
55
48
|
}
|
|
56
49
|
type JumpOptions = {
|
|
57
50
|
/**
|
|
@@ -63,13 +56,13 @@ type JumpOptions = {
|
|
|
63
56
|
type SeekOptions = {
|
|
64
57
|
/**
|
|
65
58
|
* When true, the trail wraps around the period boundary,
|
|
66
|
-
* which results in a full trail even near `
|
|
67
|
-
* By default, the trail stops at `
|
|
59
|
+
* which results in a full trail even near `phase=0`
|
|
60
|
+
* By default, the trail stops at `phase=0`, which results in a partial trail near the start
|
|
68
61
|
* @default false
|
|
69
62
|
*/
|
|
70
63
|
wrap?: boolean;
|
|
71
64
|
/**
|
|
72
|
-
* Time gap between each trail point (in same units as `
|
|
65
|
+
* Time gap between each trail point (in same units as `phase`)
|
|
73
66
|
* Smaller value means a trail that is more dense
|
|
74
67
|
* @default period / trailLength
|
|
75
68
|
*/
|
|
@@ -83,30 +76,30 @@ type MorpStrategy = "raw" | "normalized";
|
|
|
83
76
|
*/
|
|
84
77
|
interface AnimationControls {
|
|
85
78
|
/**
|
|
86
|
-
* Resets the simulation state, clearing the trail and reverting internal
|
|
79
|
+
* Resets the simulation state, clearing the trail and reverting internal `phase` to 0
|
|
87
80
|
* The next call to `tick` will start fresh from the beginning of the curve
|
|
88
81
|
*/
|
|
89
82
|
reset(): void;
|
|
90
83
|
/**
|
|
91
|
-
* Instantly moves the head to position `
|
|
84
|
+
* Instantly moves the head to position `phase`.
|
|
92
85
|
*
|
|
93
86
|
* ! Does NOT update `actualTime`.
|
|
94
87
|
*
|
|
95
88
|
* Trail is left untouched by default. You can pass `clearTrail: true` to wipe it.
|
|
96
89
|
* Use for morphing mid-flight or any time you don't need trail context.
|
|
97
|
-
* @param
|
|
90
|
+
* @param phase The position to jump to (will be wrapped into [0, period))
|
|
98
91
|
*/
|
|
99
|
-
jump(
|
|
92
|
+
jump(phase: number, options?: JumpOptions): void;
|
|
100
93
|
/**
|
|
101
|
-
* Moves to `
|
|
94
|
+
* Moves to `phase` AND reconstructs the trail as if the animation naturally arrived there from `phase=0`
|
|
102
95
|
* Also updates `actualTime` to match. Trail is always rebuilt from scratch
|
|
103
96
|
* Use for initialisation or any jump where you want the trail to look meaningful
|
|
104
|
-
* @param
|
|
97
|
+
* @param phase The position to seek to (will be wrapped into [0, period))
|
|
105
98
|
*/
|
|
106
|
-
seek(
|
|
99
|
+
seek(phase: number, options?: SeekOptions): void;
|
|
107
100
|
/**
|
|
108
101
|
* Overrides the animation speed at runtime
|
|
109
|
-
* `0` freezes `
|
|
102
|
+
* `0` freezes `phase` but the loop keeps running
|
|
110
103
|
* Negative values reverse traversal.
|
|
111
104
|
*
|
|
112
105
|
* ! Does NOT affect a curve's inherent speed given in CurveDef
|
|
@@ -144,8 +137,8 @@ type MorphOptions = {
|
|
|
144
137
|
duration?: number;
|
|
145
138
|
/**
|
|
146
139
|
* Strategy for lerping between curves with different periods:
|
|
147
|
-
* - 'normalized': maps `
|
|
148
|
-
* - 'raw': uses the same `
|
|
140
|
+
* - 'normalized': maps `phase` proportionally into each curve's period (smooth for all period ratios)
|
|
141
|
+
* - 'raw': uses the same `phase` for both curves (can produce incoherent results for mismatched periods)
|
|
149
142
|
* @default 'normalized'
|
|
150
143
|
*/
|
|
151
144
|
morphStrategy?: MorpStrategy;
|
|
@@ -153,8 +146,8 @@ type MorphOptions = {
|
|
|
153
146
|
interface Engine extends AnimationControls {
|
|
154
147
|
/**
|
|
155
148
|
* Advances the Sarmal simulation by the given delta time (dt) in seconds.
|
|
156
|
-
* Internally, this increases the simulation
|
|
157
|
-
* wraps `
|
|
149
|
+
* Internally, this increases the simulation `phase` by `speed * dt`,
|
|
150
|
+
* wraps `phase` at `period`, evaluates the curve's parametric function `fn(phase)`,
|
|
158
151
|
* and appends the new point to the trail.
|
|
159
152
|
* Returns the pre-allocated trail buffer, which has the *same* reference every call
|
|
160
153
|
* ! Do not use `Array.length` to determine size
|
|
@@ -174,7 +167,7 @@ interface Engine extends AnimationControls {
|
|
|
174
167
|
/**
|
|
175
168
|
* Returns the *skeleton* of the curve.
|
|
176
169
|
* In technicality, it just represents the complete traversal of the curve over one full period,
|
|
177
|
-
* which is sampled at points from `
|
|
170
|
+
* which is sampled at points from `phase=0` to `phase=period`
|
|
178
171
|
*
|
|
179
172
|
* For "static" skeletons, this returns the same array on every call
|
|
180
173
|
* For "live" skeletons, this returns a different array each frame
|
|
@@ -191,7 +184,7 @@ interface Engine extends AnimationControls {
|
|
|
191
184
|
* If called while a morph is already in progress,
|
|
192
185
|
* the interpolated state is frozen and becomes the new `curveA`
|
|
193
186
|
* @param target The curve to transition to
|
|
194
|
-
* @param strategy 'normalized' maps
|
|
187
|
+
* @param strategy 'normalized' maps phase proportionally into each curve's period (default), 'raw' uses the same phase
|
|
195
188
|
*/
|
|
196
189
|
startMorph(target: CurveDef, strategy?: MorpStrategy): void;
|
|
197
190
|
/**
|
|
@@ -227,7 +220,7 @@ interface SarmalInstance extends AnimationControls {
|
|
|
227
220
|
destroy(): void;
|
|
228
221
|
/**
|
|
229
222
|
* Returns the skeleton of the curve:
|
|
230
|
-
* The complete traversal over one full period, sampled at points from
|
|
223
|
+
* The complete traversal over one full period, sampled at points from phase=0 to phase=period.
|
|
231
224
|
*/
|
|
232
225
|
getSarmalSkeleton(): Array<Point>;
|
|
233
226
|
/**
|
|
@@ -235,7 +228,7 @@ interface SarmalInstance extends AnimationControls {
|
|
|
235
228
|
* The trail naturally reflects the new curve as new points are added.
|
|
236
229
|
* @param target The curve to transition to
|
|
237
230
|
* @param options.duration How long the morph takes in milliseconds (default: 300)
|
|
238
|
-
* @param options.morphStrategy 'normalized' uses proportional
|
|
231
|
+
* @param options.morphStrategy 'normalized' uses proportional phase mapping (default), 'raw' uses same phase
|
|
239
232
|
* @returns Promise that resolves when the morph is complete
|
|
240
233
|
*/
|
|
241
234
|
morphTo(target: CurveDef, options?: MorphOptions): Promise<void>;
|
|
@@ -293,10 +286,10 @@ interface BaseRendererOptions {
|
|
|
293
286
|
*/
|
|
294
287
|
pauseOnHidden?: boolean;
|
|
295
288
|
/**
|
|
296
|
-
* Initial position along the curve (
|
|
297
|
-
* @default undefined (no seek performed, starts at
|
|
289
|
+
* Initial position along the curve (phase value). If provided, seek(initialPhase) is called before the first frame.
|
|
290
|
+
* @default undefined (no seek performed, starts at phase=0)
|
|
298
291
|
*/
|
|
299
|
-
|
|
292
|
+
initialPhase?: number;
|
|
300
293
|
/**
|
|
301
294
|
* @default '#ffffff'
|
|
302
295
|
*/
|
|
@@ -12,11 +12,11 @@ interface CurveDef {
|
|
|
12
12
|
name: string;
|
|
13
13
|
/**
|
|
14
14
|
* The parametric function that defines the curve shape.
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
15
|
+
* @param phase Current position along the curve, in [0, period)
|
|
16
|
+
* @param elapsed Elapsed actual time in seconds. It is always increasing, and never resets on period wrap
|
|
17
17
|
* @param params Named parameter overrides. intentional forward-compatible parameter
|
|
18
18
|
*/
|
|
19
|
-
fn: (
|
|
19
|
+
fn: (phase: number, elapsed: number, params: Record<string, number>) => Point;
|
|
20
20
|
/**
|
|
21
21
|
* @default (Math.PI * 2)
|
|
22
22
|
*/
|
|
@@ -32,8 +32,8 @@ interface CurveDef {
|
|
|
32
32
|
version?: number;
|
|
33
33
|
/**
|
|
34
34
|
* Skeleton rendering mode:
|
|
35
|
-
* - 'static': Skeleton is computed once at init from `fn(
|
|
36
|
-
* - 'live': Skeleton is recomputed each frame using `fn(
|
|
35
|
+
* - 'static': Skeleton is computed once at init from `fn(phase, 0)` and cached
|
|
36
|
+
* - 'live': Skeleton is recomputed each frame using `fn(phase, actualTime)` specifically for curves whose shape drifts *over time*
|
|
37
37
|
* @default "static"
|
|
38
38
|
*/
|
|
39
39
|
skeleton?: "static" | "live";
|
|
@@ -41,17 +41,10 @@ interface CurveDef {
|
|
|
41
41
|
* An **override** function for computing a skeleton independent of `fn`
|
|
42
42
|
* If provided, this function is used instead of `fn` to sample the skeleton,
|
|
43
43
|
* and the result is cached just like like 'static' mode
|
|
44
|
-
* @param
|
|
45
|
-
* @returns The point on the skeleton at
|
|
44
|
+
* @param phase The parametric position along the curve (0 to period)
|
|
45
|
+
* @returns The point on the skeleton at position `phase`
|
|
46
46
|
*/
|
|
47
|
-
skeletonFn?: (
|
|
48
|
-
/**
|
|
49
|
-
* How the curve was created:
|
|
50
|
-
* - 'parametric': Defined by a mathematical parametric equation
|
|
51
|
-
* - 'drawn': Defined by control points
|
|
52
|
-
* @default "parametric"
|
|
53
|
-
*/
|
|
54
|
-
kind?: "parametric" | "drawn";
|
|
47
|
+
skeletonFn?: (phase: number) => Point;
|
|
55
48
|
}
|
|
56
49
|
type JumpOptions = {
|
|
57
50
|
/**
|
|
@@ -63,13 +56,13 @@ type JumpOptions = {
|
|
|
63
56
|
type SeekOptions = {
|
|
64
57
|
/**
|
|
65
58
|
* When true, the trail wraps around the period boundary,
|
|
66
|
-
* which results in a full trail even near `
|
|
67
|
-
* By default, the trail stops at `
|
|
59
|
+
* which results in a full trail even near `phase=0`
|
|
60
|
+
* By default, the trail stops at `phase=0`, which results in a partial trail near the start
|
|
68
61
|
* @default false
|
|
69
62
|
*/
|
|
70
63
|
wrap?: boolean;
|
|
71
64
|
/**
|
|
72
|
-
* Time gap between each trail point (in same units as `
|
|
65
|
+
* Time gap between each trail point (in same units as `phase`)
|
|
73
66
|
* Smaller value means a trail that is more dense
|
|
74
67
|
* @default period / trailLength
|
|
75
68
|
*/
|
|
@@ -83,30 +76,30 @@ type MorpStrategy = "raw" | "normalized";
|
|
|
83
76
|
*/
|
|
84
77
|
interface AnimationControls {
|
|
85
78
|
/**
|
|
86
|
-
* Resets the simulation state, clearing the trail and reverting internal
|
|
79
|
+
* Resets the simulation state, clearing the trail and reverting internal `phase` to 0
|
|
87
80
|
* The next call to `tick` will start fresh from the beginning of the curve
|
|
88
81
|
*/
|
|
89
82
|
reset(): void;
|
|
90
83
|
/**
|
|
91
|
-
* Instantly moves the head to position `
|
|
84
|
+
* Instantly moves the head to position `phase`.
|
|
92
85
|
*
|
|
93
86
|
* ! Does NOT update `actualTime`.
|
|
94
87
|
*
|
|
95
88
|
* Trail is left untouched by default. You can pass `clearTrail: true` to wipe it.
|
|
96
89
|
* Use for morphing mid-flight or any time you don't need trail context.
|
|
97
|
-
* @param
|
|
90
|
+
* @param phase The position to jump to (will be wrapped into [0, period))
|
|
98
91
|
*/
|
|
99
|
-
jump(
|
|
92
|
+
jump(phase: number, options?: JumpOptions): void;
|
|
100
93
|
/**
|
|
101
|
-
* Moves to `
|
|
94
|
+
* Moves to `phase` AND reconstructs the trail as if the animation naturally arrived there from `phase=0`
|
|
102
95
|
* Also updates `actualTime` to match. Trail is always rebuilt from scratch
|
|
103
96
|
* Use for initialisation or any jump where you want the trail to look meaningful
|
|
104
|
-
* @param
|
|
97
|
+
* @param phase The position to seek to (will be wrapped into [0, period))
|
|
105
98
|
*/
|
|
106
|
-
seek(
|
|
99
|
+
seek(phase: number, options?: SeekOptions): void;
|
|
107
100
|
/**
|
|
108
101
|
* Overrides the animation speed at runtime
|
|
109
|
-
* `0` freezes `
|
|
102
|
+
* `0` freezes `phase` but the loop keeps running
|
|
110
103
|
* Negative values reverse traversal.
|
|
111
104
|
*
|
|
112
105
|
* ! Does NOT affect a curve's inherent speed given in CurveDef
|
|
@@ -144,8 +137,8 @@ type MorphOptions = {
|
|
|
144
137
|
duration?: number;
|
|
145
138
|
/**
|
|
146
139
|
* Strategy for lerping between curves with different periods:
|
|
147
|
-
* - 'normalized': maps `
|
|
148
|
-
* - 'raw': uses the same `
|
|
140
|
+
* - 'normalized': maps `phase` proportionally into each curve's period (smooth for all period ratios)
|
|
141
|
+
* - 'raw': uses the same `phase` for both curves (can produce incoherent results for mismatched periods)
|
|
149
142
|
* @default 'normalized'
|
|
150
143
|
*/
|
|
151
144
|
morphStrategy?: MorpStrategy;
|
|
@@ -153,8 +146,8 @@ type MorphOptions = {
|
|
|
153
146
|
interface Engine extends AnimationControls {
|
|
154
147
|
/**
|
|
155
148
|
* Advances the Sarmal simulation by the given delta time (dt) in seconds.
|
|
156
|
-
* Internally, this increases the simulation
|
|
157
|
-
* wraps `
|
|
149
|
+
* Internally, this increases the simulation `phase` by `speed * dt`,
|
|
150
|
+
* wraps `phase` at `period`, evaluates the curve's parametric function `fn(phase)`,
|
|
158
151
|
* and appends the new point to the trail.
|
|
159
152
|
* Returns the pre-allocated trail buffer, which has the *same* reference every call
|
|
160
153
|
* ! Do not use `Array.length` to determine size
|
|
@@ -174,7 +167,7 @@ interface Engine extends AnimationControls {
|
|
|
174
167
|
/**
|
|
175
168
|
* Returns the *skeleton* of the curve.
|
|
176
169
|
* In technicality, it just represents the complete traversal of the curve over one full period,
|
|
177
|
-
* which is sampled at points from `
|
|
170
|
+
* which is sampled at points from `phase=0` to `phase=period`
|
|
178
171
|
*
|
|
179
172
|
* For "static" skeletons, this returns the same array on every call
|
|
180
173
|
* For "live" skeletons, this returns a different array each frame
|
|
@@ -191,7 +184,7 @@ interface Engine extends AnimationControls {
|
|
|
191
184
|
* If called while a morph is already in progress,
|
|
192
185
|
* the interpolated state is frozen and becomes the new `curveA`
|
|
193
186
|
* @param target The curve to transition to
|
|
194
|
-
* @param strategy 'normalized' maps
|
|
187
|
+
* @param strategy 'normalized' maps phase proportionally into each curve's period (default), 'raw' uses the same phase
|
|
195
188
|
*/
|
|
196
189
|
startMorph(target: CurveDef, strategy?: MorpStrategy): void;
|
|
197
190
|
/**
|
|
@@ -227,7 +220,7 @@ interface SarmalInstance extends AnimationControls {
|
|
|
227
220
|
destroy(): void;
|
|
228
221
|
/**
|
|
229
222
|
* Returns the skeleton of the curve:
|
|
230
|
-
* The complete traversal over one full period, sampled at points from
|
|
223
|
+
* The complete traversal over one full period, sampled at points from phase=0 to phase=period.
|
|
231
224
|
*/
|
|
232
225
|
getSarmalSkeleton(): Array<Point>;
|
|
233
226
|
/**
|
|
@@ -235,7 +228,7 @@ interface SarmalInstance extends AnimationControls {
|
|
|
235
228
|
* The trail naturally reflects the new curve as new points are added.
|
|
236
229
|
* @param target The curve to transition to
|
|
237
230
|
* @param options.duration How long the morph takes in milliseconds (default: 300)
|
|
238
|
-
* @param options.morphStrategy 'normalized' uses proportional
|
|
231
|
+
* @param options.morphStrategy 'normalized' uses proportional phase mapping (default), 'raw' uses same phase
|
|
239
232
|
* @returns Promise that resolves when the morph is complete
|
|
240
233
|
*/
|
|
241
234
|
morphTo(target: CurveDef, options?: MorphOptions): Promise<void>;
|
|
@@ -293,10 +286,10 @@ interface BaseRendererOptions {
|
|
|
293
286
|
*/
|
|
294
287
|
pauseOnHidden?: boolean;
|
|
295
288
|
/**
|
|
296
|
-
* Initial position along the curve (
|
|
297
|
-
* @default undefined (no seek performed, starts at
|
|
289
|
+
* Initial position along the curve (phase value). If provided, seek(initialPhase) is called before the first frame.
|
|
290
|
+
* @default undefined (no seek performed, starts at phase=0)
|
|
298
291
|
*/
|
|
299
|
-
|
|
292
|
+
initialPhase?: number;
|
|
300
293
|
/**
|
|
301
294
|
* @default '#ffffff'
|
|
302
295
|
*/
|