@sarmal/core 0.25.1 → 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.
Files changed (105) hide show
  1. package/dist/auto-init.cjs +170 -206
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.js +169 -205
  4. package/dist/auto-init.js.map +1 -1
  5. package/dist/curves/artemis2.cjs +14 -20
  6. package/dist/curves/artemis2.cjs.map +1 -1
  7. package/dist/curves/artemis2.d.cts +1 -1
  8. package/dist/curves/artemis2.d.ts +1 -1
  9. package/dist/curves/artemis2.js +13 -19
  10. package/dist/curves/artemis2.js.map +1 -1
  11. package/dist/curves/astroid.cjs +7 -7
  12. package/dist/curves/astroid.cjs.map +1 -1
  13. package/dist/curves/astroid.d.cts +1 -1
  14. package/dist/curves/astroid.d.ts +1 -1
  15. package/dist/curves/astroid.js +6 -6
  16. package/dist/curves/astroid.js.map +1 -1
  17. package/dist/curves/deltoid.cjs +6 -6
  18. package/dist/curves/deltoid.cjs.map +1 -1
  19. package/dist/curves/deltoid.d.cts +1 -1
  20. package/dist/curves/deltoid.d.ts +1 -1
  21. package/dist/curves/deltoid.js +5 -5
  22. package/dist/curves/deltoid.js.map +1 -1
  23. package/dist/curves/epicycloid3.cjs +6 -6
  24. package/dist/curves/epicycloid3.cjs.map +1 -1
  25. package/dist/curves/epicycloid3.d.cts +1 -1
  26. package/dist/curves/epicycloid3.d.ts +1 -1
  27. package/dist/curves/epicycloid3.js +5 -5
  28. package/dist/curves/epicycloid3.js.map +1 -1
  29. package/dist/curves/epitrochoid7.cjs +10 -10
  30. package/dist/curves/epitrochoid7.cjs.map +1 -1
  31. package/dist/curves/epitrochoid7.d.cts +1 -1
  32. package/dist/curves/epitrochoid7.d.ts +1 -1
  33. package/dist/curves/epitrochoid7.js +9 -9
  34. package/dist/curves/epitrochoid7.js.map +1 -1
  35. package/dist/curves/index.cjs +81 -97
  36. package/dist/curves/index.cjs.map +1 -1
  37. package/dist/curves/index.d.cts +29 -29
  38. package/dist/curves/index.d.ts +29 -29
  39. package/dist/curves/index.js +81 -113
  40. package/dist/curves/index.js.map +1 -1
  41. package/dist/curves/lame.cjs +7 -8
  42. package/dist/curves/lame.cjs.map +1 -1
  43. package/dist/curves/lame.d.cts +1 -1
  44. package/dist/curves/lame.d.ts +1 -1
  45. package/dist/curves/lame.js +6 -7
  46. package/dist/curves/lame.js.map +1 -1
  47. package/dist/curves/lissajous32.cjs +7 -7
  48. package/dist/curves/lissajous32.cjs.map +1 -1
  49. package/dist/curves/lissajous32.d.cts +1 -1
  50. package/dist/curves/lissajous32.d.ts +1 -1
  51. package/dist/curves/lissajous32.js +6 -6
  52. package/dist/curves/lissajous32.js.map +1 -1
  53. package/dist/curves/lissajous43.cjs +7 -7
  54. package/dist/curves/lissajous43.cjs.map +1 -1
  55. package/dist/curves/lissajous43.d.cts +1 -1
  56. package/dist/curves/lissajous43.d.ts +1 -1
  57. package/dist/curves/lissajous43.js +6 -6
  58. package/dist/curves/lissajous43.js.map +1 -1
  59. package/dist/curves/rose3.cjs +7 -7
  60. package/dist/curves/rose3.cjs.map +1 -1
  61. package/dist/curves/rose3.d.cts +1 -1
  62. package/dist/curves/rose3.d.ts +1 -1
  63. package/dist/curves/rose3.js +6 -6
  64. package/dist/curves/rose3.js.map +1 -1
  65. package/dist/curves/rose5.cjs +7 -7
  66. package/dist/curves/rose5.cjs.map +1 -1
  67. package/dist/curves/rose5.d.cts +1 -1
  68. package/dist/curves/rose5.d.ts +1 -1
  69. package/dist/curves/rose5.js +6 -6
  70. package/dist/curves/rose5.js.map +1 -1
  71. package/dist/curves/rose52.cjs +7 -7
  72. package/dist/curves/rose52.cjs.map +1 -1
  73. package/dist/curves/rose52.d.cts +1 -1
  74. package/dist/curves/rose52.d.ts +1 -1
  75. package/dist/curves/rose52.js +6 -6
  76. package/dist/curves/rose52.js.map +1 -1
  77. package/dist/curves/star.cjs +7 -10
  78. package/dist/curves/star.cjs.map +1 -1
  79. package/dist/curves/star.d.cts +1 -1
  80. package/dist/curves/star.d.ts +1 -1
  81. package/dist/curves/star.js +6 -9
  82. package/dist/curves/star.js.map +1 -1
  83. package/dist/curves/star4.cjs +7 -10
  84. package/dist/curves/star4.cjs.map +1 -1
  85. package/dist/curves/star4.d.cts +2 -2
  86. package/dist/curves/star4.d.ts +2 -2
  87. package/dist/curves/star4.js +6 -9
  88. package/dist/curves/star4.js.map +1 -1
  89. package/dist/curves/star7.cjs +7 -10
  90. package/dist/curves/star7.cjs.map +1 -1
  91. package/dist/curves/star7.d.cts +2 -2
  92. package/dist/curves/star7.d.ts +2 -2
  93. package/dist/curves/star7.js +6 -9
  94. package/dist/curves/star7.js.map +1 -1
  95. package/dist/index.cjs +158 -192
  96. package/dist/index.cjs.map +1 -1
  97. package/dist/index.d.cts +43 -95
  98. package/dist/index.d.ts +43 -95
  99. package/dist/index.js +158 -213
  100. package/dist/index.js.map +1 -1
  101. package/dist/types-zbxUgcmZ.d.cts +325 -0
  102. package/dist/types-zbxUgcmZ.d.ts +325 -0
  103. package/package.json +1 -1
  104. package/dist/types-Z9i1_AQZ.d.cts +0 -339
  105. package/dist/types-Z9i1_AQZ.d.ts +0 -339
@@ -1,19 +1,13 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  // src/catmull-rom.ts
4
4
  var PERIOD = 2 * Math.PI;
