@sarmal/core 0.13.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.
Files changed (61) hide show
  1. package/dist/auto-init.cjs +84 -89
  2. package/dist/auto-init.cjs.map +1 -1
  3. package/dist/auto-init.d.cts +2 -1
  4. package/dist/auto-init.d.ts +2 -1
  5. package/dist/auto-init.js +83 -88
  6. package/dist/auto-init.js.map +1 -1
  7. package/dist/curves/artemis2.cjs +7 -10
  8. package/dist/curves/artemis2.d.cts +1 -1
  9. package/dist/curves/artemis2.d.ts +1 -1
  10. package/dist/curves/artemis2.js +6 -9
  11. package/dist/curves/astroid.cjs +4 -4
  12. package/dist/curves/astroid.d.cts +1 -1
  13. package/dist/curves/astroid.d.ts +1 -1
  14. package/dist/curves/astroid.js +3 -3
  15. package/dist/curves/deltoid.cjs +4 -4
  16. package/dist/curves/deltoid.d.cts +1 -1
  17. package/dist/curves/deltoid.d.ts +1 -1
  18. package/dist/curves/deltoid.js +3 -3
  19. package/dist/curves/epicycloid3.cjs +4 -4
  20. package/dist/curves/epicycloid3.d.cts +1 -1
  21. package/dist/curves/epicycloid3.d.ts +1 -1
  22. package/dist/curves/epicycloid3.js +3 -3
  23. package/dist/curves/epitrochoid7.cjs +5 -5
  24. package/dist/curves/epitrochoid7.d.cts +1 -1
  25. package/dist/curves/epitrochoid7.d.ts +1 -1
  26. package/dist/curves/epitrochoid7.js +4 -4
  27. package/dist/curves/index.cjs +28 -32
  28. package/dist/curves/index.d.cts +21 -21
  29. package/dist/curves/index.d.ts +21 -21
  30. package/dist/curves/index.js +28 -44
  31. package/dist/curves/lame.cjs +5 -6
  32. package/dist/curves/lame.d.cts +1 -1
  33. package/dist/curves/lame.d.ts +1 -1
  34. package/dist/curves/lame.js +4 -5
  35. package/dist/curves/lissajous32.cjs +4 -4
  36. package/dist/curves/lissajous32.d.cts +1 -1
  37. package/dist/curves/lissajous32.d.ts +1 -1
  38. package/dist/curves/lissajous32.js +3 -3
  39. package/dist/curves/lissajous43.cjs +4 -4
  40. package/dist/curves/lissajous43.d.cts +1 -1
  41. package/dist/curves/lissajous43.d.ts +1 -1
  42. package/dist/curves/lissajous43.js +3 -3
  43. package/dist/curves/rose3.cjs +4 -4
  44. package/dist/curves/rose3.d.cts +1 -1
  45. package/dist/curves/rose3.d.ts +1 -1
  46. package/dist/curves/rose3.js +3 -3
  47. package/dist/curves/rose5.cjs +4 -4
  48. package/dist/curves/rose5.d.cts +1 -1
  49. package/dist/curves/rose5.d.ts +1 -1
  50. package/dist/curves/rose5.js +3 -3
  51. package/dist/index.cjs +98 -90
  52. package/dist/index.cjs.map +1 -1
  53. package/dist/index.d.cts +23 -58
  54. package/dist/index.d.ts +23 -58
  55. package/dist/index.js +98 -107
  56. package/dist/index.js.map +1 -1
  57. package/dist/types-BQosOzlf.d.cts +276 -0
  58. package/dist/types-BQosOzlf.d.ts +276 -0
  59. package/package.json +1 -1
  60. package/dist/types-BW0bpL1Z.d.cts +0 -290
  61. package/dist/types-BW0bpL1Z.d.ts +0 -290
package/dist/auto-init.js CHANGED
@@ -61,13 +61,13 @@ function resolveCurve(curveDef) {
61
61
  period,
62
62
  speed,
63
63
  skeleton: curveDef.skeleton,
64
- skeletonFn: curveDef.skeletonFn,
64
+ skeletonFn: curveDef.skeletonFn
65
65
  };
