@sarmal/core 0.9.0 → 0.9.1

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 (81) hide show
  1. package/dist/auto-init.cjs +206 -139
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.d.cts +1 -2
  4. package/dist/auto-init.d.ts +1 -2
  5. package/dist/auto-init.js +205 -138
  6. package/dist/auto-init.js.map +1 -1
  7. package/dist/curves/artemis2.cjs +26 -0
  8. package/dist/curves/artemis2.cjs.map +1 -0
  9. package/dist/curves/artemis2.d.cts +9 -0
  10. package/dist/curves/artemis2.d.ts +9 -0
  11. package/dist/curves/artemis2.js +24 -0
  12. package/dist/curves/artemis2.js.map +1 -0
  13. package/dist/curves/astroid.cjs +22 -0
  14. package/dist/curves/astroid.cjs.map +1 -0
  15. package/dist/curves/astroid.d.cts +9 -0
  16. package/dist/curves/astroid.d.ts +9 -0
  17. package/dist/curves/astroid.js +20 -0
  18. package/dist/curves/astroid.js.map +1 -0
  19. package/dist/curves/deltoid.cjs +20 -0
  20. package/dist/curves/deltoid.cjs.map +1 -0
  21. package/dist/curves/deltoid.d.cts +9 -0
  22. package/dist/curves/deltoid.d.ts +9 -0
  23. package/dist/curves/deltoid.js +18 -0
  24. package/dist/curves/deltoid.js.map +1 -0
  25. package/dist/curves/epicycloid3.cjs +20 -0
  26. package/dist/curves/epicycloid3.cjs.map +1 -0
  27. package/dist/curves/epicycloid3.d.cts +9 -0
  28. package/dist/curves/epicycloid3.d.ts +9 -0
  29. package/dist/curves/epicycloid3.js +18 -0
  30. package/dist/curves/epicycloid3.js.map +1 -0
  31. package/dist/curves/epitrochoid7.cjs +29 -0
  32. package/dist/curves/epitrochoid7.cjs.map +1 -0
  33. package/dist/curves/epitrochoid7.d.cts +9 -0
  34. package/dist/curves/epitrochoid7.d.ts +9 -0
  35. package/dist/curves/epitrochoid7.js +27 -0
  36. package/dist/curves/epitrochoid7.js.map +1 -0
  37. package/dist/curves/index.cjs +206 -0
  38. package/dist/curves/index.cjs.map +1 -0
  39. package/dist/curves/index.d.cts +19 -0
  40. package/dist/curves/index.d.ts +19 -0
  41. package/dist/curves/index.js +206 -0
  42. package/dist/curves/index.js.map +1 -0
  43. package/dist/curves/lame.cjs +24 -0
  44. package/dist/curves/lame.cjs.map +1 -0
  45. package/dist/curves/lame.d.cts +9 -0
  46. package/dist/curves/lame.d.ts +9 -0
  47. package/dist/curves/lame.js +22 -0
  48. package/dist/curves/lame.js.map +1 -0
  49. package/dist/curves/lissajous32.cjs +22 -0
  50. package/dist/curves/lissajous32.cjs.map +1 -0
  51. package/dist/curves/lissajous32.d.cts +9 -0
  52. package/dist/curves/lissajous32.d.ts +9 -0
  53. package/dist/curves/lissajous32.js +20 -0
  54. package/dist/curves/lissajous32.js.map +1 -0
  55. package/dist/curves/lissajous43.cjs +22 -0
  56. package/dist/curves/lissajous43.cjs.map +1 -0
  57. package/dist/curves/lissajous43.d.cts +9 -0
  58. package/dist/curves/lissajous43.d.ts +9 -0
  59. package/dist/curves/lissajous43.js +20 -0
  60. package/dist/curves/lissajous43.js.map +1 -0
  61. package/dist/curves/rose3.cjs +21 -0
  62. package/dist/curves/rose3.cjs.map +1 -0
  63. package/dist/curves/rose3.d.cts +9 -0
  64. package/dist/curves/rose3.d.ts +9 -0
  65. package/dist/curves/rose3.js +19 -0
  66. package/dist/curves/rose3.js.map +1 -0
  67. package/dist/curves/rose5.cjs +21 -0
  68. package/dist/curves/rose5.cjs.map +1 -0
  69. package/dist/curves/rose5.d.cts +9 -0
  70. package/dist/curves/rose5.d.ts +9 -0
  71. package/dist/curves/rose5.js +19 -0
  72. package/dist/curves/rose5.js.map +1 -0
  73. package/dist/index.cjs +208 -139
  74. package/dist/index.cjs.map +1 -1
  75. package/dist/index.d.cts +64 -233
  76. package/dist/index.d.ts +64 -233
  77. package/dist/index.js +215 -139
  78. package/dist/index.js.map +1 -1
  79. package/dist/types-DX8VfIVK.d.cts +226 -0
  80. package/dist/types-DX8VfIVK.d.ts +226 -0
  81. package/package.json +11 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