5
5
  function catmullRom1D(p0, p1, p2, p3, u) {
6
6
  const u2 = u * u;
7
7
  const u3 = u2 * u;
8
- return (
9
- 0.5 *
10
- (2 * p1 +
11
- (-p0 + p2) * u +
12
- (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +
13
- (-p0 + 3 * p1 - 3 * p2 + p3) * u3)
14
- );
8
+ return 0.5 * (2 * p1 + (-p0 + p2) * u + (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 + (-p0 + 3 * p1 - 3 * p2 + p3) * u3);
15
9
  }
16
- function evaluateCatmullRom(points2, t) {
10
+ function evaluateCatmullRom(points2, phase) {
17
11
  const N = points2.length;
18
12
  if (N === 0) {
19
13
  return { x: 0, y: 0 };
@@ -21,13 +15,13 @@ function evaluateCatmullRom(points2, t) {
21
15
  if (N === 1) {
22
16
  return { x: points2[0][0], y: points2[0][1] };
23
17
  }
24
- t = ((t % PERIOD) + PERIOD) % PERIOD;
18
+ phase = (phase % PERIOD + PERIOD) % PERIOD;
25
19
  const segmentSize = PERIOD / N;
26
- let i = Math.floor(t / segmentSize);
20
+ let i = Math.floor(phase / segmentSize);
27
21
  if (i >= N) {
28
22
  i = N - 1;
29
23
  }
30
- let u = (t - i * segmentSize) / segmentSize;
24
+ let u = (phase - i * segmentSize) / segmentSize;
31
25
  u = Math.max(0, Math.min(1, u));
32
26
  const p0 = points2[(i - 1 + N) % N];
33
27
  const p1 = points2[i];
@@ -35,7 +29,7 @@ function evaluateCatmullRom(points2, t) {
35
29
  const p3 = points2[(i + 2) % N];
36
30
  return {
37
31
  x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),
38
- y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),
32
+ y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u)
39
33
  };
40
34
  }
41
35
  function drawCurve(points2, opts) {
@@ -45,20 +39,20 @@ function drawCurve(points2, opts) {
45
39
  const first = points2[0];
46
40
  if (points2.every((p) => p[0] === first[0] && p[1] === first[1])) {
47
41
  console.warn(
48
- "[sarmal].drawCurve: all control points are identical. The curve will be a single point.",
42
+ "[sarmal].drawCurve: all control points are identical. The curve will be a single point."
49
43
  );
50
44
  }
51
45
  const maxAbs = points2.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);
52
46
  if (maxAbs > 2) {
53
47
  console.warn(
54
- `[sarmal].drawCurve: control points extend to \xB1${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,
48
+ `[sarmal].drawCurve: control points extend to \xB1${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`
55
49
  );
56
50
  }
57
51
  const pts = points2.map(([x, y]) => [x, y]);
58
52
  return {
59
53
  name: opts?.name ?? "drawn",
60
- fn: (t) => evaluateCatmullRom(pts, t),
61
- period: PERIOD,
54
+ fn: (phase) => evaluateCatmullRom(pts, phase),
55
+ period: PERIOD
62
56
  };
63
57
  }
64
58
 
@@ -84,13 +78,13 @@ var points = [
84
78
  [-0.69, -0.84],
85
79
  [-0.87, -0.66],
86
80
  [-0.9, -0.47],
87
- [-0.76, -0.35],
81
+ [-0.76, -0.35]
88
82
  ];
89
83
  var artemis2 = {
90
84
  ...drawCurve(points, { name: "Artemis II" }),
91
- speed: 0.7,
85
+ speed: 0.7
92
86
  };
93
87
 
94
88
  exports.artemis2 = artemis2;
95
89
  //# sourceMappingURL=artemis2.cjs.map
96
- //# sourceMappingURL=artemis2.cjs.map
90
+ //# sourceMappingURL=artemis2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/catmull-rom.ts","../../src/curves/artemis2.ts"],"names":["points"],"mappings":";;;AAMA,IAAM,MAAA,GAAS,IAAI,IAAA,CAAK,EAAA;AAOxB,SAAS,YAAA,CAAa,EAAA,EAAY,EAAA,EAAY,EAAA,EAAY,IAAY,CAAA,EAAmB;AACvF,EAAA,MAAM,KAAK,CAAA,GAAI,CAAA;AACf,EAAA,MAAM,KAAK,EAAA,GAAK,CAAA;AAGhB,EAAA,OACE,GAAA,IACC,IAAI,EAAA,GAAA,CACF,CAAC,KAAK,EAAA,IAAM,CAAA,GAAA,CACZ,IAAI,EAAA,GAAK,CAAA,GAAI,KAAK,CAAA,GAAI,EAAA,GAAK,MAAM,EAAA,GAAA,CACjC,CAAC,KAAK,CAAA,GAAI,EAAA,GAAK,CAAA,GAAI,EAAA,GAAK,EAAA,IAAM,EAAA,CAAA;AAErC;AAcO,SAAS,kBAAA,CAAmBA,SAA6B,CAAA,EAAkB;AAChF,EAAA,MAAM,IAAIA,OAAAA,CAAO,MAAA;AAEjB,EAAA,IAAI,MAAM,C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A,OAAO;AAAA,IACL,IAAA,EAAM,MAAM,IAAA,IAAQ,OAAA;AAAA,IACpB,EAAA,EAAI,CAAC,CAAA,KAAc,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAAA,IAC5C,MAAA,EAAQ;AAAA,GACV;AACF;;;ACvHA,IAAM,MAAA,GAA8B;AAAA,EAClC,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,EAAI,CAAA;AAAA,EACZ,CAAC,OAAO,IAAI,CAAA;AAAA,EACZ,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,OAAO,KAAK;AACf,CAAA;AAEO,IAAM,QAAA,GAAqB;AAAA,EAChC,GAAG,SAAA,CAAU,MAAA,EAAQ,EAAE,IAAA,EAAM,cAAc,CAAA;AAAA,EAC3C,KAAA,EAAO;AACT","file":"artemis2.cjs","sourcesContent":["import type { ControlPoint, Point, CurveDef } from \"./types\";\n\n/**\n * One full loop around the spline maps to the parametric interval `[0, 2π)`,\n * matching the convention for built-in curves.\n */\nconst PERIOD = 2 * Math.PI;\n\n/**\n * Evaluates a one-dimensional Catmull-Rom spline segment given four control values.\n * The parameter `u` ranges from 0 (at `p1`) to 1 (at `p2`).\n * `p0` and `p3` are the phantom neighbours that influence the tangent at each endpoint.\n */\nfunction catmullRom1D(p0: number, p1: number, p2: number, p3: number, u: number): number {\n const u2 = u * u;\n const u3 = u2 * u;\n\n // The standard Catmull-Rom matrix form\n return (\n 0.5 *\n (2 * p1 +\n (-p0 + p2) * u +\n (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +\n (-p0 + 3 * p1 - 3 * p2 + p3) * u3)\n );\n}\n\n/**\n * Evaluates a closed Catmull-Rom spline through every point in `points`\n *\n * The spline treats `points` as a **closed loop**\n * The last point wraps back to the first,\n * and each segment uses a phantom predecessor / successor so the\n * curve passes exactly through every control point.\n *\n * @param points At least 1 point. An empty array yields `(0, 0)`. A single point returns that point for every `t`\n * @param t Parametric position along the closed loop. Wraps into `[0, 2π)` automatically, so values outside that range are remapped rather than rejected\n * @returns The `(x, y)` position on the spline at time `t`\n */\nexport function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Point {\n const N = points.length;\n\n if (N === 0) {\n return { x: 0, y: 0 };\n }\n\n if (N === 1) {\n return { x: points[0]![0], y: points[0]![1] };\n }\n\n t = ((t % PERIOD) + PERIOD) % PERIOD;\n\n const segmentSize = PERIOD / N;\n let i = Math.floor(t / segmentSize);\n if (i >= N) {\n i = N - 1;\n }\n\n let u = (t - i * segmentSize) / segmentSize;\n u = Math.max(0, Math.min(1, u));\n\n const p0 = points[(i - 1 + N) % N]!;\n const p1 = points[i]!;\n const p2 = points[(i + 1) % N]!;\n const p3 = points[(i + 2) % N]!;\n\n return {\n x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),\n y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),\n };\n}\n\n/**\n * The returned curve definition produces a closed Catmull-Rom spline that\n * passes through every point in order, looping back from the last point to the first.\n *\n * @param points Array of control points in **normalized `[−1, 1]` space**,\n * matching the playground's draw-mode coordinate system.\n * ! Must contain at least 3 points.\n * @param opts Optional overrides for the returned `CurveDef`.\n * @param opts.name Display name for the curve. Defaults to `\"drawn\"`.\n * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.\n * @throws If `points` has fewer than 3 entries.\n *\n * @example\n * ```ts\n * import { createSarmal, drawCurve } from '@sarmal/core'\n *\n * const curve = drawCurve([\n * [-0.5, 0.3],\n * [ 0.2, -0.8],\n * [ 0.7, 0.4],\n * ])\n *\n * createSarmal(canvas, curve)\n * ```\n */\nexport function drawCurve(points: Array<ControlPoint>, opts?: { name?: string }): CurveDef {\n if (points.length < 3) {\n throw new Error(`drawCurve requires at least 3 points, received ${points.length}.`);\n }\n\n const first = points[0]!;\n if (points.every((p) => p[0] === first[0] && p[1] === first[1])) {\n console.warn(\n \"[sarmal].drawCurve: all control points are identical. The curve will be a single point.\",\n );\n }\n\n const maxAbs = points.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);\n if (maxAbs > 2) {\n console.warn(\n `[sarmal].drawCurve: control points extend to ±${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,\n );\n }\n\n const pts = points.map(([x, y]) => [x, y] as ControlPoint);\n\n return {\n name: opts?.name ?? \"drawn\",\n fn: (t: number) => evaluateCatmullRom(pts, t),\n period: PERIOD,\n };\n}\n","import type { ControlPoint, CurveDef } from \"../types\";\n\nimport { drawCurve } from \"../catmull-rom\";\n\nconst points: Array<ControlPoint> = [\n [-0.44, -0.45],\n [-0.53, -0.77],\n [-0.82, -0.66],\n [-0.82, -0.18],\n [-0.25, -0.04],\n [0.16, -0.49],\n [-0.03, -0.87],\n [-0.68, -0.94],\n [-0.95, -0.61],\n [-0.87, -0.0],\n [-0.34, 0.21],\n [0.27, -0.04],\n [0.87, 0.06],\n [0.87, 0.57],\n [0.32, 0.66],\n [-0.21, -0.43],\n [-0.43, -0.81],\n [-0.69, -0.84],\n [-0.87, -0.66],\n [-0.9, -0.47],\n [-0.76, -0.35],\n];\n\nexport const artemis2: CurveDef = {\n ...drawCurve(points, { name: \"Artemis II\" }),\n speed: 0.7,\n};\n"]}
1
+ {"version":3,"sources":["../../src/catmull-rom.ts","../../src/curves/artemis2.ts"],"names":["points"],"mappings":";;;AAMA,IAAM,MAAA,GAAS,IAAI,IAAA,CAAK,EAAA;AAOxB,SAAS,YAAA,CAAa,EAAA,EAAY,EAAA,EAAY,EAAA,EAAY,IAAY,CAAA,EAAmB;AACvF,EAAA,MAAM,KAAK,CAAA,GAAI,CAAA;AACf,EAAA,MAAM,KAAK,EAAA,GAAK,CAAA;AAGhB,EAAA,OACE,GAAA,IACC,IAAI,EAAA,GAAA,CACF,CAAC,KAAK,EAAA,IAAM,CAAA,GAAA,CACZ,IAAI,EAAA,GAAK,CAAA,GAAI,KAAK,CAAA,GAAI,EAAA,GAAK,MAAM,EAAA,GAAA,CACjC,CAAC,KAAK,CAAA,GAAI,EAAA,GAAK,CAAA,GAAI,EAAA,GAAK,EAAA,IAAM,EAAA,CAAA;AAErC;AAcO,SAAS,kBAAA,CAAmBA,SAA6B,KAAA,EAAsB;AACpF,EAAA,MAAM,IAAIA,OAAAA,CAAO,MAAA;AAEjB,EAAA,IAAI,MAAM,CAAA,EAAG;AACX,IAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAE;AAAA,EACtB;AAEA,EAAA,IAAI,MAAM,CAAA,EAAG;AACX,IAAA,OAAO,EAAE,CAAA,EAAGA,OAAAA,CAAO,CAAC,CAAA,CAAG,CAAC,CAAA,EAAG,CAAA,EAAGA,OAAAA,CAAO,CAAC,CAAA,CAAG,CAAC,CAAA,EAAE;AAAA,EAC9C;AAEA,EAAA,KAAA,GAAA,CAAU,KAAA,GAAQ,SAAU,MAAA,IAAU,MAAA;AAEtC,EAAA,MAAM,cAAc,MAAA,GAAS,CAAA;AAC7B,EAAA,IAAI,CAAA,GAAI,IAAA,CAAK,KAAA,CAAM,KAAA,GA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AC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,EAAI,CAAA;AAAA,EACZ,CAAC,OAAO,IAAI,CAAA;AAAA,EACZ,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,OAAO,KAAK;AACf,CAAA;AAEO,IAAM,QAAA,GAAqB;AAAA,EAChC,GAAG,SAAA,CAAU,MAAA,EAAQ,EAAE,IAAA,EAAM,cAAc,CAAA;AAAA,EAC3C,KAAA,EAAO;AACT","file":"artemis2.cjs","sourcesContent":["import type { ControlPoint, Point, CurveDef } from \"./types\";\n\n/**\n * One full loop around the spline maps to the parametric interval `[0, 2π)`,\n * matching the convention for built-in curves.\n */\nconst PERIOD = 2 * Math.PI;\n\n/**\n * Evaluates a one-dimensional Catmull-Rom spline segment given four control values.\n * The parameter `u` ranges from 0 (at `p1`) to 1 (at `p2`).\n * `p0` and `p3` are the phantom neighbours that influence the tangent at each endpoint.\n */\nfunction catmullRom1D(p0: number, p1: number, p2: number, p3: number, u: number): number {\n const u2 = u * u;\n const u3 = u2 * u;\n\n // The standard Catmull-Rom matrix form\n return (\n 0.5 *\n (2 * p1 +\n (-p0 + p2) * u +\n (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +\n (-p0 + 3 * p1 - 3 * p2 + p3) * u3)\n );\n}\n\n/**\n * Evaluates a closed Catmull-Rom spline through every point in `points`\n *\n * The spline treats `points` as a **closed loop**\n * The last point wraps back to the first,\n * and each segment uses a phantom predecessor / successor so the\n * curve passes exactly through every control point.\n *\n * @param points At least 1 point. An empty array yields `(0, 0)`. A single point returns that point for every `phase`\n * @param phase Parametric position along the closed loop. Wraps into `[0, 2π)` automatically, so values outside that range are remapped rather than rejected\n * @returns The `(x, y)` position on the spline at position `phase`\n */\nexport function evaluateCatmullRom(points: Array<ControlPoint>, phase: number): Point {\n const N = points.length;\n\n if (N === 0) {\n return { x: 0, y: 0 };\n }\n\n if (N === 1) {\n return { x: points[0]![0], y: points[0]![1] };\n }\n\n phase = ((phase % PERIOD) + PERIOD) % PERIOD;\n\n const segmentSize = PERIOD / N;\n let i = Math.floor(phase / segmentSize);\n if (i >= N) {\n i = N - 1;\n }\n\n let u = (phase - i * segmentSize) / segmentSize;\n u = Math.max(0, Math.min(1, u));\n\n const p0 = points[(i - 1 + N) % N]!;\n const p1 = points[i]!;\n const p2 = points[(i + 1) % N]!;\n const p3 = points[(i + 2) % N]!;\n\n return {\n x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),\n y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),\n };\n}\n\n/**\n * The returned curve definition produces a closed Catmull-Rom spline that\n * passes through every point in order, looping back from the last point to the first.\n *\n * @param points Array of control points in **normalized `[−1, 1]` space**,\n * matching the playground's draw-mode coordinate system.\n * ! Must contain at least 3 points.\n * @param opts Optional overrides for the returned `CurveDef`.\n * @param opts.name Display name for the curve. Defaults to `\"drawn\"`.\n * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.\n * @throws If `points` has fewer than 3 entries.\n *\n * @example\n * ```ts\n * import { createSarmal, drawCurve } from '@sarmal/core'\n *\n * const curve = drawCurve([\n * [-0.5, 0.3],\n * [ 0.2, -0.8],\n * [ 0.7, 0.4],\n * ])\n *\n * createSarmal(canvas, curve)\n * ```\n */\nexport function drawCurve(points: Array<ControlPoint>, opts?: { name?: string }): CurveDef {\n if (points.length < 3) {\n throw new Error(`drawCurve requires at least 3 points, received ${points.length}.`);\n }\n\n const first = points[0]!;\n if (points.every((p) => p[0] === first[0] && p[1] === first[1])) {\n console.warn(\n \"[sarmal].drawCurve: all control points are identical. The curve will be a single point.\",\n );\n }\n\n const maxAbs = points.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);\n if (maxAbs > 2) {\n console.warn(\n `[sarmal].drawCurve: control points extend to ±${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,\n );\n }\n\n const pts = points.map(([x, y]) => [x, y] as ControlPoint);\n\n return {\n name: opts?.name ?? \"drawn\",\n fn: (phase: number) => evaluateCatmullRom(pts, phase),\n period: PERIOD,\n };\n}\n","import type { ControlPoint, CurveDef } from \"../types\";\n\nimport { drawCurve } from \"../catmull-rom\";\n\nconst points: Array<ControlPoint> = [\n [-0.44, -0.45],\n [-0.53, -0.77],\n [-0.82, -0.66],\n [-0.82, -0.18],\n [-0.25, -0.04],\n [0.16, -0.49],\n [-0.03, -0.87],\n [-0.68, -0.94],\n [-0.95, -0.61],\n [-0.87, -0.0],\n [-0.34, 0.21],\n [0.27, -0.04],\n [0.87, 0.06],\n [0.87, 0.57],\n [0.32, 0.66],\n [-0.21, -0.43],\n [-0.43, -0.81],\n [-0.69, -0.84],\n [-0.87, -0.66],\n [-0.9, -0.47],\n [-0.76, -0.35],\n];\n\nexport const artemis2: CurveDef = {\n ...drawCurve(points, { name: \"Artemis II\" }),\n speed: 0.7,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.cjs";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
2
2
 
3
3
  declare const artemis2: CurveDef;
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.js";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.js';
2
2
 
3
3
  declare const artemis2: CurveDef;
4
4
 
@@ -3,15 +3,9 @@ var PERIOD = 2 * Math.PI;
3
3
  function catmullRom1D(p0, p1, p2, p3, u) {
4
4
  const u2 = u * u;
5
5
  const u3 = u2 * u;
6
- return (
7
- 0.5 *
8
- (2 * p1 +
9
- (-p0 + p2) * u +
10
- (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +
11
- (-p0 + 3 * p1 - 3 * p2 + p3) * u3)
12
- );
6
+ return 0.5 * (2 * p1 + (-p0 + p2) * u + (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 + (-p0 + 3 * p1 - 3 * p2 + p3) * u3);
13
7
  }
14
- function evaluateCatmullRom(points2, t) {
8
+ function evaluateCatmullRom(points2, phase) {
15
9
  const N = points2.length;
16
10
  if (N === 0) {
17
11
  return { x: 0, y: 0 };
@@ -19,13 +13,13 @@ function evaluateCatmullRom(points2, t) {
19
13
  if (N === 1) {
20
14
  return { x: points2[0][0], y: points2[0][1] };
21
15
  }
22
- t = ((t % PERIOD) + PERIOD) % PERIOD;
16
+ phase = (phase % PERIOD + PERIOD) % PERIOD;
23
17
  const segmentSize = PERIOD / N;
24
- let i = Math.floor(t / segmentSize);
18
+ let i = Math.floor(phase / segmentSize);
25
19
  if (i >= N) {
26
20
  i = N - 1;
27
21
  }
28
- let u = (t - i * segmentSize) / segmentSize;
22
+ let u = (phase - i * segmentSize) / segmentSize;
29
23
  u = Math.max(0, Math.min(1, u));
30
24
  const p0 = points2[(i - 1 + N) % N];
31
25
  const p1 = points2[i];
@@ -33,7 +27,7 @@ function evaluateCatmullRom(points2, t) {
33
27
  const p3 = points2[(i + 2) % N];
34
28
  return {
35
29
  x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),
36
- y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),
30
+ y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u)
37
31
  };
38
32
  }
39
33
  function drawCurve(points2, opts) {
@@ -43,20 +37,20 @@ function drawCurve(points2, opts) {
43
37
  const first = points2[0];
44
38
  if (points2.every((p) => p[0] === first[0] && p[1] === first[1])) {
45
39
  console.warn(
46
- "[sarmal].drawCurve: all control points are identical. The curve will be a single point.",
40
+ "[sarmal].drawCurve: all control points are identical. The curve will be a single point."
47
41
  );
48
42
  }
49
43
  const maxAbs = points2.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);
50
44
  if (maxAbs > 2) {
51
45
  console.warn(
52
- `[sarmal].drawCurve: control points extend to \xB1${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,
46
+ `[sarmal].drawCurve: control points extend to \xB1${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`
53
47
  );
54
48
  }
55
49
  const pts = points2.map(([x, y]) => [x, y]);
56
50
  return {
57
51
  name: opts?.name ?? "drawn",
58
- fn: (t) => evaluateCatmullRom(pts, t),
59
- period: PERIOD,
52
+ fn: (phase) => evaluateCatmullRom(pts, phase),
53
+ period: PERIOD
60
54
  };
61
55
  }
62
56
 
@@ -82,13 +76,13 @@ var points = [
82
76
  [-0.69, -0.84],
83
77
  [-0.87, -0.66],
84
78
  [-0.9, -0.47],
85
- [-0.76, -0.35],
79
+ [-0.76, -0.35]
86
80
  ];
87
81
  var artemis2 = {
88
82
  ...drawCurve(points, { name: "Artemis II" }),
89
- speed: 0.7,
83
+ speed: 0.7
90
84
  };
91
85
 
92
86
  export { artemis2 };
93
87
  //# sourceMappingURL=artemis2.js.map
94
- //# sourceMappingURL=artemis2.js.map
88
+ //# sourceMappingURL=artemis2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/catmull-rom.ts","../../src/curves/artemis2.ts"],"names":["points"],"mappings":";AAMA,IAAM,MAAA,GAAS,IAAI,IAAA,CAAK,EAAA;AAOxB,SAAS,YAAA,CAAa,EAAA,EAAY,EAAA,EAAY,EAAA,EAAY,IAAY,CAAA,EAAmB;AACvF,EAAA,MAAM,KAAK,CAAA,GAAI,CAAA;AACf,EAAA,MAAM,KAAK,EAAA,GAAK,CAAA;AAGhB,EAAA,OACE,GAAA,IACC,IAAI,EAAA,GAAA,CACF,CAAC,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AA;AAAA,EACZ,CAAC,OAAO,KAAK;AACf,CAAA;AAEO,IAAM,QAAA,GAAqB;AAAA,EAChC,GAAG,SAAA,CAAU,MAAA,EAAQ,EAAE,IAAA,EAAM,cAAc,CAAA;AAAA,EAC3C,KAAA,EAAO;AACT","file":"artemis2.js","sourcesContent":["import type { ControlPoint, Point, CurveDef } from \"./types\";\n\n/**\n * One full loop around the spline maps to the parametric interval `[0, 2π)`,\n * matching the convention for built-in curves.\n */\nconst PERIOD = 2 * Math.PI;\n\n/**\n * Evaluates a one-dimensional Catmull-Rom spline segment given four control values.\n * The parameter `u` ranges from 0 (at `p1`) to 1 (at `p2`).\n * `p0` and `p3` are the phantom neighbours that influence the tangent at each endpoint.\n */\nfunction catmullRom1D(p0: number, p1: number, p2: number, p3: number, u: number): number {\n const u2 = u * u;\n const u3 = u2 * u;\n\n // The standard Catmull-Rom matrix form\n return (\n 0.5 *\n (2 * p1 +\n (-p0 + p2) * u +\n (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +\n (-p0 + 3 * p1 - 3 * p2 + p3) * u3)\n );\n}\n\n/**\n * Evaluates a closed Catmull-Rom spline through every point in `points`\n *\n * The spline treats `points` as a **closed loop**\n * The last point wraps back to the first,\n * and each segment uses a phantom predecessor / successor so the\n * curve passes exactly through every control point.\n *\n * @param points At least 1 point. An empty array yields `(0, 0)`. A single point returns that point for every `t`\n * @param t Parametric position along the closed loop. Wraps into `[0, 2π)` automatically, so values outside that range are remapped rather than rejected\n * @returns The `(x, y)` position on the spline at time `t`\n */\nexport function evaluateCatmullRom(points: Array<ControlPoint>, t: number): Point {\n const N = points.length;\n\n if (N === 0) {\n return { x: 0, y: 0 };\n }\n\n if (N === 1) {\n return { x: points[0]![0], y: points[0]![1] };\n }\n\n t = ((t % PERIOD) + PERIOD) % PERIOD;\n\n const segmentSize = PERIOD / N;\n let i = Math.floor(t / segmentSize);\n if (i >= N) {\n i = N - 1;\n }\n\n let u = (t - i * segmentSize) / segmentSize;\n u = Math.max(0, Math.min(1, u));\n\n const p0 = points[(i - 1 + N) % N]!;\n const p1 = points[i]!;\n const p2 = points[(i + 1) % N]!;\n const p3 = points[(i + 2) % N]!;\n\n return {\n x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),\n y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),\n };\n}\n\n/**\n * The returned curve definition produces a closed Catmull-Rom spline that\n * passes through every point in order, looping back from the last point to the first.\n *\n * @param points Array of control points in **normalized `[−1, 1]` space**,\n * matching the playground's draw-mode coordinate system.\n * ! Must contain at least 3 points.\n * @param opts Optional overrides for the returned `CurveDef`.\n * @param opts.name Display name for the curve. Defaults to `\"drawn\"`.\n * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.\n * @throws If `points` has fewer than 3 entries.\n *\n * @example\n * ```ts\n * import { createSarmal, drawCurve } from '@sarmal/core'\n *\n * const curve = drawCurve([\n * [-0.5, 0.3],\n * [ 0.2, -0.8],\n * [ 0.7, 0.4],\n * ])\n *\n * createSarmal(canvas, curve)\n * ```\n */\nexport function drawCurve(points: Array<ControlPoint>, opts?: { name?: string }): CurveDef {\n if (points.length < 3) {\n throw new Error(`drawCurve requires at least 3 points, received ${points.length}.`);\n }\n\n const first = points[0]!;\n if (points.every((p) => p[0] === first[0] && p[1] === first[1])) {\n console.warn(\n \"[sarmal].drawCurve: all control points are identical. The curve will be a single point.\",\n );\n }\n\n const maxAbs = points.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);\n if (maxAbs > 2) {\n console.warn(\n `[sarmal].drawCurve: control points extend to ±${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,\n );\n }\n\n const pts = points.map(([x, y]) => [x, y] as ControlPoint);\n\n return {\n name: opts?.name ?? \"drawn\",\n fn: (t: number) => evaluateCatmullRom(pts, t),\n period: PERIOD,\n };\n}\n","import type { ControlPoint, CurveDef } from \"../types\";\n\nimport { drawCurve } from \"../catmull-rom\";\n\nconst points: Array<ControlPoint> = [\n [-0.44, -0.45],\n [-0.53, -0.77],\n [-0.82, -0.66],\n [-0.82, -0.18],\n [-0.25, -0.04],\n [0.16, -0.49],\n [-0.03, -0.87],\n [-0.68, -0.94],\n [-0.95, -0.61],\n [-0.87, -0.0],\n [-0.34, 0.21],\n [0.27, -0.04],\n [0.87, 0.06],\n [0.87, 0.57],\n [0.32, 0.66],\n [-0.21, -0.43],\n [-0.43, -0.81],\n [-0.69, -0.84],\n [-0.87, -0.66],\n [-0.9, -0.47],\n [-0.76, -0.35],\n];\n\nexport const artemis2: CurveDef = {\n ...drawCurve(points, { name: \"Artemis II\" }),\n speed: 0.7,\n};\n"]}
1
+ {"version":3,"sources":["../../src/catmull-rom.ts","../../src/curves/artemis2.ts"],"names":["points"],"mappings":";AAMA,IAAM,MAAA,GAAS,IAAI,IAAA,CAAK,EAAA;AAOxB,SAAS,YAAA,CAAa,EAAA,EAAY,EAAA,EAAY,EAAA,EAAY,IAAY,CAAA,EAAmB;AACvF,EAAA,MAAM,KAAK,CAAA,GAAI,CAAA;AACf,EAAA,MAAM,KAAK,EAAA,GAAK,CAAA;AAGhB,EAAA,OACE,GAAA,IACC,IAAI,EAAA,GAAA,CACF,CAAC,KAAK,EAAA,IAAM,CAAA,GAAA,CACZ,IAAI,EAAA,GAAK,CAAA,GAAI,KAAK,CAAA,GAAI,EAAA,GAAK,MAAM,EAAA,GAAA,CACjC,CAAC,KAAK,CAAA,GAAI,EAAA,GAAK,CAAA,GAAI,EAAA,GAAK,EAAA,IAAM,EAAA,CAAA;AAErC;AAcO,SAAS,kBAAA,CAAmBA,SAA6B,KAAA,EAAsB;AACpF,EAAA,MAAM,IAAIA,OAAAA,CAAO,MAAA;AAEjB,EAAA,IAAI,MAAM,CAAA,EAAG;AACX,IAAA,OAAO,EAAE,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,EAAE;AAAA,EACtB;AAEA,EAAA,IAAI,MAAM,CAAA,EAAG;AACX,IAAA,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,IACpD,MAAA,EAAQ;AAAA,GACV;AACF;;;ACvHA,IAAM,MAAA,GAA8B;AAAA,EAClC,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,EAAI,CAAA;AAAA,EACZ,CAAC,OAAO,IAAI,CAAA;AAAA,EACZ,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,MAAM,IAAI,CAAA;AAAA,EACX,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,OAAO,KAAK,CAAA;AAAA,EACb,CAAC,MAAM,KAAK,CAAA;AAAA,EACZ,CAAC,OAAO,KAAK;AACf,CAAA;AAEO,IAAM,QAAA,GAAqB;AAAA,EAChC,GAAG,SAAA,CAAU,MAAA,EAAQ,EAAE,IAAA,EAAM,cAAc,CAAA;AAAA,EAC3C,KAAA,EAAO;AACT","file":"artemis2.js","sourcesContent":["import type { ControlPoint, Point, CurveDef } from \"./types\";\n\n/**\n * One full loop around the spline maps to the parametric interval `[0, 2π)`,\n * matching the convention for built-in curves.\n */\nconst PERIOD = 2 * Math.PI;\n\n/**\n * Evaluates a one-dimensional Catmull-Rom spline segment given four control values.\n * The parameter `u` ranges from 0 (at `p1`) to 1 (at `p2`).\n * `p0` and `p3` are the phantom neighbours that influence the tangent at each endpoint.\n */\nfunction catmullRom1D(p0: number, p1: number, p2: number, p3: number, u: number): number {\n const u2 = u * u;\n const u3 = u2 * u;\n\n // The standard Catmull-Rom matrix form\n return (\n 0.5 *\n (2 * p1 +\n (-p0 + p2) * u +\n (2 * p0 - 5 * p1 + 4 * p2 - p3) * u2 +\n (-p0 + 3 * p1 - 3 * p2 + p3) * u3)\n );\n}\n\n/**\n * Evaluates a closed Catmull-Rom spline through every point in `points`\n *\n * The spline treats `points` as a **closed loop**\n * The last point wraps back to the first,\n * and each segment uses a phantom predecessor / successor so the\n * curve passes exactly through every control point.\n *\n * @param points At least 1 point. An empty array yields `(0, 0)`. A single point returns that point for every `phase`\n * @param phase Parametric position along the closed loop. Wraps into `[0, 2π)` automatically, so values outside that range are remapped rather than rejected\n * @returns The `(x, y)` position on the spline at position `phase`\n */\nexport function evaluateCatmullRom(points: Array<ControlPoint>, phase: number): Point {\n const N = points.length;\n\n if (N === 0) {\n return { x: 0, y: 0 };\n }\n\n if (N === 1) {\n return { x: points[0]![0], y: points[0]![1] };\n }\n\n phase = ((phase % PERIOD) + PERIOD) % PERIOD;\n\n const segmentSize = PERIOD / N;\n let i = Math.floor(phase / segmentSize);\n if (i >= N) {\n i = N - 1;\n }\n\n let u = (phase - i * segmentSize) / segmentSize;\n u = Math.max(0, Math.min(1, u));\n\n const p0 = points[(i - 1 + N) % N]!;\n const p1 = points[i]!;\n const p2 = points[(i + 1) % N]!;\n const p3 = points[(i + 2) % N]!;\n\n return {\n x: catmullRom1D(p0[0], p1[0], p2[0], p3[0], u),\n y: catmullRom1D(p0[1], p1[1], p2[1], p3[1], u),\n };\n}\n\n/**\n * The returned curve definition produces a closed Catmull-Rom spline that\n * passes through every point in order, looping back from the last point to the first.\n *\n * @param points Array of control points in **normalized `[−1, 1]` space**,\n * matching the playground's draw-mode coordinate system.\n * ! Must contain at least 3 points.\n * @param opts Optional overrides for the returned `CurveDef`.\n * @param opts.name Display name for the curve. Defaults to `\"drawn\"`.\n * @returns A `CurveDef` with `period: 2π` and the spline evaluator as its `fn`.\n * @throws If `points` has fewer than 3 entries.\n *\n * @example\n * ```ts\n * import { createSarmal, drawCurve } from '@sarmal/core'\n *\n * const curve = drawCurve([\n * [-0.5, 0.3],\n * [ 0.2, -0.8],\n * [ 0.7, 0.4],\n * ])\n *\n * createSarmal(canvas, curve)\n * ```\n */\nexport function drawCurve(points: Array<ControlPoint>, opts?: { name?: string }): CurveDef {\n if (points.length < 3) {\n throw new Error(`drawCurve requires at least 3 points, received ${points.length}.`);\n }\n\n const first = points[0]!;\n if (points.every((p) => p[0] === first[0] && p[1] === first[1])) {\n console.warn(\n \"[sarmal].drawCurve: all control points are identical. The curve will be a single point.\",\n );\n }\n\n const maxAbs = points.reduce((m, p) => Math.max(m, Math.abs(p[0]), Math.abs(p[1])), 0);\n if (maxAbs > 2) {\n console.warn(\n `[sarmal].drawCurve: control points extend to ±${maxAbs.toFixed(1)}, which may render off-screen. Coordinates should be in [-1, 1].`,\n );\n }\n\n const pts = points.map(([x, y]) => [x, y] as ControlPoint);\n\n return {\n name: opts?.name ?? \"drawn\",\n fn: (phase: number) => evaluateCatmullRom(pts, phase),\n period: PERIOD,\n };\n}\n","import type { ControlPoint, CurveDef } from \"../types\";\n\nimport { drawCurve } from \"../catmull-rom\";\n\nconst points: Array<ControlPoint> = [\n [-0.44, -0.45],\n [-0.53, -0.77],\n [-0.82, -0.66],\n [-0.82, -0.18],\n [-0.25, -0.04],\n [0.16, -0.49],\n [-0.03, -0.87],\n [-0.68, -0.94],\n [-0.95, -0.61],\n [-0.87, -0.0],\n [-0.34, 0.21],\n [0.27, -0.04],\n [0.87, 0.06],\n [0.87, 0.57],\n [0.32, 0.66],\n [-0.21, -0.43],\n [-0.43, -0.81],\n [-0.69, -0.84],\n [-0.87, -0.66],\n [-0.9, -0.47],\n [-0.76, -0.35],\n];\n\nexport const artemis2: CurveDef = {\n ...drawCurve(points, { name: \"Artemis II\" }),\n speed: 0.7,\n};\n"]}
@@ -1,22 +1,22 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  // src/curves/astroid.ts
4
4
  var TWO_PI = Math.PI * 2;
5
- function astroidFn(t, _time, _params) {
6
- const c = Math.cos(t);
7
- const s = Math.sin(t);
5
+ function astroidFn(phase, _elapsed, _params) {
6
+ const c = Math.cos(phase);
7
+ const s = Math.sin(phase);
8
8
  return {
9
9
  x: c * c * c,
10
- y: s * s * s,
10
+ y: s * s * s
11
11
  };
12
12
  }
13
13
  var astroid = {
14
14
  name: "Astroid",
15
15
  fn: astroidFn,
16
16
  period: TWO_PI,
17
- speed: 1.1,
17
+ speed: 1.1
18
18
  };
19
19
 
20
20
  exports.astroid = astroid;
21
21
  //# sourceMappingURL=astroid.cjs.map
22
- //# sourceMappingURL=astroid.cjs.map
22
+ //# sourceMappingURL=astroid.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/astroid.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAC5E,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACpB,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACpB,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA;AAAA,IACX,CAAA,EAAG,IAAI,CAAA,GAAI;AAAA,GACb;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"astroid.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction astroidFn(t: number, _time: number, _params: Record<string, number>) {\n const c = Math.cos(t);\n const s = Math.sin(t);\n return {\n x: c * c * c,\n y: s * s * s,\n };\n}\n\n/**\n * Astroid curve - a 4-cusped hypocycloid\n * Creates a star-like shape with four sharp corners\n */\nexport const astroid: CurveDef = {\n name: \"Astroid\",\n fn: astroidFn,\n period: TWO_PI,\n speed: 1.1,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/astroid.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACnF,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA;AACxB,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA;AACxB,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA;AAAA,IACX,CAAA,EAAG,IAAI,CAAA,GAAI;AAAA,GACb;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"astroid.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction astroidFn(phase: number, _elapsed: number, _params: Record<string, number>) {\n const c = Math.cos(phase);\n const s = Math.sin(phase);\n return {\n x: c * c * c,\n y: s * s * s,\n };\n}\n\n/**\n * Astroid curve - a 4-cusped hypocycloid\n * Creates a star-like shape with four sharp corners\n */\nexport const astroid: CurveDef = {\n name: \"Astroid\",\n fn: astroidFn,\n period: TWO_PI,\n speed: 1.1,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.cjs";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.js";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.js';
2
2
 
3
3
  /**
4
4
  * Astroid curve - a 4-cusped hypocycloid
@@ -1,20 +1,20 @@
1
1
  // src/curves/astroid.ts
2
2
  var TWO_PI = Math.PI * 2;
3
- function astroidFn(t, _time, _params) {
4
- const c = Math.cos(t);
5
- const s = Math.sin(t);
3
+ function astroidFn(phase, _elapsed, _params) {
4
+ const c = Math.cos(phase);
5
+ const s = Math.sin(phase);
6
6
  return {
7
7
  x: c * c * c,
8
- y: s * s * s,
8
+ y: s * s * s
9
9
  };
10
10
  }
11
11
  var astroid = {
12
12
  name: "Astroid",
13
13
  fn: astroidFn,
14
14
  period: TWO_PI,
15
- speed: 1.1,
15
+ speed: 1.1
16
16
  };
17
17
 
18
18
  export { astroid };
19
19
  //# sourceMappingURL=astroid.js.map
20
- //# sourceMappingURL=astroid.js.map
20
+ //# sourceMappingURL=astroid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/astroid.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAC5E,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACpB,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACpB,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA;AAAA,IACX,CAAA,EAAG,IAAI,CAAA,GAAI;AAAA,GACb;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"astroid.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction astroidFn(t: number, _time: number, _params: Record<string, number>) {\n const c = Math.cos(t);\n const s = Math.sin(t);\n return {\n x: c * c * c,\n y: s * s * s,\n };\n}\n\n/**\n * Astroid curve - a 4-cusped hypocycloid\n * Creates a star-like shape with four sharp corners\n */\nexport const astroid: CurveDef = {\n name: \"Astroid\",\n fn: astroidFn,\n period: TWO_PI,\n speed: 1.1,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/astroid.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACnF,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA;AACxB,EAAA,MAAM,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA;AACxB,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,CAAA,GAAI,CAAA;AAAA,IACX,CAAA,EAAG,IAAI,CAAA,GAAI;AAAA,GACb;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"astroid.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction astroidFn(phase: number, _elapsed: number, _params: Record<string, number>) {\n const c = Math.cos(phase);\n const s = Math.sin(phase);\n return {\n x: c * c * c,\n y: s * s * s,\n };\n}\n\n/**\n * Astroid curve - a 4-cusped hypocycloid\n * Creates a star-like shape with four sharp corners\n */\nexport const astroid: CurveDef = {\n name: \"Astroid\",\n fn: astroidFn,\n period: TWO_PI,\n speed: 1.1,\n};\n"]}
@@ -1,20 +1,20 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  // src/curves/deltoid.ts
4
4
  var TWO_PI = Math.PI * 2;
5
- function deltoidFn(t, _time, _params) {
5
+ function deltoidFn(phase, _elapsed, _params) {
6
6
  return {
7
- x: 2 * Math.cos(t) + Math.cos(2 * t),
8
- y: 2 * Math.sin(t) - Math.sin(2 * t),
7
+ x: 2 * Math.cos(phase) + Math.cos(2 * phase),
8
+ y: 2 * Math.sin(phase) - Math.sin(2 * phase)
9
9
  };
10
10
  }
11
11
  var deltoid = {
12
12
  name: "Deltoid",
13
13
  fn: deltoidFn,
14
14
  period: TWO_PI,
15
- speed: 0.9,
15
+ speed: 0.9
16
16
  };
17
17
 
18
18
  exports.deltoid = deltoid;
19
19
  //# sourceMappingURL=deltoid.cjs.map
20
- //# sourceMappingURL=deltoid.cjs.map
20
+ //# sourceMappingURL=deltoid.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/deltoid.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAC5E,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACnC,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACrC;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"deltoid.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction deltoidFn(t: number, _time: number, _params: Record<string, number>) {\n return {\n x: 2 * Math.cos(t) + Math.cos(2 * t),\n y: 2 * Math.sin(t) - Math.sin(2 * t),\n };\n}\n\n/**\n * Deltoid curve - a 3-cusped hypocycloid\n * Creates a triangular shape with curved sides\n */\nexport const deltoid: CurveDef = {\n name: \"Deltoid\",\n fn: deltoidFn,\n period: TWO_PI,\n speed: 0.9,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/deltoid.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACnF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC3C,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GAC7C;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"deltoid.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction deltoidFn(phase: number, _elapsed: number, _params: Record<string, number>) {\n return {\n x: 2 * Math.cos(phase) + Math.cos(2 * phase),\n y: 2 * Math.sin(phase) - Math.sin(2 * phase),\n };\n}\n\n/**\n * Deltoid curve - a 3-cusped hypocycloid\n * Creates a triangular shape with curved sides\n */\nexport const deltoid: CurveDef = {\n name: \"Deltoid\",\n fn: deltoidFn,\n period: TWO_PI,\n speed: 0.9,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.cjs";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.js";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.js';
2
2
 
3
3
  /**
4
4
  * Deltoid curve - a 3-cusped hypocycloid
@@ -1,18 +1,18 @@
1
1
  // src/curves/deltoid.ts
2
2
  var TWO_PI = Math.PI * 2;
3
- function deltoidFn(t, _time, _params) {
3
+ function deltoidFn(phase, _elapsed, _params) {
4
4
  return {
5
- x: 2 * Math.cos(t) + Math.cos(2 * t),
6
- y: 2 * Math.sin(t) - Math.sin(2 * t),
5
+ x: 2 * Math.cos(phase) + Math.cos(2 * phase),
6
+ y: 2 * Math.sin(phase) - Math.sin(2 * phase)
7
7
  };
8
8
  }
9
9
  var deltoid = {
10
10
  name: "Deltoid",
11
11
  fn: deltoidFn,
12
12
  period: TWO_PI,
13
- speed: 0.9,
13
+ speed: 0.9
14
14
  };
15
15
 
16
16
  export { deltoid };
17
17
  //# sourceMappingURL=deltoid.js.map
18
- //# sourceMappingURL=deltoid.js.map
18
+ //# sourceMappingURL=deltoid.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/deltoid.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAC5E,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACnC,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACrC;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"deltoid.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction deltoidFn(t: number, _time: number, _params: Record<string, number>) {\n return {\n x: 2 * Math.cos(t) + Math.cos(2 * t),\n y: 2 * Math.sin(t) - Math.sin(2 * t),\n };\n}\n\n/**\n * Deltoid curve - a 3-cusped hypocycloid\n * Creates a triangular shape with curved sides\n */\nexport const deltoid: CurveDef = {\n name: \"Deltoid\",\n fn: deltoidFn,\n period: TWO_PI,\n speed: 0.9,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/deltoid.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,SAAA,CAAU,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACnF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC3C,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GAC7C;AACF;AAMO,IAAM,OAAA,GAAoB;AAAA,EAC/B,IAAA,EAAM,SAAA;AAAA,EACN,EAAA,EAAI,SAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"deltoid.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction deltoidFn(phase: number, _elapsed: number, _params: Record<string, number>) {\n return {\n x: 2 * Math.cos(phase) + Math.cos(2 * phase),\n y: 2 * Math.sin(phase) - Math.sin(2 * phase),\n };\n}\n\n/**\n * Deltoid curve - a 3-cusped hypocycloid\n * Creates a triangular shape with curved sides\n */\nexport const deltoid: CurveDef = {\n name: \"Deltoid\",\n fn: deltoidFn,\n period: TWO_PI,\n speed: 0.9,\n};\n"]}
@@ -1,20 +1,20 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  // src/curves/epicycloid3.ts
4
4
  var TWO_PI = Math.PI * 2;
5
- function epicycloid3Fn(t, _time, _params) {
5
+ function epicycloid3Fn(phase, _elapsed, _params) {
6
6
  return {
7
- x: 4 * Math.cos(t) - Math.cos(4 * t),
8
- y: 4 * Math.sin(t) - Math.sin(4 * t),
7
+ x: 4 * Math.cos(phase) - Math.cos(4 * phase),
8
+ y: 4 * Math.sin(phase) - Math.sin(4 * phase)
9
9
  };
10
10
  }
11
11
  var epicycloid3 = {
12
12
  name: "Epicycloid (n=3)",
13
13
  fn: epicycloid3Fn,
14
14
  period: TWO_PI,
15
- speed: 0.75,
15
+ speed: 0.75
16
16
  };
17
17
 
18
18
  exports.epicycloid3 = epicycloid3;
19
19
  //# sourceMappingURL=epicycloid3.cjs.map
20
- //# sourceMappingURL=epicycloid3.cjs.map
20
+ //# sourceMappingURL=epicycloid3.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/epicycloid3.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,aAAA,CAAc,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAChF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACnC,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACrC;AACF;AAMO,IAAM,WAAA,GAAwB;AAAA,EACnC,IAAA,EAAM,kBAAA;AAAA,EACN,EAAA,EAAI,aAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"epicycloid3.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epicycloid3Fn(t: number, _time: number, _params: Record<string, number>) {\n return {\n x: 4 * Math.cos(t) - Math.cos(4 * t),\n y: 4 * Math.sin(t) - Math.sin(4 * t),\n };\n}\n\n/**\n * Epicycloid with 3 cusps\n * Creates a three-pointed star shape\n */\nexport const epicycloid3: CurveDef = {\n name: \"Epicycloid (n=3)\",\n fn: epicycloid3Fn,\n period: TWO_PI,\n speed: 0.75,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/epicycloid3.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,aAAA,CAAc,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACvF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC3C,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GAC7C;AACF;AAMO,IAAM,WAAA,GAAwB;AAAA,EACnC,IAAA,EAAM,kBAAA;AAAA,EACN,EAAA,EAAI,aAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"epicycloid3.cjs","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epicycloid3Fn(phase: number, _elapsed: number, _params: Record<string, number>) {\n return {\n x: 4 * Math.cos(phase) - Math.cos(4 * phase),\n y: 4 * Math.sin(phase) - Math.sin(4 * phase),\n };\n}\n\n/**\n * Epicycloid with 3 cusps\n * Creates a three-pointed star shape\n */\nexport const epicycloid3: CurveDef = {\n name: \"Epicycloid (n=3)\",\n fn: epicycloid3Fn,\n period: TWO_PI,\n speed: 0.75,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.cjs";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.js";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.js';
2
2
 
3
3
  /**
4
4
  * Epicycloid with 3 cusps
@@ -1,18 +1,18 @@
1
1
  // src/curves/epicycloid3.ts
2
2
  var TWO_PI = Math.PI * 2;
3
- function epicycloid3Fn(t, _time, _params) {
3
+ function epicycloid3Fn(phase, _elapsed, _params) {
4
4
  return {
5
- x: 4 * Math.cos(t) - Math.cos(4 * t),
6
- y: 4 * Math.sin(t) - Math.sin(4 * t),
5
+ x: 4 * Math.cos(phase) - Math.cos(4 * phase),
6
+ y: 4 * Math.sin(phase) - Math.sin(4 * phase)
7
7
  };
8
8
  }
9
9
  var epicycloid3 = {
10
10
  name: "Epicycloid (n=3)",
11
11
  fn: epicycloid3Fn,
12
12
  period: TWO_PI,
13
- speed: 0.75,
13
+ speed: 0.75
14
14
  };
15
15
 
16
16
  export { epicycloid3 };
17
17
  //# sourceMappingURL=epicycloid3.js.map
18
- //# sourceMappingURL=epicycloid3.js.map
18
+ //# sourceMappingURL=epicycloid3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/epicycloid3.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,aAAA,CAAc,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AAChF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACnC,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACrC;AACF;AAMO,IAAM,WAAA,GAAwB;AAAA,EACnC,IAAA,EAAM,kBAAA;AAAA,EACN,EAAA,EAAI,aAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"epicycloid3.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epicycloid3Fn(t: number, _time: number, _params: Record<string, number>) {\n return {\n x: 4 * Math.cos(t) - Math.cos(4 * t),\n y: 4 * Math.sin(t) - Math.sin(4 * t),\n };\n}\n\n/**\n * Epicycloid with 3 cusps\n * Creates a three-pointed star shape\n */\nexport const epicycloid3: CurveDef = {\n name: \"Epicycloid (n=3)\",\n fn: epicycloid3Fn,\n period: TWO_PI,\n speed: 0.75,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/epicycloid3.ts"],"names":[],"mappings":";AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,aAAA,CAAc,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACvF,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC3C,CAAA,EAAG,IAAI,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GAC7C;AACF;AAMO,IAAM,WAAA,GAAwB;AAAA,EACnC,IAAA,EAAM,kBAAA;AAAA,EACN,EAAA,EAAI,aAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO;AACT","file":"epicycloid3.js","sourcesContent":["import type { CurveDef } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epicycloid3Fn(phase: number, _elapsed: number, _params: Record<string, number>) {\n return {\n x: 4 * Math.cos(phase) - Math.cos(4 * phase),\n y: 4 * Math.sin(phase) - Math.sin(4 * phase),\n };\n}\n\n/**\n * Epicycloid with 3 cusps\n * Creates a three-pointed star shape\n */\nexport const epicycloid3: CurveDef = {\n name: \"Epicycloid (n=3)\",\n fn: epicycloid3Fn,\n period: TWO_PI,\n speed: 0.75,\n};\n"]}
@@ -1,19 +1,19 @@
1
- "use strict";
1
+ 'use strict';
2
2
 
3
3
  // src/curves/epitrochoid7.ts
4
4
  var TWO_PI = Math.PI * 2;
5
- function epitrochoid7Fn(t, _time, _params) {
6
- const d = 1 + 0.55 * Math.sin(t * 0.5);
5
+ function epitrochoid7Fn(phase, _elapsed, _params) {
6
+ const d = 1 + 0.55 * Math.sin(phase * 0.5);
7
7
  return {
8
- x: 7 * Math.cos(t) - d * Math.cos(7 * t),
9
- y: 7 * Math.sin(t) - d * Math.sin(7 * t),
8
+ x: 7 * Math.cos(phase) - d * Math.cos(7 * phase),
9
+ y: 7 * Math.sin(phase) - d * Math.sin(7 * phase)
10
10
  };
11
11
  }
12
- function epitrochoid7SkeletonFn(t) {
12
+ function epitrochoid7SkeletonFn(phase) {
13
13
  const d = 1.275;
14
14
  return {
15
- x: 7 * Math.cos(t) - d * Math.cos(7 * t),
16
- y: 7 * Math.sin(t) - d * Math.sin(7 * t),
15
+ x: 7 * Math.cos(phase) - d * Math.cos(7 * phase),
16
+ y: 7 * Math.sin(phase) - d * Math.sin(7 * phase)
17
17
  };
18
18
  }
19
19
  var epitrochoid7 = {
@@ -21,9 +21,9 @@ var epitrochoid7 = {
21
21
  fn: epitrochoid7Fn,
22
22
  period: TWO_PI,
23
23
  speed: 1.4,
24
- skeletonFn: epitrochoid7SkeletonFn,
24
+ skeletonFn: epitrochoid7SkeletonFn
25
25
  };
26
26
 
27
27
  exports.epitrochoid7 = epitrochoid7;
28
28
  //# sourceMappingURL=epitrochoid7.cjs.map
29
- //# sourceMappingURL=epitrochoid7.cjs.map
29
+ //# sourceMappingURL=epitrochoid7.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/curves/epitrochoid7.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,cAAA,CAAe,CAAA,EAAW,KAAA,EAAe,OAAA,EAAiC;AACjF,EAAA,MAAM,IAAI,CAAA,GAAM,IAAA,GAAO,IAAA,CAAK,GAAA,CAAI,IAAI,GAAG,CAAA;AACvC,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACvC,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACzC;AACF;AAEA,SAAS,uBAAuB,CAAA,EAAkB;AAEhD,EAAA,MAAM,CAAA,GAAI,KAAA;AACV,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC,CAAA;AAAA,IACvC,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAC,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,CAAC;AAAA,GACzC;AACF;AAMO,IAAM,YAAA,GAAyB;AAAA,EACpC,IAAA,EAAM,aAAA;AAAA,EACN,EAAA,EAAI,cAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,GAAA;AAAA,EACP,UAAA,EAAY;AACd","file":"epitrochoid7.cjs","sourcesContent":["import type { CurveDef, Point } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epitrochoid7Fn(t: number, _time: number, _params: Record<string, number>) {\n const d = 1.0 + 0.55 * Math.sin(t * 0.5);\n return {\n x: 7 * Math.cos(t) - d * Math.cos(7 * t),\n y: 7 * Math.sin(t) - d * Math.sin(7 * t),\n };\n}\n\nfunction epitrochoid7SkeletonFn(t: number): Point {\n // average of the oscillating range for a stable base shape\n const d = 1.275;\n return {\n x: 7 * Math.cos(t) - d * Math.cos(7 * t),\n y: 7 * Math.sin(t) - d * Math.sin(7 * t),\n };\n}\n\n/**\n * Epitrochoid with 7 lobes and dynamic variation\n * Creates a flower-like pattern with undulating petals\n */\nexport const epitrochoid7: CurveDef = {\n name: \"Epitrochoid\",\n fn: epitrochoid7Fn,\n period: TWO_PI,\n speed: 1.4,\n skeletonFn: epitrochoid7SkeletonFn,\n};\n"]}
1
+ {"version":3,"sources":["../../src/curves/epitrochoid7.ts"],"names":[],"mappings":";;;AAEA,IAAM,MAAA,GAAS,KAAK,EAAA,GAAK,CAAA;AAEzB,SAAS,cAAA,CAAe,KAAA,EAAe,QAAA,EAAkB,OAAA,EAAiC;AACxF,EAAA,MAAM,IAAI,CAAA,GAAM,IAAA,GAAO,IAAA,CAAK,GAAA,CAAI,QAAQ,GAAG,CAAA;AAC3C,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC/C,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GACjD;AACF;AAEA,SAAS,uBAAuB,KAAA,EAAsB;AAEpD,EAAA,MAAM,CAAA,GAAI,KAAA;AACV,EAAA,OAAO;AAAA,IACL,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK,CAAA;AAAA,IAC/C,CAAA,EAAG,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA,GAAI,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,KAAK;AAAA,GACjD;AACF;AAMO,IAAM,YAAA,GAAyB;AAAA,EACpC,IAAA,EAAM,aAAA;AAAA,EACN,EAAA,EAAI,cAAA;AAAA,EACJ,MAAA,EAAQ,MAAA;AAAA,EACR,KAAA,EAAO,GAAA;AAAA,EACP,UAAA,EAAY;AACd","file":"epitrochoid7.cjs","sourcesContent":["import type { CurveDef, Point } from \"../types\";\n\nconst TWO_PI = Math.PI * 2;\n\nfunction epitrochoid7Fn(phase: number, _elapsed: number, _params: Record<string, number>) {\n const d = 1.0 + 0.55 * Math.sin(phase * 0.5);\n return {\n x: 7 * Math.cos(phase) - d * Math.cos(7 * phase),\n y: 7 * Math.sin(phase) - d * Math.sin(7 * phase),\n };\n}\n\nfunction epitrochoid7SkeletonFn(phase: number): Point {\n // average of the oscillating range for a stable base shape\n const d = 1.275;\n return {\n x: 7 * Math.cos(phase) - d * Math.cos(7 * phase),\n y: 7 * Math.sin(phase) - d * Math.sin(7 * phase),\n };\n}\n\n/**\n * Epitrochoid with 7 lobes and dynamic variation\n * Creates a flower-like pattern with undulating petals\n */\nexport const epitrochoid7: CurveDef = {\n name: \"Epitrochoid\",\n fn: epitrochoid7Fn,\n period: TWO_PI,\n speed: 1.4,\n skeletonFn: epitrochoid7SkeletonFn,\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.cjs";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.cjs';
2
2
 
3
3
  /**
4
4
  * Epitrochoid with 7 lobes and dynamic variation
@@ -1,4 +1,4 @@
1
- import { C as CurveDef } from "../types-Z9i1_AQZ.js";
1
+ import { C as CurveDef } from '../types-zbxUgcmZ.js';
2
2
 
3
3
  /**
4
4
  * Epitrochoid with 7 lobes and dynamic variation