66
66
  }
67
67
  function createEngine(curveDef, trailLength = 120) {
68
68
  if (!Number.isFinite(trailLength) || trailLength <= 0) {
69
69
  throw new RangeError(
70
- `[sarmal] trailLength must be a positive finite number, got ${trailLength}`,
70
+ `[sarmal] trailLength must be a positive finite number, got ${trailLength}`
71
71
  );
72
72
  }
73
73
  let curve = resolveCurve(curveDef);
@@ -108,7 +108,7 @@ function createEngine(curveDef, trailLength = 120) {
108
108
  actualTime += deltaTime;
109
109
  if (morphCurveB !== null && _morphAlpha !== null) {
110
110
  const a = curve.fn(t, actualTime, EMPTY_PARAMS);
111
- const tB = _morphStrategy === "normalized" ? (t / curve.period) * morphCurveB.period : t;
111
+ const tB = _morphStrategy === "normalized" ? t / curve.period * morphCurveB.period : t;
112
112
  const b = morphCurveB.fn(tB, actualTime, EMPTY_PARAMS);
113
113
  trail.push(a.x + (b.x - a.x) * _morphAlpha, a.y + (b.y - a.y) * _morphAlpha);
114
114
  } else {
@@ -132,14 +132,14 @@ function createEngine(curveDef, trailLength = 120) {
132
132
  trail.clear();
133
133
  },
134
134
  jump(newT, { clearTrail = false } = {}) {
135
- t = ((newT % curve.period) + curve.period) % curve.period;
135
+ t = (newT % curve.period + curve.period) % curve.period;
136
136
  if (clearTrail) {
137
137
  trail.clear();
138
138
  }
139
139
  },
140
140
  seek(targetT, { wrap = false, step = curve.period / trailLength } = {}) {
141
141
  const advance = curve.speed * step;
142
- const target = ((targetT % curve.period) + curve.period) % curve.period;
142
+ const target = (targetT % curve.period + curve.period) % curve.period;
143
143
  const targetTime = target / curve.speed;
144
144
  t = target;
145
145
  actualTime = targetTime;
@@ -148,7 +148,7 @@ function createEngine(curveDef, trailLength = 120) {
148
148
  const count = wrap ? trailLength : Math.min(trailLength, pointsFromStart);
149
149
  for (let i = count - 1; i >= 0; i--) {
150
150
  const sampleT = target - i * advance;
151
- const wrappedT = ((sampleT % curve.period) + curve.period) % curve.period;
151
+ const wrappedT = (sampleT % curve.period + curve.period) % curve.period;
152
152
  const time = targetTime - i * step;
153
153
  const point = curve.fn(wrappedT, time, EMPTY_PARAMS);
154
154
  trail.push(point.x, point.y);
@@ -165,16 +165,13 @@ function createEngine(curveDef, trailLength = 120) {
165
165
  ...frozenB,
166
166
  fn: (sampleT, time, params) => {
167
167
  const a = frozenA.fn(sampleT, time, params);
168
- const tB =
169
- frozenStrategy === "normalized"
170
- ? (sampleT / frozenA.period) * frozenB.period
171
- : sampleT;
168
+ const tB = frozenStrategy === "normalized" ? sampleT / frozenA.period * frozenB.period : sampleT;
172
169
  const b = frozenB.fn(tB, time, params);
173
170
  return {
174
171
  x: a.x + (b.x - a.x) * frozenAlpha,
175
- y: a.y + (b.y - a.y) * frozenAlpha,
172
+ y: a.y + (b.y - a.y) * frozenAlpha
176
173
  };
177
- },
174
+ }
178
175
  };
179
176
  }
180
177
  _morphStrategy = strategy;
@@ -187,7 +184,7 @@ function createEngine(curveDef, trailLength = 120) {
187
184
  completeMorph() {
188
185
  if (morphCurveB !== null) {
189
186
  if (_morphStrategy === "normalized" && curve.period !== morphCurveB.period) {
190
- t = (t / curve.period) * morphCurveB.period;
187
+ t = t / curve.period * morphCurveB.period;
191
188
  }
192
189
  curve = morphCurveB;
193
190
  }
@@ -199,22 +196,19 @@ function createEngine(curveDef, trailLength = 120) {
199
196
  const points = new Array(steps);
200
197
  if (morphCurveB !== null && _morphAlpha !== null) {
201
198
  for (let i = 0; i < steps; i++) {
202
- const sampleT = (i / (steps - 1)) * curve.period;
199
+ const sampleT = i / (steps - 1) * curve.period;
203
200
  const a = sampleSkeleton(curve, sampleT);
204
- const tB =
205
- _morphStrategy === "normalized"
206
- ? (sampleT / curve.period) * morphCurveB.period
207
- : sampleT;
201
+ const tB = _morphStrategy === "normalized" ? sampleT / curve.period * morphCurveB.period : sampleT;
208
202
  const b = sampleSkeleton(morphCurveB, tB);
209
203
  points[i] = {
210
204
  x: a.x + (b.x - a.x) * _morphAlpha,
211
- y: a.y + (b.y - a.y) * _morphAlpha,
205
+ y: a.y + (b.y - a.y) * _morphAlpha
212
206
  };
213
207
  }
214
208
  return points;
215
209
  }
216
210
  for (let i = 0; i < steps; i++) {
217
- const sampleT = (i / (steps - 1)) * curve.period;
211
+ const sampleT = i / (steps - 1) * curve.period;
218
212
  points[i] = sampleSkeleton(curve, sampleT);
219
213
  }
220
214
  return points;
@@ -256,7 +250,7 @@ function createEngine(curveDef, trailLength = 120) {
256
250
  _speedTransition.reject(new Error("Speed transition cancelled"));
257
251
  _speedTransition = null;
258
252
  }
259
- },
253
+ }
260
254
  };
261
255
  }
262
256
 
@@ -319,16 +313,13 @@ function computeTrailQuad(trail, i, trailCount, toX, toY) {
319
313
  r1x: nx - n1.x * w1,
320
314
  r1y: ny - n1.y * w1,
321
315
  opacity,
322
- progress,
316
+ progress
323
317
  };
324
318
  }
325
319
  function computeBoundaries(pts, logicalWidth, logicalHeight) {
326
320
  if (pts.length === 0) return null;
327
321
  const first = pts[0];
328
- let minX = first.x,
329
- maxX = first.x,
330
- minY = first.y,
331
- maxY = first.y;
322
+ let minX = first.x, maxX = first.x, minY = first.y, maxY = first.y;
332
323
  for (const p of pts) {
333
324
  if (p.x < minX) {
334
325
  minX = p.x;
@@ -347,7 +338,7 @@ function computeBoundaries(pts, logicalWidth, logicalHeight) {
347
338
  const h = maxY - minY;
348
339
  if (w === 0 && h === 0) {
349
340
  throw new Error(
350
- "[sarmal] Degenerate curve: all skeleton points are identical. Check that your curve fn returns distinct points for different values of t.",
341
+ "[sarmal] Degenerate curve: all skeleton points are identical. Check that your curve fn returns distinct points for different values of t."
351
342
  );
352
343
  }
353
344
  const scaleXProportional = logicalWidth / (w * (1 + FIT_PADDING * 2));
@@ -358,12 +349,12 @@ function computeBoundaries(pts, logicalWidth, logicalHeight) {
358
349
  scaleXProportional,
359
350
  scaleYProportional,
360
351
  scaleXMinPadding,
361
- scaleYMinPadding,
352
+ scaleYMinPadding
362
353
  );
363
354
  return {
364
355
  scale,
365
356
  offsetX: (logicalWidth - w * scale) / 2 - minX * scale,
366
- offsetY: (logicalHeight - h * scale) / 2 - minY * scale,
357
+ offsetY: (logicalHeight - h * scale) / 2 - minY * scale
367
358
  };
368
359
  }
369
360
  function enginePassthroughs(engine) {
@@ -373,19 +364,16 @@ function enginePassthroughs(engine) {
373
364
  setSpeed: engine.setSpeed,
374
365
  getSpeed: engine.getSpeed,
375
366
  resetSpeed: engine.resetSpeed,
376
- setSpeedOver: engine.setSpeedOver,
367
+ setSpeedOver: engine.setSpeedOver
377
368
  };
378
369
  }
379
-
380
- // src/renderer.ts
381
- var DEFAULT_SKELETON_COLOR = "#ffffff";
382
370
  var GRADIENT = {
383
371
  bard: ["#a855f7", "#3b82f6", "#14b8a6", "#ec4899"],
384
372
  sunset: ["#f97316", "#dc2626", "#9333ea", "#f472b6"],
385
373
  ocean: ["#1e3a8a", "#06b6d4", "#22d3ee", "#e0f2fe"],
386
374
  ice: ["#1e3a8a", "#67e8f9"],
387
375
  fire: ["#7f1d1d", "#fbbf24"],
388
- forest: ["#14532d", "#86efac"],
376
+ forest: ["#14532d", "#86efac"]
389
377
  };
390
378
  var PRESETS = {
391
379
  bard: GRADIENT.bard,
@@ -393,20 +381,24 @@ var PRESETS = {
393
381
  ocean: GRADIENT.ocean,
394
382
  ice: GRADIENT.ice,
395
383
  fire: GRADIENT.fire,
396
- forest: GRADIENT.forest,
384
+ forest: GRADIENT.forest
397
385
  };
398
386
  function hexToRgb(hex) {
399
387
  const n = parseInt(hex.slice(1), 16);
400
- return { r: n >> 16, g: (n >> 8) & 255, b: n & 255 };
388
+ return { r: n >> 16, g: n >> 8 & 255, b: n & 255 };
401
389
  }
402
390
  var lerpRgb = (a, b, t) => ({
403
391
  r: Math.round(a.r + (b.r - a.r) * t),
404
392
  g: Math.round(a.g + (b.g - a.g) * t),
405
- b: Math.round(a.b + (b.b - a.b) * t),
393
+ b: Math.round(a.b + (b.b - a.b) * t)
406
394
  });
407
395
  function getPaletteColor(palette, position, timeOffset = 0) {
408
- if (palette.length === 0) return { r: 255, g: 255, b: 255 };
409
- if (palette.length === 1) return hexToRgb(palette[0]);
396
+ if (palette.length === 0) {
397
+ return { r: 255, g: 255, b: 255 };
398
+ }
399
+ if (palette.length === 1) {
400
+ return hexToRgb(palette[0]);
401
+ }
410
402
  const cyclePos = (position + timeOffset) % 1;
411
403
  const scaled = cyclePos * palette.length;
412
404
  const idx = Math.floor(scaled);
@@ -416,13 +408,20 @@ function getPaletteColor(palette, position, timeOffset = 0) {
416
408
  return lerpRgb(c1, c2, t);
417
409
  }
418
410
  function resolvePalette(palette, trailStyle) {
419
- if (Array.isArray(palette)) return palette;
420
- if (palette && palette in PRESETS) return PRESETS[palette];
411
+ if (Array.isArray(palette)) {
412
+ return palette;
413
+ }
414
+ if (palette && palette in PRESETS) {
415
+ return PRESETS[palette];
416
+ }
421
417
  return trailStyle === "gradient-animated" ? GRADIENT.bard : GRADIENT.ice;
422
418
  }
419
+
420
+ // src/renderer.ts
421
+ var DEFAULT_SKELETON_COLOR = "#ffffff";
423
422
  function hexToRgbComponents(hex) {
424
423
  const n = parseInt(hex.slice(1), 16);
425
- return `${n >> 16},${(n >> 8) & 255},${n & 255}`;
424
+ return `${n >> 16},${n >> 8 & 255},${n & 255}`;
426
425
  }
427
426
  function applyDprSizing(target, logicalWidth, logicalHeight, dpr) {
428
427
  target.style.width = `${logicalWidth}px`;
@@ -450,7 +449,7 @@ function createRenderer(options) {
450
449
  const opts = {
451
450
  skeletonColor: options.skeletonColor ?? DEFAULT_SKELETON_COLOR,
452
451
  trailColor,
453
- headColor: options.headColor ?? defaultHeadColor(),
452
+ headColor: options.headColor ?? defaultHeadColor()
454
453
  };
455
454
  const trailRgb = hexToRgbComponents(opts.trailColor);
456
455
  const dpr = typeof window !== "undefined" ? window.devicePixelRatio || 1 : 1;
@@ -551,7 +550,7 @@ function createRenderer(options) {
551
550
  i,
552
551
  trailCount,
553
552
  toX,
554
- toY,
553
+ toY
555
554
  );
556
555
  if (trailStyle === "default") {
557
556
  ctx.fillStyle = `rgba(${trailRgb},${opacity})`;
@@ -575,8 +574,7 @@ function createRenderer(options) {
575
574
  }
576
575
  const x = head.x * scale + offsetX;
577
576
  const y = head.y * scale + offsetY;
578
- const r =
579
- options.headRadius ?? Math.max(2, 3 * Math.sqrt(Math.min(logicalWidth, logicalHeight) / 160));
577
+ const r = options.headRadius ?? Math.max(2, 3 * Math.sqrt(Math.min(logicalWidth, logicalHeight) / 160));
580
578
  ctx.fillStyle = opts.headColor;
581
579
  ctx.beginPath();
582
580
  ctx.arc(x, y, r, 0, Math.PI * 2);
@@ -677,7 +675,7 @@ function createRenderer(options) {
677
675
  return new Promise((resolve) => {
678
676
  morphResolve = resolve;
679
677
  });
680
- },
678
+ }
681
679
  };
682
680
  if (shouldAutoStart) {
683
681
  instance.play();
@@ -688,22 +686,19 @@ function createRenderer(options) {
688
686
  // src/curves/artemis2.ts
689
687
  var TWO_PI2 = Math.PI * 2;
690
688
  function artemis2Fn(t, _time, _params) {
691
- const a = 0.35,
692
- b = 0.15,
693
- ox = 0.175;
694
- const s = Math.sin(t),
695
- c = Math.cos(t);
689
+ const a = 0.35, b = 0.15, ox = 0.175;
690
+ const s = Math.sin(t), c = Math.cos(t);
696
691
  const denom = 1 + s * s;
697
692
  return {
698
- x: (c * (1 + a * c)) / denom - ox,
699
- y: (s * c * (1 + b * c)) / denom,
693
+ x: c * (1 + a * c) / denom - ox,
694
+ y: s * c * (1 + b * c) / denom
700
695
  };
701
696
  }
702
697
  var artemis2 = {
703
698
  name: "Artemis II",
704
699
  fn: artemis2Fn,
705
700
  period: TWO_PI2,
706
- speed: 0.7,
701
+ speed: 0.7
707
702
  };
708
703
 
709
704
  // src/curves/astroid.ts
@@ -713,14 +708,14 @@ function astroidFn(t, _time, _params) {
713
708
  const s = Math.sin(t);
714
709
  return {
715
710
  x: c * c * c,
716
- y: s * s * s,
711
+ y: s * s * s
717
712
  };
718
713
  }
719
714
  var astroid = {
720
715
  name: "Astroid",
721
716
  fn: astroidFn,
722
717
  period: TWO_PI3,
723
- speed: 1.1,
718
+ speed: 1.1
724
719
  };
725
720
 
726
721
  // src/curves/deltoid.ts
@@ -728,14 +723,14 @@ var TWO_PI4 = Math.PI * 2;
728
723
  function deltoidFn(t, _time, _params) {
729
724
  return {
730
725
  x: 2 * Math.cos(t) + Math.cos(2 * t),
731
- y: 2 * Math.sin(t) - Math.sin(2 * t),
726
+ y: 2 * Math.sin(t) - Math.sin(2 * t)
732
727
  };
733
728
  }
734
729
  var deltoid = {
735
730
  name: "Deltoid",
736
731
  fn: deltoidFn,
737
732
  period: TWO_PI4,
738
- speed: 0.9,
733
+ speed: 0.9
739
734
  };
740
735
 
741
736
  // src/curves/epicycloid3.ts
@@ -743,14 +738,14 @@ var TWO_PI5 = Math.PI * 2;
743
738
  function epicycloid3Fn(t, _time, _params) {
744
739
  return {
745
740
  x: 4 * Math.cos(t) - Math.cos(4 * t),
746
- y: 4 * Math.sin(t) - Math.sin(4 * t),
741
+ y: 4 * Math.sin(t) - Math.sin(4 * t)
747
742
  };
748
743
  }
749
744
  var epicycloid3 = {
750
745
  name: "Epicycloid (n=3)",
751
746
  fn: epicycloid3Fn,
752
747
  period: TWO_PI5,
753
- speed: 0.75,
748
+ speed: 0.75
754
749
  };
755
750
 
756
751
  // src/curves/epitrochoid7.ts
@@ -759,14 +754,14 @@ function epitrochoid7Fn(t, _time, _params) {
759
754
  const d = 1 + 0.55 * Math.sin(t * 0.5);
760
755
  return {
761
756
  x: 7 * Math.cos(t) - d * Math.cos(7 * t),
762
- y: 7 * Math.sin(t) - d * Math.sin(7 * t),
757
+ y: 7 * Math.sin(t) - d * Math.sin(7 * t)
763
758
  };
764
759
  }
765
760
  function epitrochoid7SkeletonFn(t) {
766
761
  const d = 1.275;
767
762
  return {
768
763
  x: 7 * Math.cos(t) - d * Math.cos(7 * t),
769
- y: 7 * Math.sin(t) - d * Math.sin(7 * t),
764
+ y: 7 * Math.sin(t) - d * Math.sin(7 * t)
770
765
  };
771
766
  }
772
767
  var epitrochoid7 = {
@@ -774,7 +769,7 @@ var epitrochoid7 = {
774
769
  fn: epitrochoid7Fn,
775
770
  period: TWO_PI6,
776
771
  speed: 1.4,
777
- skeletonFn: epitrochoid7SkeletonFn,
772
+ skeletonFn: epitrochoid7SkeletonFn
778
773
  };
779
774
 
780
775
  // src/curves/lissajous32.ts
@@ -783,7 +778,7 @@ function lissajous32Fn(t, time, _params) {
783
778
  const phi = time * 0.45;
784
779
  return {
785
780
  x: Math.sin(3 * t + phi),
786
- y: Math.sin(2 * t),
781
+ y: Math.sin(2 * t)
787
782
  };
788
783
  }
789
784
  var lissajous32 = {
@@ -791,7 +786,7 @@ var lissajous32 = {
791
786
  fn: lissajous32Fn,
792
787
  period: TWO_PI7,
793
788
  speed: 2,
794
- skeleton: "live",
789
+ skeleton: "live"
795
790
  };
796
791
 
797
792
  // src/curves/lissajous43.ts
@@ -800,7 +795,7 @@ function lissajous43Fn(t, time, _params) {
800
795
  const phi = time * 0.38;
801
796
  return {
802
797
  x: Math.sin(4 * t + phi),
803
- y: Math.sin(3 * t),
798
+ y: Math.sin(3 * t)
804
799
  };
805
800
  }
806
801
  var lissajous43 = {
@@ -808,18 +803,17 @@ var lissajous43 = {
808
803
  fn: lissajous43Fn,
809
804
  period: TWO_PI8,
810
805
  speed: 1.8,
811
- skeleton: "live",
806
+ skeleton: "live"
812
807
  };
813
808
 
814
809
  // src/curves/lame.ts
815
810
  var TWO_PI9 = Math.PI * 2;
816
811
  function lameFn(t, time, _params) {
817
812
  const p = 1.75 + 1.25 * Math.sin(time * 0.48);
818
- const c = Math.cos(t),
819
- s = Math.sin(t);
813
+ const c = Math.cos(t), s = Math.sin(t);
820
814
  return {
821
815
  x: Math.sign(c) * Math.pow(Math.abs(c), p),
822
- y: Math.sign(s) * Math.pow(Math.abs(s), p),
816
+ y: Math.sign(s) * Math.pow(Math.abs(s), p)
823
817
  };
824
818
  }
825
819
  var lame = {
@@ -827,7 +821,7 @@ var lame = {
827
821
  fn: lameFn,
828
822
  period: TWO_PI9,
829
823
  speed: 1,
830
- skeleton: "live",
824
+ skeleton: "live"
831
825
  };
832
826
 
833
827
  // src/curves/rose3.ts
@@ -836,14 +830,14 @@ function rose3Fn(t, _time, _params) {
836
830
  const r = Math.cos(3 * t);
837
831
  return {
838
832
  x: r * Math.cos(t),
839
- y: r * Math.sin(t),
833
+ y: r * Math.sin(t)
840
834
  };
841
835
  }
842
836
  var rose3 = {
843
837
  name: "Rose (n=3)",
844
838
  fn: rose3Fn,
845
839
  period: TWO_PI10,
846
- speed: 1.15,
840
+ speed: 1.15
847
841
  };
848
842
 
849
843
  // src/curves/rose5.ts
@@ -852,14 +846,14 @@ function rose5Fn(t, _time, _params) {
852
846
  const r = Math.cos(5 * t);
853
847
  return {
854
848
  x: r * Math.cos(t),
855
- y: r * Math.sin(t),
849
+ y: r * Math.sin(t)
856
850
  };
857
851
  }
858
852
  var rose5 = {
859
853
  name: "Rose (n=5)",
860
854
  fn: rose5Fn,
861
855
  period: TWO_PI11,
862
- speed: 1,
856
+ speed: 1
863
857
  };
864
858
 
865
859
  // src/curves/index.ts
@@ -873,7 +867,7 @@ var curves = {
873
867
  lissajous32,
874
868
  lissajous43,
875
869
  epicycloid3,
876
- lame,
870
+ lame
877
871
  };
878
872
 
879
873
  // src/index.ts
@@ -890,7 +884,8 @@ function parsePalette(value) {
890
884
  if (Array.isArray(parsed)) {
891
885
  return parsed;
892
886
  }
893
- } catch {}
887
+ } catch {
888
+ }
894
889
  return value;
895
890
  }
896
891
  function init() {
@@ -905,15 +900,15 @@ function init() {
905
900
  return console.error(`[sarmal] "${curveName}" is not a valid curve name`);
906
901
  }
907
902
  createSarmal(canvas, curveDef, {
908
- ...(canvas.dataset.trailColor && { trailColor: canvas.dataset.trailColor }),
909
- ...(canvas.dataset.skeletonColor && { skeletonColor: canvas.dataset.skeletonColor }),
910
- ...(canvas.dataset.headColor && { headColor: canvas.dataset.headColor }),
911
- ...(canvas.dataset.headRadius && { headRadius: parseFloat(canvas.dataset.headRadius) }),
912
- ...(canvas.dataset.trailLength && { trailLength: parseInt(canvas.dataset.trailLength, 10) }),
913
- ...(canvas.dataset.trailStyle && {
914
- trailStyle: canvas.dataset.trailStyle,
915
- }),
916
- ...(canvas.dataset.palette && { palette: parsePalette(canvas.dataset.palette) }),
903
+ ...canvas.dataset.trailColor && { trailColor: canvas.dataset.trailColor },
904
+ ...canvas.dataset.skeletonColor && { skeletonColor: canvas.dataset.skeletonColor },
905
+ ...canvas.dataset.headColor && { headColor: canvas.dataset.headColor },
906
+ ...canvas.dataset.headRadius && { headRadius: parseFloat(canvas.dataset.headRadius) },
907
+ ...canvas.dataset.trailLength && { trailLength: parseInt(canvas.dataset.trailLength, 10) },
908
+ ...canvas.dataset.trailStyle && {
909
+ trailStyle: canvas.dataset.trailStyle
910
+ },
911
+ ...canvas.dataset.palette && { palette: parsePalette(canvas.dataset.palette) }
917
912
  });
918
913
  });
919
914
  }
@@ -925,4 +920,4 @@ if (document.readyState === "loading") {
925
920
  requestAnimationFrame(init);
926
921
  }
927
922
  //# sourceMappingURL=auto-init.js.map
928
- //# sourceMappingURL=auto-init.js.map
923
+ //# sourceMappingURL=auto-init.js.map