@sarmal/core 0.17.1 → 0.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-init.cjs +1 -1
- package/dist/auto-init.cjs.map +1 -1
- package/dist/auto-init.js +1 -1
- package/dist/auto-init.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -49,8 +49,6 @@ declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
|
|
|
49
49
|
*/
|
|
50
50
|
declare function createSarmalSVG(container: Element, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
|
|
51
51
|
|
|
52
|
-
declare function createEngine(curveDef: CurveDef, trailLength?: number): Engine;
|
|
53
|
-
|
|
54
52
|
/**
|
|
55
53
|
* Can be passed directly to `trailColor`,
|
|
56
54
|
* or can be mixed/sliced before passing as a prop.
|
|
@@ -63,6 +61,9 @@ declare const palettes: {
|
|
|
63
61
|
readonly fire: ["#7f1d1d", "#fbbf24"];
|
|
64
62
|
readonly forest: ["#14532d", "#86efac"];
|
|
65
63
|
};
|
|
64
|
+
type SarmalPalette = keyof typeof palettes;
|
|
65
|
+
|
|
66
|
+
declare function createEngine(curveDef: CurveDef, trailLength?: number): Engine;
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* Creates a Canvas 2D renderer for sarmal animations
|
|
@@ -86,4 +87,4 @@ declare function createRenderer(options: RendererOptions): SarmalInstance;
|
|
|
86
87
|
*/
|
|
87
88
|
declare function createSarmal(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
|
|
88
89
|
|
|
89
|
-
export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
|
|
90
|
+
export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,8 +49,6 @@ declare function createSVGRenderer(options: SVGRendererOptions): SarmalInstance;
|
|
|
49
49
|
*/
|
|
50
50
|
declare function createSarmalSVG(container: Element, curveDef: CurveDef, options?: SVGSarmalOptions): SarmalInstance;
|
|
51
51
|
|
|
52
|
-
declare function createEngine(curveDef: CurveDef, trailLength?: number): Engine;
|
|
53
|
-
|
|
54
52
|
/**
|
|
55
53
|
* Can be passed directly to `trailColor`,
|
|
56
54
|
* or can be mixed/sliced before passing as a prop.
|
|
@@ -63,6 +61,9 @@ declare const palettes: {
|
|
|
63
61
|
readonly fire: ["#7f1d1d", "#fbbf24"];
|
|
64
62
|
readonly forest: ["#14532d", "#86efac"];
|
|
65
63
|
};
|
|
64
|
+
type SarmalPalette = keyof typeof palettes;
|
|
65
|
+
|
|
66
|
+
declare function createEngine(curveDef: CurveDef, trailLength?: number): Engine;
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* Creates a Canvas 2D renderer for sarmal animations
|
|
@@ -86,4 +87,4 @@ declare function createRenderer(options: RendererOptions): SarmalInstance;
|
|
|
86
87
|
*/
|
|
87
88
|
declare function createSarmal(canvas: HTMLCanvasElement, curveDef: CurveDef, options?: SarmalOptions): SarmalInstance;
|
|
88
89
|
|
|
89
|
-
export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
|
|
90
|
+
export { BaseRendererOptions, CurveDef, Engine, RendererOptions, type SVGRendererOptions, type SVGSarmalOptions, SarmalInstance, SarmalOptions, type SarmalPalette, createEngine, createRenderer, createSVGRenderer, createSarmal, createSarmalSVG, palettes };
|
package/dist/index.js
CHANGED
|
@@ -391,7 +391,7 @@ function getPaletteColor(palette, position, timeOffset = 0) {
|
|
|
391
391
|
if (palette.length === 1) {
|
|
392
392
|
return hexToRgb(palette[0]);
|
|
393
393
|
}
|
|
394
|
-
const cyclePos = (position + timeOffset) % 1;
|
|
394
|
+
const cyclePos = ((position + timeOffset) % 1 + 1) % 1;
|
|
395
395
|
const scaled = cyclePos * palette.length;
|
|
396
396
|
const idx = Math.floor(scaled);
|
|
397
397
|
const t = scaled - idx;
|