3
  // src/engine.ts
4
4
  var TWO_PI = Math.PI * 2;
@@ -51,7 +51,7 @@ function resolveCurve(curveDef) {
51
51
  period: curveDef.period ?? TWO_PI,
52
52
  speed: curveDef.speed ?? 1,
53
53
  skeleton: curveDef.skeleton,
54
- skeletonFn: curveDef.skeletonFn
54
+ skeletonFn: curveDef.skeletonFn,
55
55
  };
56
56
  }
57
57
  function createEngine(curveDef, trailLength = 120) {
@@ -77,7 +77,7 @@ function createEngine(curveDef, trailLength = 120) {
77
77
  actualTime += deltaTime;
78
78
  if (morphCurveB !== null && _morphAlpha !== null) {
79
79
  const a = curve.fn(t, actualTime, {});
80
- const tB = _morphStrategy === "normalized" ? t / curve.period * morphCurveB.period : t;
80
+ const tB = _morphStrategy === "normalized" ? (t / curve.period) * morphCurveB.period : t;
81
81
  const b = morphCurveB.fn(tB, actualTime, {});
82
82
  trail.push(a.x + (b.x - a.x) * _morphAlpha, a.y + (b.y - a.y) * _morphAlpha);
83
83
  } else {
@@ -101,14 +101,14 @@ function createEngine(curveDef, trailLength = 120) {
101
101
  trail.clear();
102
102
  },
103
103
  seek(newT, { clearTrail = false } = {}) {
104
- t = (newT % curve.period + curve.period) % curve.period;
104
+ t = ((newT % curve.period) + curve.period) % curve.period;
105
105
  if (clearTrail) {
106
106
  trail.clear();
107
107
  }
108
108
  },
109
109
  seekWithTrail(targetT, { wrap = false, step = curve.period / trailLength } = {}) {
110
110
  const advance = curve.speed * step;
111
- const target = (targetT % curve.period + curve.period) % curve.period;
111
+ const target = ((targetT % curve.period) + curve.period) % curve.period;
112
112
  const targetTime = target / curve.speed;
113
113
  t = target;
114
114
  actualTime = targetTime;
@@ -134,13 +134,16 @@ function createEngine(curveDef, trailLength = 120) {
134
134
  ...frozenB,
135
135
  fn: (sampleT, time, params) => {
136
136
  const a = frozenA.fn(sampleT, time, params);
137
- const tB = frozenStrategy === "normalized" ? sampleT / frozenA.period * frozenB.period : sampleT;
137
+ const tB =
138
+ frozenStrategy === "normalized"
139
+ ? (sampleT / frozenA.period) * frozenB.period
140
+ : sampleT;
138
141
  const b = frozenB.fn(tB, time, params);
139
142
  return {
140
143
  x: a.x + (b.x - a.x) * frozenAlpha,
141
- y: a.y + (b.y - a.y) * frozenAlpha
144
+ y: a.y + (b.y - a.y) * frozenAlpha,
142
145
  };
143
- }
146
+ },
144
147
  };
145
148
  }
146
149
  _morphStrategy = strategy;
@@ -153,7 +156,7 @@ function createEngine(curveDef, trailLength = 120) {
153
156
  completeMorph() {
154
157
  if (morphCurveB !== null) {
155
158
  if (_morphStrategy === "normalized" && curve.period !== morphCurveB.period) {
156
- t = t / curve.period * morphCurveB.period;
159
+ t = (t / curve.period) * morphCurveB.period;
157
160
  }
158
161
  curve = morphCurveB;
159
162
  }
@@ -165,23 +168,26 @@ function createEngine(curveDef, trailLength = 120) {
165
168
  const points = new Array(steps);
166
169
  if (morphCurveB !== null && _morphAlpha !== null) {
167
170
  for (let i = 0; i < steps; i++) {
168
- const sampleT = i / (steps - 1) * curve.period;
171
+ const sampleT = (i / (steps - 1)) * curve.period;
169
172
  const a = sampleSkeleton(curve, sampleT);
170
- const tB = _morphStrategy === "normalized" ? sampleT / curve.period * morphCurveB.period : sampleT;
173
+ const tB =
174
+ _morphStrategy === "normalized"
175
+ ? (sampleT / curve.period) * morphCurveB.period
176
+ : sampleT;
171
177
  const b = sampleSkeleton(morphCurveB, tB);
172
178
  points[i] = {
173
179
  x: a.x + (b.x - a.x) * _morphAlpha,
174
- y: a.y + (b.y - a.y) * _morphAlpha
180
+ y: a.y + (b.y - a.y) * _morphAlpha,
175
181
  };
176
182
  }
177
183
  return points;
178
184
  }
179
185
  for (let i = 0; i < steps; i++) {
180
- const sampleT = i / (steps - 1) * curve.period;
186
+ const sampleT = (i / (steps - 1)) * curve.period;
181
187
  points[i] = sampleSkeleton(curve, sampleT);
182
188
  }
183
189
  return points;
184
- }
190
+ },
185
191
  };
186
192
  }
187
193
 
@@ -201,7 +207,7 @@ var GRADIENT = {
201
207
  ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"],
202
208
  ice: ["#1e3a8a", "#67e8f9"],
203
209
  fire: ["#7f1d1d", "#fbbf24"],
204
- forest: ["#14532d", "#86efac"]
210
+ forest: ["#14532d", "#86efac"],
205
211
  };
206
212
  var PRESETS = {
207
213
  bard: GRADIENT.bard,
@@ -209,16 +215,16 @@ var PRESETS = {
209
215
  ocean: GRADIENT.ocean,
210
216
  ice: GRADIENT.ice,
211
217
  fire: GRADIENT.fire,
212
- forest: GRADIENT.forest
218
+ forest: GRADIENT.forest,
213
219
  };
214
220
  function hexToRgb(hex) {
215
221
  const n = parseInt(hex.slice(1), 16);
216
- return { r: n >> 16, g: n >> 8 & 255, b: n & 255 };
222
+ return { r: n >> 16, g: (n >> 8) & 255, b: n & 255 };
217
223
  }
218
224
  var lerpRgb = (a, b, t) => ({
219
225
  r: Math.round(a.r + (b.r - a.r) * t),
220
226
  g: Math.round(a.g + (b.g - a.g) * t),
221
- b: Math.round(a.b + (b.b - a.b) * t)
227
+ b: Math.round(a.b + (b.b - a.b) * t),
222
228
  });
223
229
  function getPaletteColor(palette, position, timeOffset = 0) {
224
230
  if (palette.length === 0) return { r: 255, g: 255, b: 255 };
@@ -238,7 +244,7 @@ function resolvePalette(palette, trailStyle) {
238
244
  }
239
245
  function hexToRgbComponents(hex) {
240
246
  const n = parseInt(hex.slice(1), 16);
241
- return `${n >> 16},${n >> 8 & 255},${n & 255}`;
247
+ return `${n >> 16},${(n >> 8) & 255},${n & 255}`;
242
248
  }
243
249
  function computeTangent(trail, i) {
244
250
  const count = trail.length;
@@ -283,7 +289,7 @@ function createRenderer(options) {
283
289
  skeletonColor: options.skeletonColor ?? DEFAULT_SKELETON_COLOR,
284
290
  trailColor: options.trailColor ?? "#ffffff",
285
291
  headColor: options.headColor ?? "#ffffff",
286
- headRadius: options.headRadius ?? DEFAULT_HEAD_RADIUS
292
+ headRadius: options.headRadius ?? DEFAULT_HEAD_RADIUS,
287
293
  };
288
294
  const trailStyle = options.trailStyle ?? "default";
289
295
  const palette = resolvePalette(options.palette, trailStyle);
@@ -316,7 +322,10 @@ function createRenderer(options) {
316
322
  function computeBoundaries(pts) {
317
323
  if (pts.length === 0) return null;
318
324
  const first = pts[0];
319
- let minX = first.x, maxX = first.x, minY = first.y, maxY = first.y;
325
+ let minX = first.x,
326
+ maxX = first.x,
327
+ minY = first.y,
328
+ maxY = first.y;
320
329
  for (const p of pts) {
321
330
  if (p.x < minX) minX = p.x;
322
331
  if (p.x > maxX) maxX = p.x;
@@ -333,7 +342,7 @@ function createRenderer(options) {
333
342
  return {
334
343
  scale: s,
335
344
  offsetX: (logicalWidth - boundsWidth) / 2 - minX * s,
336
- offsetY: (logicalHeight - boundsHeight) / 2 - minY * s
345
+ offsetY: (logicalHeight - boundsHeight) / 2 - minY * s,
337
346
  };
338
347
  }
339
348
  function calculateBoundaries() {
@@ -539,7 +548,7 @@ function createRenderer(options) {
539
548
  return new Promise((resolve) => {
540
549
  morphResolve = resolve;
541
550
  });
542
- }
551
+ },
543
552
  };
544
553
  }
545
554
 
@@ -562,7 +571,7 @@ function createSVGRenderer(options) {
562
571
  trailColor: options.trailColor ?? "#ffffff",
563
572
  headColor: options.headColor ?? "#ffffff",
564
573
  headRadius: options.headRadius ?? 4,
565
- ariaLabel: options.ariaLabel ?? "Loading"
574
+ ariaLabel: options.ariaLabel ?? "Loading",
566
575
  };
567
576
  const rect = container.getBoundingClientRect();
568
577
  const width = rect.width || 200;
@@ -616,7 +625,10 @@ function createSVGRenderer(options) {
616
625
  return;
617
626
  }
618
627
  const first = skeleton2[0];
619
- let minX = first.x, maxX = first.x, minY = first.y, maxY = first.y;
628
+ let minX = first.x,
629
+ maxX = first.x,
630
+ minY = first.y,
631
+ maxY = first.y;
620
632
  for (const p of skeleton2) {
621
633
  if (p.x < minX) {
622
634
  minX = p.x;
@@ -715,7 +727,8 @@ function createSVGRenderer(options) {
715
727
  }
716
728
  let animationId = null;
717
729
  let lastTime = 0;
718
- const prefersReducedMotion = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
730
+ const prefersReducedMotion =
731
+ typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
719
732
  let morphResolve = null;
720
733
  let morphDurationMs = DEFAULT_MORPH_DURATION_MS2;
721
734
  let morphTarget = null;
@@ -725,7 +738,7 @@ function createSVGRenderer(options) {
725
738
  const samples = Math.max(50, Math.round(period * 20));
726
739
  const points = [];
727
740
  for (let i = 0; i <= samples; i++) {
728
- const t = i / samples * period;
741
+ const t = (i / samples) * period;
729
742
  const p = target.fn(t, 0, {});
730
743
  points.push(p);
731
744
  }
@@ -753,13 +766,16 @@ function createSVGRenderer(options) {
753
766
  skeletonPathA.setAttribute("visibility", "visible");
754
767
  skeletonPathA.setAttribute(
755
768
  "stroke-opacity",
756
- String((1 - morphAlpha) * DEFAULT_SKELETON_OPACITY2)
769
+ String((1 - morphAlpha) * DEFAULT_SKELETON_OPACITY2),
757
770
  );
758
771
  }
759
772
  if (morphPathBBuilt) {
760
773
  skeletonPathB.setAttribute("d", morphPathBBuilt);
761
774
  skeletonPathB.setAttribute("visibility", "visible");
762
- skeletonPathB.setAttribute("stroke-opacity", String(morphAlpha * DEFAULT_SKELETON_OPACITY2));
775
+ skeletonPathB.setAttribute(
776
+ "stroke-opacity",
777
+ String(morphAlpha * DEFAULT_SKELETON_OPACITY2),
778
+ );
763
779
  }
764
780
  if (morphAlpha >= 1) {
765
781
  engine.completeMorph();
@@ -851,7 +867,7 @@ function createSVGRenderer(options) {
851
867
  return new Promise((resolve) => {
852
868
  morphResolve = resolve;
853
869
  });
854
- }
870
+ },
855
871
  };
856
872
  }
857
873
  function createSarmalSVG(container, curveDef, options) {
@@ -860,152 +876,195 @@ function createSarmalSVG(container, curveDef, options) {
860
876
  return createSVGRenderer({ container, engine, ...rendererOpts });
861
877
  }
862
878
 
863
- // src/curves.ts
879
+ // src/curves/artemis2.ts
864
880
  var TWO_PI2 = Math.PI * 2;
865
- function artemis2(t, _time, _params) {
866
- const a = 0.35, b = 0.15, ox = 0.175;
867
- const s = Math.sin(t), c = Math.cos(t);
881
+ function artemis2Fn(t, _time, _params) {
882
+ const a = 0.35,
883
+ b = 0.15,
884
+ ox = 0.175;
885
+ const s = Math.sin(t),
886
+ c = Math.cos(t);
868
887
  const denom = 1 + s * s;
869
888
  return {
870
- x: c * (1 + a * c) / denom - ox,
871
- y: s * c * (1 + b * c) / denom
872
- };
873
- }
874
- function epitrochoid7(t, _time, _params) {
875
- const d = 1 + 0.55 * Math.sin(t * 0.5);
876
- return {
877
- x: 7 * Math.cos(t) - d * Math.cos(7 * t),
878
- y: 7 * Math.sin(t) - d * Math.sin(7 * t)
879
- };
880
- }
881
- function epitrochoid7Skeleton(t) {
882
- const d = 1.275;
883
- return {
884
- x: 7 * Math.cos(t) - d * Math.cos(7 * t),
885
- y: 7 * Math.sin(t) - d * Math.sin(7 * t)
889
+ x: (c * (1 + a * c)) / denom - ox,
890
+ y: (s * c * (1 + b * c)) / denom,
886
891
  };
887
892
  }
888
- function astroid(t, _time, _params) {
893
+ var artemis2 = {
894
+ name: "Artemis II",
895
+ fn: artemis2Fn,
896
+ period: TWO_PI2,
897
+ speed: 0.7,
898
+ };
899
+
900
+ // src/curves/astroid.ts
901
+ var TWO_PI3 = Math.PI * 2;
902
+ function astroidFn(t, _time, _params) {
889
903
  const c = Math.cos(t);
890
904
  const s = Math.sin(t);
891
905
  return {
892
906
  x: c * c * c,
893
- y: s * s * s
907
+ y: s * s * s,
894
908
  };
895
909
  }
896
- function deltoid(t, _time, _params) {
910
+ var astroid = {
911
+ name: "Astroid",
912
+ fn: astroidFn,
913
+ period: TWO_PI3,
914
+ speed: 1.1,
915
+ };
916
+
917
+ // src/curves/deltoid.ts
918
+ var TWO_PI4 = Math.PI * 2;
919
+ function deltoidFn(t, _time, _params) {
897
920
  return {
898
921
  x: 2 * Math.cos(t) + Math.cos(2 * t),
899
- y: 2 * Math.sin(t) - Math.sin(2 * t)
922
+ y: 2 * Math.sin(t) - Math.sin(2 * t),
900
923
  };
901
924
  }
902
- function rose5(t, _time, _params) {
903
- const r = Math.cos(5 * t);
925
+ var deltoid = {
926
+ name: "Deltoid",
927
+ fn: deltoidFn,
928
+ period: TWO_PI4,
929
+ speed: 0.9,
930
+ };
931
+
932
+ // src/curves/epicycloid3.ts
933
+ var TWO_PI5 = Math.PI * 2;
934
+ function epicycloid3Fn(t, _time, _params) {
904
935
  return {
905
- x: r * Math.cos(t),
906
- y: r * Math.sin(t)
936
+ x: 4 * Math.cos(t) - Math.cos(4 * t),
937
+ y: 4 * Math.sin(t) - Math.sin(4 * t),
907
938
  };
908
939
  }
909
- function rose3(t, _time, _params) {
910
- const r = Math.cos(3 * t);
940
+ var epicycloid3 = {
941
+ name: "Epicycloid (n=3)",
942
+ fn: epicycloid3Fn,
943
+ period: TWO_PI5,
944
+ speed: 0.75,
945
+ };
946
+
947
+ // src/curves/epitrochoid7.ts
948
+ var TWO_PI6 = Math.PI * 2;
949
+ function epitrochoid7Fn(t, _time, _params) {
950
+ const d = 1 + 0.55 * Math.sin(t * 0.5);
911
951
  return {
912
- x: r * Math.cos(t),
913
- y: r * Math.sin(t)
952
+ x: 7 * Math.cos(t) - d * Math.cos(7 * t),
953
+ y: 7 * Math.sin(t) - d * Math.sin(7 * t),
954
+ };
955
+ }
956
+ function epitrochoid7SkeletonFn(t) {
957
+ const d = 1.275;
958
+ return {
959
+ x: 7 * Math.cos(t) - d * Math.cos(7 * t),
960
+ y: 7 * Math.sin(t) - d * Math.sin(7 * t),
914
961
  };
915
962
  }
916
- function lissajous32(t, time, _params) {
963
+ var epitrochoid7 = {
964
+ name: "Epitrochoid",
965
+ fn: epitrochoid7Fn,
966
+ period: TWO_PI6,
967
+ speed: 1.4,
968
+ skeletonFn: epitrochoid7SkeletonFn,
969
+ };
970
+
971
+ // src/curves/lissajous32.ts
972
+ var TWO_PI7 = Math.PI * 2;
973
+ function lissajous32Fn(t, time, _params) {
917
974
  const phi = time * 0.45;
918
975
  return {
919
976
  x: Math.sin(3 * t + phi),
920
- y: Math.sin(2 * t)
977
+ y: Math.sin(2 * t),
921
978
  };
922
979
  }
923
- function lissajous43(t, time, _params) {
980
+ var lissajous32 = {
981
+ name: "Lissajous 3:2",
982
+ fn: lissajous32Fn,
983
+ period: TWO_PI7,
984
+ speed: 2,
985
+ skeleton: "live",
986
+ };
987
+
988
+ // src/curves/lissajous43.ts
989
+ var TWO_PI8 = Math.PI * 2;
990
+ function lissajous43Fn(t, time, _params) {
924
991
  const phi = time * 0.38;
925
992
  return {
926
993
  x: Math.sin(4 * t + phi),
927
- y: Math.sin(3 * t)
994
+ y: Math.sin(3 * t),
928
995
  };
929
996
  }
930
- function epicycloid3(t, _time, _params) {
997
+ var lissajous43 = {
998
+ name: "Lissajous 4:3",
999
+ fn: lissajous43Fn,
1000
+ period: TWO_PI8,
1001
+ speed: 1.8,
1002
+ skeleton: "live",
1003
+ };
1004
+
1005
+ // src/curves/lame.ts
1006
+ var TWO_PI9 = Math.PI * 2;
1007
+ function lameFn(t, time, _params) {
1008
+ const p = 1.75 + 1.25 * Math.sin(time * 0.48);
1009
+ const c = Math.cos(t),
1010
+ s = Math.sin(t);
931
1011
  return {
932
- x: 4 * Math.cos(t) - Math.cos(4 * t),
933
- y: 4 * Math.sin(t) - Math.sin(4 * t)
1012
+ x: Math.sign(c) * Math.pow(Math.abs(c), p),
1013
+ y: Math.sign(s) * Math.pow(Math.abs(s), p),
934
1014
  };
935
1015
  }
936
- function lame(t, time, _params) {
937
- const p = 1.75 + 1.25 * Math.sin(time * 0.48);
938
- const c = Math.cos(t), s = Math.sin(t);
1016
+ var lame = {
1017
+ name: "Lam\xE9 Curve",
1018
+ fn: lameFn,
1019
+ period: TWO_PI9,
1020
+ speed: 1,
1021
+ skeleton: "live",
1022
+ };
1023
+
1024
+ // src/curves/rose3.ts
1025
+ var TWO_PI10 = Math.PI * 2;
1026
+ function rose3Fn(t, _time, _params) {
1027
+ const r = Math.cos(3 * t);
939
1028
  return {
940
- x: Math.sign(c) * Math.pow(Math.abs(c), p),
941
- y: Math.sign(s) * Math.pow(Math.abs(s), p)
1029
+ x: r * Math.cos(t),
1030
+ y: r * Math.sin(t),
1031
+ };
1032
+ }
1033
+ var rose3 = {
1034
+ name: "Rose (n=3)",
1035
+ fn: rose3Fn,
1036
+ period: TWO_PI10,
1037
+ speed: 1.15,
1038
+ };
1039
+
1040
+ // src/curves/rose5.ts
1041
+ var TWO_PI11 = Math.PI * 2;
1042
+ function rose5Fn(t, _time, _params) {
1043
+ const r = Math.cos(5 * t);
1044
+ return {
1045
+ x: r * Math.cos(t),
1046
+ y: r * Math.sin(t),
942
1047
  };
943
1048
  }
1049
+ var rose5 = {
1050
+ name: "Rose (n=5)",
1051
+ fn: rose5Fn,
1052
+ period: TWO_PI11,
1053
+ speed: 1,
1054
+ };
1055
+
1056
+ // src/curves/index.ts
944
1057
  var curves = {
945
- artemis2: {
946
- name: "Artemis II",
947
- fn: artemis2,
948
- period: TWO_PI2,
949
- speed: 0.7
950
- },
951
- epitrochoid7: {
952
- name: "Epitrochoid",
953
- fn: epitrochoid7,
954
- period: TWO_PI2,
955
- speed: 1.4,
956
- skeletonFn: epitrochoid7Skeleton
957
- },
958
- astroid: {
959
- name: "Astroid",
960
- fn: astroid,
961
- period: TWO_PI2,
962
- speed: 1.1
963
- },
964
- deltoid: {
965
- name: "Deltoid",
966
- fn: deltoid,
967
- period: TWO_PI2,
968
- speed: 0.9
969
- },
970
- rose5: {
971
- name: "Rose (n=5)",
972
- fn: rose5,
973
- period: TWO_PI2,
974
- speed: 1
975
- },
976
- rose3: {
977
- name: "Rose (n=3)",
978
- fn: rose3,
979
- period: TWO_PI2,
980
- speed: 1.15
981
- },
982
- lissajous32: {
983
- name: "Lissajous 3:2",
984
- fn: lissajous32,
985
- period: TWO_PI2,
986
- speed: 2,
987
- skeleton: "live"
988
- },
989
- lissajous43: {
990
- name: "Lissajous 4:3",
991
- fn: lissajous43,
992
- period: TWO_PI2,
993
- speed: 1.8,
994
- skeleton: "live"
995
- },
996
- epicycloid3: {
997
- name: "Epicycloid (n=3)",
998
- fn: epicycloid3,
999
- period: TWO_PI2,
1000
- speed: 0.75
1001
- },
1002
- lame: {
1003
- name: "Lam\xE9 Curve",
1004
- fn: lame,
1005
- period: TWO_PI2,
1006
- speed: 1,
1007
- skeleton: "live"
1008
- }
1058
+ artemis2,
1059
+ epitrochoid7,
1060
+ astroid,
1061
+ deltoid,
1062
+ rose5,
1063
+ rose3,
1064
+ lissajous32,
1065
+ lissajous43,
1066
+ epicycloid3,
1067
+ lame,
1009
1068
  };
1010
1069
 
1011
1070
  // src/index.ts
@@ -1015,11 +1074,21 @@ function createSarmal(canvas, curveDef, options) {
1015
1074
  return createRenderer({ canvas, engine, ...rendererOpts });
1016
1075
  }
1017
1076
 
1077
+ exports.artemis2 = artemis2;
1078
+ exports.astroid = astroid;
1018
1079
  exports.createEngine = createEngine;
1019
1080
  exports.createRenderer = createRenderer;
1020
1081
  exports.createSVGRenderer = createSVGRenderer;
1021
1082
  exports.createSarmal = createSarmal;
1022
1083
  exports.createSarmalSVG = createSarmalSVG;
1023
1084
  exports.curves = curves;
1085
+ exports.deltoid = deltoid;
1086
+ exports.epicycloid3 = epicycloid3;
1087
+ exports.epitrochoid7 = epitrochoid7;
1088
+ exports.lame = lame;
1089
+ exports.lissajous32 = lissajous32;
1090
+ exports.lissajous43 = lissajous43;
1091
+ exports.rose3 = rose3;
1092
+ exports.rose5 = rose5;
1093
+ //# sourceMappingURL=index.cjs.map
1024
1094
  //# sourceMappingURL=index.cjs.map
1025
- //# sourceMappingURL=index.cjs.map