@sarmal/core 0.12.0 → 0.14.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 +48 -21
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +48 -21
- package/dist/auto-init.js.map +1 -1
- package/dist/curves/artemis2.d.cts +1 -1
- package/dist/curves/artemis2.d.ts +1 -1
- package/dist/curves/astroid.d.cts +1 -1
- package/dist/curves/astroid.d.ts +1 -1
- package/dist/curves/deltoid.d.cts +1 -1
- package/dist/curves/deltoid.d.ts +1 -1
- package/dist/curves/epicycloid3.d.cts +1 -1
- package/dist/curves/epicycloid3.d.ts +1 -1
- package/dist/curves/epitrochoid7.d.cts +1 -1
- package/dist/curves/epitrochoid7.d.ts +1 -1
- package/dist/curves/index.d.cts +1 -1
- package/dist/curves/index.d.ts +1 -1
- package/dist/curves/lame.d.cts +1 -1
- package/dist/curves/lame.d.ts +1 -1
- package/dist/curves/lissajous32.d.cts +1 -1
- package/dist/curves/lissajous32.d.ts +1 -1
- package/dist/curves/lissajous43.d.cts +1 -1
- package/dist/curves/lissajous43.d.ts +1 -1
- package/dist/curves/rose3.d.cts +1 -1
- package/dist/curves/rose3.d.ts +1 -1
- package/dist/curves/rose5.d.cts +1 -1
- package/dist/curves/rose5.d.ts +1 -1
- package/dist/index.cjs +88 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +88 -32
- package/dist/index.js.map +1 -1
- package/dist/{types-BzgdhxE0.d.cts → types-BQosOzlf.d.cts} +30 -14
- package/dist/{types-BzgdhxE0.d.ts → types-BQosOzlf.d.ts} +30 -14
- package/package.json +1 -1
|
@@ -7,10 +7,8 @@ interface CurveDef {
|
|
|
7
7
|
/**
|
|
8
8
|
* The parametric function that defines the curve shape.
|
|
9
9
|
* @param t Current position along the curve, in [0, period)
|
|
10
|
-
* @param time Elapsed
|
|
11
|
-
* @param params Named parameter overrides.
|
|
12
|
-
* Always `{}` today — reserved for the upcoming parameterized-curves feature.
|
|
13
|
-
* Do NOT remove this parameter; it is intentional forward-compatible plumbing.
|
|
10
|
+
* @param time Elapsed actual time in seconds. It is always increasing, and never resets on period wrap
|
|
11
|
+
* @param params Named parameter overrides. intentional forward-compatible parameter
|
|
14
12
|
*/
|
|
15
13
|
fn: (t: number, time: number, params: Record<string, number>) => Point;
|
|
16
14
|
/**
|
|
@@ -203,8 +201,10 @@ interface Engine extends AnimationControls {
|
|
|
203
201
|
cancelSpeedTransition(): void;
|
|
204
202
|
}
|
|
205
203
|
interface SarmalInstance extends AnimationControls {
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
/** Starts the animation loop (requestAnimationFrame). If already running, does nothing. */
|
|
205
|
+
play(): void;
|
|
206
|
+
/** Pauses the animation loop (cancelAnimationFrame) and cancels any speed transition. Preserves state. */
|
|
207
|
+
pause(): void;
|
|
208
208
|
/** Stops the animation and cleans up resources */
|
|
209
209
|
destroy(): void;
|
|
210
210
|
/**
|
|
@@ -222,10 +222,21 @@ interface SarmalInstance extends AnimationControls {
|
|
|
222
222
|
*/
|
|
223
223
|
type TrailStyle = "default" | "gradient-static" | "gradient-animated";
|
|
224
224
|
type PalettePreset = "bard" | "sunset" | "ocean" | "ice" | "fire" | "forest";
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
/**
|
|
226
|
+
* Common renderer options shared between canvas and SVG renderers.
|
|
227
|
+
* Extracted to avoid duplication and ensure consistency.
|
|
228
|
+
*/
|
|
229
|
+
interface BaseRendererOptions {
|
|
230
|
+
/**
|
|
231
|
+
* Whether to start the animation loop automatically on creation.
|
|
232
|
+
* @default true
|
|
233
|
+
*/
|
|
234
|
+
autoStart?: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* Initial position along the curve (t value). If provided, seek(initialT) is called before the first frame.
|
|
237
|
+
* @default undefined (no seek performed, starts at t=0)
|
|
238
|
+
*/
|
|
239
|
+
initialT?: number;
|
|
229
240
|
/**
|
|
230
241
|
* @default '#ffffff'
|
|
231
242
|
*/
|
|
@@ -246,15 +257,20 @@ interface RendererOptions {
|
|
|
246
257
|
*/
|
|
247
258
|
trailStyle?: TrailStyle;
|
|
248
259
|
/**
|
|
249
|
-
* Color palette for gradient trails
|
|
250
|
-
* Can be a preset name or custom array of hex
|
|
251
|
-
* @default 'bard' for animated, 'ice' for static
|
|
260
|
+
* Color palette for gradient trails.
|
|
261
|
+
* Can be a preset name or a custom array of hex color strings.
|
|
262
|
+
* @default 'bard' for 'gradient-animated', 'ice' for 'gradient-static'
|
|
252
263
|
*/
|
|
253
264
|
palette?: PalettePreset | string[];
|
|
254
265
|
}
|
|
266
|
+
interface RendererOptions extends BaseRendererOptions {
|
|
267
|
+
/** Target canvas element that will contain the Sarmal */
|
|
268
|
+
canvas: HTMLCanvasElement;
|
|
269
|
+
engine: Engine;
|
|
270
|
+
}
|
|
255
271
|
interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
|
|
256
272
|
/** @default 120 */
|
|
257
273
|
trailLength?: number;
|
|
258
274
|
}
|
|
259
275
|
|
|
260
|
-
export type { CurveDef as C, Engine as E, JumpOptions as J, PalettePreset as P, RendererOptions as R, SarmalInstance as S, TrailStyle as T, SarmalOptions as a, Point as b, SeekOptions as c };
|
|
276
|
+
export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, PalettePreset as P, RendererOptions as R, SarmalInstance as S, TrailStyle as T, SarmalOptions as a, Point as b, SeekOptions as c };
|