@sarmal/core 0.24.0 → 0.25.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.
Files changed (51) hide show
  1. package/dist/auto-init.cjs +113 -44
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.js +113 -44
  4. package/dist/auto-init.js.map +1 -1
  5. package/dist/curves/artemis2.cjs +79 -11
  6. package/dist/curves/artemis2.cjs.map +1 -1
  7. package/dist/curves/artemis2.d.cts +1 -5
  8. package/dist/curves/artemis2.d.ts +1 -5
  9. package/dist/curves/artemis2.js +79 -11
  10. package/dist/curves/artemis2.js.map +1 -1
  11. package/dist/curves/astroid.d.cts +1 -1
  12. package/dist/curves/astroid.d.ts +1 -1
  13. package/dist/curves/deltoid.d.cts +1 -1
  14. package/dist/curves/deltoid.d.ts +1 -1
  15. package/dist/curves/epicycloid3.d.cts +1 -1
  16. package/dist/curves/epicycloid3.d.ts +1 -1
  17. package/dist/curves/epitrochoid7.d.cts +1 -1
  18. package/dist/curves/epitrochoid7.d.ts +1 -1
  19. package/dist/curves/index.cjs +103 -35
  20. package/dist/curves/index.cjs.map +1 -1
  21. package/dist/curves/index.d.cts +1 -1
  22. package/dist/curves/index.d.ts +1 -1
  23. package/dist/curves/index.js +103 -35
  24. package/dist/curves/index.js.map +1 -1
  25. package/dist/curves/lame.d.cts +1 -1
  26. package/dist/curves/lame.d.ts +1 -1
  27. package/dist/curves/lissajous32.d.cts +1 -1
  28. package/dist/curves/lissajous32.d.ts +1 -1
  29. package/dist/curves/lissajous43.d.cts +1 -1
  30. package/dist/curves/lissajous43.d.ts +1 -1
  31. package/dist/curves/rose3.d.cts +1 -1
  32. package/dist/curves/rose3.d.ts +1 -1
  33. package/dist/curves/rose5.d.cts +1 -1
  34. package/dist/curves/rose5.d.ts +1 -1
  35. package/dist/curves/rose52.d.cts +1 -1
  36. package/dist/curves/rose52.d.ts +1 -1
  37. package/dist/curves/star.d.cts +1 -1
  38. package/dist/curves/star.d.ts +1 -1
  39. package/dist/curves/star4.d.cts +1 -1
  40. package/dist/curves/star4.d.ts +1 -1
  41. package/dist/curves/star7.d.cts +1 -1
  42. package/dist/curves/star7.d.ts +1 -1
  43. package/dist/index.cjs +114 -87
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.d.cts +25 -7
  46. package/dist/index.d.ts +25 -7
  47. package/dist/index.js +114 -88
  48. package/dist/index.js.map +1 -1
  49. package/dist/{types-CknrlCAf.d.cts → types-BZpzgNau.d.cts} +19 -1
  50. package/dist/{types-CknrlCAf.d.ts → types-BZpzgNau.d.ts} +19 -1
  51. package/package.json +1 -1
@@ -2,6 +2,12 @@ interface Point {
2
2
  x: number;
3
3
  y: number;
4
4
  }
5
+ /**
6
+ * A control point for drawn curves, represented as a
7
+ * normalized `[x, y]` tuple in `[-1, 1]` space,
8
+ * matching the playground's draw-mode coordinate system.
9
+ */
10
+ type ControlPoint = [number, number];
5
11
  interface CurveDef {
6
12
  name: string;
7
13
  /**
@@ -39,6 +45,13 @@ interface CurveDef {
39
45
  * @returns The point on the skeleton at time `t`
40
46
  */
41
47
  skeletonFn?: (t: number) => Point;
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";
42
55
  }
43
56
  type JumpOptions = {
44
57
  /**
@@ -212,6 +225,11 @@ interface SarmalInstance extends AnimationControls {
212
225
  pause(): void;
213
226
  /** Stops the animation and cleans up resources */
214
227
  destroy(): void;
228
+ /**
229
+ * Returns the skeleton of the curve:
230
+ * The complete traversal over one full period, sampled at points from t=0 to t=period.
231
+ */
232
+ getSarmalSkeleton(): Array<Point>;
215
233
  /**
216
234
  * Smoothly transitions from the current curve to `target`.
217
235
  * The trail naturally reflects the new curve as new points are added.
@@ -311,4 +329,4 @@ interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
311
329
  trailLength?: number;
312
330
  }
313
331
 
314
- export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, Point as P, RendererOptions as R, SarmalInstance as S, TrailColor as T, SarmalOptions as a, RuntimeRenderOptions as b, SeekOptions as c, TrailStyle as d };
332
+ export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, Point as P, RendererOptions as R, SarmalInstance as S, TrailColor as T, ControlPoint as a, SarmalOptions as b, RuntimeRenderOptions as c, SeekOptions as d, TrailStyle as e };
@@ -2,6 +2,12 @@ interface Point {
2
2
  x: number;
3
3
  y: number;
4
4
  }
5
+ /**
6
+ * A control point for drawn curves, represented as a
7
+ * normalized `[x, y]` tuple in `[-1, 1]` space,
8
+ * matching the playground's draw-mode coordinate system.
9
+ */
10
+ type ControlPoint = [number, number];
5
11
  interface CurveDef {
6
12
  name: string;
7
13
  /**
@@ -39,6 +45,13 @@ interface CurveDef {
39
45
  * @returns The point on the skeleton at time `t`
40
46
  */
41
47
  skeletonFn?: (t: number) => Point;
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";
42
55
  }
43
56
  type JumpOptions = {
44
57
  /**
@@ -212,6 +225,11 @@ interface SarmalInstance extends AnimationControls {
212
225
  pause(): void;
213
226
  /** Stops the animation and cleans up resources */
214
227
  destroy(): void;
228
+ /**
229
+ * Returns the skeleton of the curve:
230
+ * The complete traversal over one full period, sampled at points from t=0 to t=period.
231
+ */
232
+ getSarmalSkeleton(): Array<Point>;
215
233
  /**
216
234
  * Smoothly transitions from the current curve to `target`.
217
235
  * The trail naturally reflects the new curve as new points are added.
@@ -311,4 +329,4 @@ interface SarmalOptions extends Omit<RendererOptions, "canvas" | "engine"> {
311
329
  trailLength?: number;
312
330
  }
313
331
 
314
- export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, Point as P, RendererOptions as R, SarmalInstance as S, TrailColor as T, SarmalOptions as a, RuntimeRenderOptions as b, SeekOptions as c, TrailStyle as d };
332
+ export type { BaseRendererOptions as B, CurveDef as C, Engine as E, JumpOptions as J, Point as P, RendererOptions as R, SarmalInstance as S, TrailColor as T, ControlPoint as a, SarmalOptions as b, RuntimeRenderOptions as c, SeekOptions as d, TrailStyle as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarmal/core",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Curve path based loading indicators and their renderer",
5
5
  "keywords": [
6
6
  "animation",