asciify-engine 1.0.26 → 1.0.28

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/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  type ColorMode = 'grayscale' | 'fullcolor' | 'matrix' | 'accent';
2
2
  type RenderMode = 'ascii' | 'dots';
3
3
  type AnimationStyle = 'none' | 'wave' | 'pulse' | 'rain' | 'breathe' | 'sparkle' | 'glitch' | 'spiral' | 'typewriter' | 'scatter' | 'waveField' | 'ripple' | 'melt' | 'orbit' | 'cellular';
4
- type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji';
4
+ type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji' | 'circles';
5
5
  type HoverEffect = 'spotlight' | 'magnify' | 'repel' | 'glow' | 'colorShift' | 'attract' | 'shatter' | 'trail';
6
6
  type HoverPreset = 'none' | 'subtle' | 'flashlight' | 'magnifier' | 'forceField' | 'neon' | 'fire' | 'ice' | 'gravity' | 'shatter' | 'ghost';
7
7
  /**
@@ -66,6 +66,7 @@ declare const CHARSETS: {
66
66
  readonly katakana: " ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン";
67
67
  readonly musical: " ♩♪♫♬♭♮♯";
68
68
  readonly emoji: " ⬛🟫🟥🟧🟨🟩🟦🟪⬜";
69
+ readonly circles: " .·:∘○◦°•∙";
69
70
  };
70
71
  type CharsetKey = keyof typeof CHARSETS;
71
72
  /**
@@ -592,6 +593,124 @@ declare function asciiText(source: HTMLImageElement | HTMLVideoElement | HTMLCan
592
593
  */
593
594
  declare function asciiTextAnsi(source: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement, options?: Partial<AsciiOptions>, targetWidth?: number, targetHeight?: number): string;
594
595
 
596
+ /**
597
+ * text-frame.ts — Build and render ASCII frames from tiling text patterns.
598
+ *
599
+ * Enables interactive text backgrounds with the full hover-effect system
600
+ * (spotlight, magnify, repel, glow, colorShift, …) without needing an image
601
+ * source.
602
+ *
603
+ * @example — basic usage
604
+ * ```ts
605
+ * import { renderTextBackground } from 'asciify-engine';
606
+ *
607
+ * function tick(ctx, w, h, mousePos) {
608
+ * renderTextBackground(ctx, w, h, 'asciify·engine·v1·', {
609
+ * hoverEffect: 'spotlight',
610
+ * hoverColor: '#d4ff00',
611
+ * }, mousePos);
612
+ * requestAnimationFrame(() => tick(ctx, w, h, mousePos));
613
+ * }
614
+ * ```
615
+ *
616
+ * @example — build the frame yourself and pass it to renderFrameToCanvas
617
+ * ```ts
618
+ * import { buildTextFrame, renderFrameToCanvas, DEFAULT_OPTIONS } from 'asciify-engine';
619
+ *
620
+ * const frame = buildTextFrame('hello world · ', 80, 24);
621
+ * renderFrameToCanvas(ctx, frame, {
622
+ * ...DEFAULT_OPTIONS,
623
+ * hoverEffect: 'repel',
624
+ * hoverStrength: 0.9,
625
+ * hoverColor: '#a0e8ff',
626
+ * }, width, height, 0, mousePos);
627
+ * ```
628
+ */
629
+
630
+ interface TextBackgroundOptions {
631
+ /**
632
+ * Character size in pixels.
633
+ * Controls the grid density: smaller → more cells, finer text.
634
+ * @default 10
635
+ */
636
+ fontSize?: number;
637
+ /**
638
+ * Line-height multiplier applied on top of `fontSize` to derive row height.
639
+ * Matches the default monospace aspect ratio used by the renderer.
640
+ * @default 1.6
641
+ */
642
+ lineHeight?: number;
643
+ /**
644
+ * Base colour for the text cells (inactive state).
645
+ * Accepts any CSS hex or rgb string.
646
+ * @default '#505050'
647
+ */
648
+ color?: string;
649
+ /**
650
+ * Base alpha for the text cells, 0–255.
651
+ * @default 100
652
+ */
653
+ opacity?: number;
654
+ /**
655
+ * Which hover effect to activate when `hoverPos` is supplied.
656
+ * @default 'spotlight'
657
+ */
658
+ hoverEffect?: HoverEffect;
659
+ /**
660
+ * Intensity of the hover distortion / glow, 0–1.
661
+ * @default 0.85
662
+ */
663
+ hoverStrength?: number;
664
+ /**
665
+ * Normalised radius of the hover influence zone, 0–1.
666
+ * @default 0.18
667
+ */
668
+ hoverRadius?: number;
669
+ /**
670
+ * Accent colour applied by the hover effect.
671
+ * @default '#d4ff00'
672
+ */
673
+ hoverColor?: string;
674
+ }
675
+ /**
676
+ * Build an `AsciiFrame` filled with a tiling text pattern.
677
+ *
678
+ * The `text` string is repeated (wrapping at column boundaries) across every
679
+ * cell of the `cols × rows` grid. Each cell carries the supplied base colour
680
+ * and opacity as `{r, g, b, a}` values.
681
+ *
682
+ * The returned frame can be passed directly to `renderFrameToCanvas` with any
683
+ * `AsciiOptions` including hover effects.
684
+ *
685
+ * @param text - Pattern string to tile across the grid (e.g. `'hello · '`)
686
+ * @param cols - Number of character columns
687
+ * @param rows - Number of character rows
688
+ * @param color - Base RGB colour string for the cells (default: `'#505050'`)
689
+ * @param opacity - Base alpha 0–255 (default: `100`)
690
+ */
691
+ declare function buildTextFrame(text: string, cols: number, rows: number, color?: string, opacity?: number): AsciiFrame;
692
+ /**
693
+ * All-in-one: build a tiling text grid and render it to a canvas with the
694
+ * full hover-effect system (spotlight, magnify, repel, glow, colorShift, …).
695
+ *
696
+ * Call this inside a `requestAnimationFrame` loop, passing updated `hoverPos`
697
+ * each frame to get smooth interactive effects.
698
+ *
699
+ * @param ctx - 2D rendering context of the target canvas
700
+ * @param width - Canvas logical width in pixels
701
+ * @param height - Canvas logical height in pixels
702
+ * @param text - Pattern string to tile (e.g. `'asciify·engine·v1·'`)
703
+ * @param options - {@link TextBackgroundOptions}
704
+ * @param hoverPos - Normalised mouse position `{x, y}` in 0–1 range,
705
+ * optionally with an `intensity` multiplier (0–1).
706
+ * Pass `null` or omit to render without hover.
707
+ */
708
+ declare function renderTextBackground(ctx: CanvasRenderingContext2D, width: number, height: number, text: string, options?: TextBackgroundOptions, hoverPos?: {
709
+ x: number;
710
+ y: number;
711
+ intensity?: number;
712
+ } | null): void;
713
+
595
714
  /**
596
715
  * record() — capture a rolling frame buffer from a running ASCII canvas
597
716
  * and export it as a downloadable animated GIF or WebP data URL.
@@ -671,4 +790,4 @@ interface WebGLRenderer {
671
790
  */
672
791
  declare function tryCreateWebGLRenderer(canvas: HTMLCanvasElement): WebGLRenderer | null;
673
792
 
674
- export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
793
+ export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, buildTextFrame, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  type ColorMode = 'grayscale' | 'fullcolor' | 'matrix' | 'accent';
2
2
  type RenderMode = 'ascii' | 'dots';
3
3
  type AnimationStyle = 'none' | 'wave' | 'pulse' | 'rain' | 'breathe' | 'sparkle' | 'glitch' | 'spiral' | 'typewriter' | 'scatter' | 'waveField' | 'ripple' | 'melt' | 'orbit' | 'cellular';
4
- type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji';
4
+ type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji' | 'circles';
5
5
  type HoverEffect = 'spotlight' | 'magnify' | 'repel' | 'glow' | 'colorShift' | 'attract' | 'shatter' | 'trail';
6
6
  type HoverPreset = 'none' | 'subtle' | 'flashlight' | 'magnifier' | 'forceField' | 'neon' | 'fire' | 'ice' | 'gravity' | 'shatter' | 'ghost';
7
7
  /**
@@ -66,6 +66,7 @@ declare const CHARSETS: {
66
66
  readonly katakana: " ヲァィゥェォャュョッアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン";
67
67
  readonly musical: " ♩♪♫♬♭♮♯";
68
68
  readonly emoji: " ⬛🟫🟥🟧🟨🟩🟦🟪⬜";
69
+ readonly circles: " .·:∘○◦°•∙";
69
70
  };
70
71
  type CharsetKey = keyof typeof CHARSETS;
71
72
  /**
@@ -592,6 +593,124 @@ declare function asciiText(source: HTMLImageElement | HTMLVideoElement | HTMLCan
592
593
  */
593
594
  declare function asciiTextAnsi(source: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement, options?: Partial<AsciiOptions>, targetWidth?: number, targetHeight?: number): string;
594
595
 
596
+ /**
597
+ * text-frame.ts — Build and render ASCII frames from tiling text patterns.
598
+ *
599
+ * Enables interactive text backgrounds with the full hover-effect system
600
+ * (spotlight, magnify, repel, glow, colorShift, …) without needing an image
601
+ * source.
602
+ *
603
+ * @example — basic usage
604
+ * ```ts
605
+ * import { renderTextBackground } from 'asciify-engine';
606
+ *
607
+ * function tick(ctx, w, h, mousePos) {
608
+ * renderTextBackground(ctx, w, h, 'asciify·engine·v1·', {
609
+ * hoverEffect: 'spotlight',
610
+ * hoverColor: '#d4ff00',
611
+ * }, mousePos);
612
+ * requestAnimationFrame(() => tick(ctx, w, h, mousePos));
613
+ * }
614
+ * ```
615
+ *
616
+ * @example — build the frame yourself and pass it to renderFrameToCanvas
617
+ * ```ts
618
+ * import { buildTextFrame, renderFrameToCanvas, DEFAULT_OPTIONS } from 'asciify-engine';
619
+ *
620
+ * const frame = buildTextFrame('hello world · ', 80, 24);
621
+ * renderFrameToCanvas(ctx, frame, {
622
+ * ...DEFAULT_OPTIONS,
623
+ * hoverEffect: 'repel',
624
+ * hoverStrength: 0.9,
625
+ * hoverColor: '#a0e8ff',
626
+ * }, width, height, 0, mousePos);
627
+ * ```
628
+ */
629
+
630
+ interface TextBackgroundOptions {
631
+ /**
632
+ * Character size in pixels.
633
+ * Controls the grid density: smaller → more cells, finer text.
634
+ * @default 10
635
+ */
636
+ fontSize?: number;
637
+ /**
638
+ * Line-height multiplier applied on top of `fontSize` to derive row height.
639
+ * Matches the default monospace aspect ratio used by the renderer.
640
+ * @default 1.6
641
+ */
642
+ lineHeight?: number;
643
+ /**
644
+ * Base colour for the text cells (inactive state).
645
+ * Accepts any CSS hex or rgb string.
646
+ * @default '#505050'
647
+ */
648
+ color?: string;
649
+ /**
650
+ * Base alpha for the text cells, 0–255.
651
+ * @default 100
652
+ */
653
+ opacity?: number;
654
+ /**
655
+ * Which hover effect to activate when `hoverPos` is supplied.
656
+ * @default 'spotlight'
657
+ */
658
+ hoverEffect?: HoverEffect;
659
+ /**
660
+ * Intensity of the hover distortion / glow, 0–1.
661
+ * @default 0.85
662
+ */
663
+ hoverStrength?: number;
664
+ /**
665
+ * Normalised radius of the hover influence zone, 0–1.
666
+ * @default 0.18
667
+ */
668
+ hoverRadius?: number;
669
+ /**
670
+ * Accent colour applied by the hover effect.
671
+ * @default '#d4ff00'
672
+ */
673
+ hoverColor?: string;
674
+ }
675
+ /**
676
+ * Build an `AsciiFrame` filled with a tiling text pattern.
677
+ *
678
+ * The `text` string is repeated (wrapping at column boundaries) across every
679
+ * cell of the `cols × rows` grid. Each cell carries the supplied base colour
680
+ * and opacity as `{r, g, b, a}` values.
681
+ *
682
+ * The returned frame can be passed directly to `renderFrameToCanvas` with any
683
+ * `AsciiOptions` including hover effects.
684
+ *
685
+ * @param text - Pattern string to tile across the grid (e.g. `'hello · '`)
686
+ * @param cols - Number of character columns
687
+ * @param rows - Number of character rows
688
+ * @param color - Base RGB colour string for the cells (default: `'#505050'`)
689
+ * @param opacity - Base alpha 0–255 (default: `100`)
690
+ */
691
+ declare function buildTextFrame(text: string, cols: number, rows: number, color?: string, opacity?: number): AsciiFrame;
692
+ /**
693
+ * All-in-one: build a tiling text grid and render it to a canvas with the
694
+ * full hover-effect system (spotlight, magnify, repel, glow, colorShift, …).
695
+ *
696
+ * Call this inside a `requestAnimationFrame` loop, passing updated `hoverPos`
697
+ * each frame to get smooth interactive effects.
698
+ *
699
+ * @param ctx - 2D rendering context of the target canvas
700
+ * @param width - Canvas logical width in pixels
701
+ * @param height - Canvas logical height in pixels
702
+ * @param text - Pattern string to tile (e.g. `'asciify·engine·v1·'`)
703
+ * @param options - {@link TextBackgroundOptions}
704
+ * @param hoverPos - Normalised mouse position `{x, y}` in 0–1 range,
705
+ * optionally with an `intensity` multiplier (0–1).
706
+ * Pass `null` or omit to render without hover.
707
+ */
708
+ declare function renderTextBackground(ctx: CanvasRenderingContext2D, width: number, height: number, text: string, options?: TextBackgroundOptions, hoverPos?: {
709
+ x: number;
710
+ y: number;
711
+ intensity?: number;
712
+ } | null): void;
713
+
595
714
  /**
596
715
  * record() — capture a rolling frame buffer from a running ASCII canvas
597
716
  * and export it as a downloadable animated GIF or WebP data URL.
@@ -671,4 +790,4 @@ interface WebGLRenderer {
671
790
  */
672
791
  declare function tryCreateWebGLRenderer(canvas: HTMLCanvasElement): WebGLRenderer | null;
673
792
 
674
- export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
793
+ export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifySimpleOptions, type AuroraBackgroundOptions, CHARSETS, type CharsetKey, type CircuitBackgroundOptions, type ColorMode, DEFAULT_OPTIONS, type DnaBackgroundOptions, type FireBackgroundOptions, type GridBackgroundOptions, HOVER_PRESETS, type HoverEffect, type HoverPreset, type MorphBackgroundOptions, type MountWaveOptions, type NoiseBackgroundOptions, PALETTE_THEMES, type PaletteTheme, type PulseBackgroundOptions, type RainBackgroundOptions, type Recorder, type RecorderOptions, type RenderMode, type SilkBackgroundOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebGLRenderer, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, buildTextFrame, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
package/dist/index.js CHANGED
@@ -23,7 +23,8 @@ var CHARSETS = {
23
23
  braille: " \u2801\u2802\u2803\u2804\u2805\u2806\u2807\u2808\u2809\u280A\u280B\u280C\u280D\u280E\u280F\u2810\u2811\u2812\u2813\u2814\u2815\u2816\u2817\u2818\u2819\u281A\u281B\u281C\u281D\u281E\u281F\u2820\u2821\u2822\u2823\u2824\u2825\u2826\u2827\u2828\u2829\u282A\u282B\u282C\u282D\u282E\u282F\u2830\u2831\u2832\u2833\u2834\u2835\u2836\u2837\u2838\u2839\u283A\u283B\u283C\u283D\u283E\u283F\u2840\u2841\u2842\u2843\u2844\u2845\u2846\u2847\u28C0\u28C1\u28C2\u28C3\u28C4\u28C5\u28C6\u28C7\u28C8\u28C9\u28CA\u28CB\u28CC\u28CD\u28CE\u28CF\u28D0\u28D1\u28D2\u28D3\u28D4\u28D5\u28D6\u28D7\u28D8\u28D9\u28DA\u28DB\u28DC\u28DD\u28DE\u28DF\u28E0\u28E1\u28E2\u28E3\u28E4\u28E5\u28E6\u28E7\u28E8\u28E9\u28EA\u28EB\u28EC\u28ED\u28EE\u28EF\u28F0\u28F1\u28F2\u28F3\u28F4\u28F5\u28F6\u28F7\u28F8\u28F9\u28FA\u28FB\u28FC\u28FD\u28FE\u28FF",
24
24
  katakana: " \uFF66\uFF67\uFF68\uFF69\uFF6A\uFF6B\uFF6C\uFF6D\uFF6E\uFF6F\uFF71\uFF72\uFF73\uFF74\uFF75\uFF76\uFF77\uFF78\uFF79\uFF7A\uFF7B\uFF7C\uFF7D\uFF7E\uFF7F\uFF80\uFF81\uFF82\uFF83\uFF84\uFF85\uFF86\uFF87\uFF88\uFF89\uFF8A\uFF8B\uFF8C\uFF8D\uFF8E\uFF8F\uFF90\uFF91\uFF92\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98\uFF99\uFF9A\uFF9B\uFF9C\uFF9D",
25
25
  musical: " \u2669\u266A\u266B\u266C\u266D\u266E\u266F",
26
- emoji: " \u2B1B\u{1F7EB}\u{1F7E5}\u{1F7E7}\u{1F7E8}\u{1F7E9}\u{1F7E6}\u{1F7EA}\u2B1C"
26
+ emoji: " \u2B1B\u{1F7EB}\u{1F7E5}\u{1F7E7}\u{1F7E8}\u{1F7E9}\u{1F7E6}\u{1F7EA}\u2B1C",
27
+ circles: " .\xB7:\u2218\u25CB\u25E6\xB0\u2022\u2219"
27
28
  };
28
29
  var ART_STYLE_PRESETS = {
29
30
  classic: {
@@ -87,6 +88,12 @@ var ART_STYLE_PRESETS = {
87
88
  renderMode: "ascii",
88
89
  charset: CHARSETS.emoji,
89
90
  colorMode: "fullcolor"
91
+ },
92
+ circles: {
93
+ renderMode: "ascii",
94
+ charset: CHARSETS.circles,
95
+ colorMode: "accent",
96
+ accentColor: "#d4ff00"
90
97
  }
91
98
  };
92
99
  var DEFAULT_OPTIONS = {
@@ -2234,6 +2241,47 @@ function asciiTextAnsi(source, options = {}, targetWidth, targetHeight) {
2234
2241
  return lines.join("\n");
2235
2242
  }
2236
2243
 
2244
+ // src/core/text-frame.ts
2245
+ function buildTextFrame(text, cols, rows, color = "#505050", opacity = 100) {
2246
+ if (!text || cols <= 0 || rows <= 0) return [];
2247
+ const parsed = parseColor(color) ?? { r: 80, g: 80, b: 80 };
2248
+ const pattern = text;
2249
+ const len = pattern.length;
2250
+ return Array.from(
2251
+ { length: rows },
2252
+ (_, row) => Array.from({ length: cols }, (_2, col) => ({
2253
+ char: pattern[(row * cols + col) % len],
2254
+ r: parsed.r,
2255
+ g: parsed.g,
2256
+ b: parsed.b,
2257
+ a: opacity
2258
+ }))
2259
+ );
2260
+ }
2261
+ function renderTextBackground(ctx, width, height, text, options = {}, hoverPos) {
2262
+ const {
2263
+ fontSize = 10,
2264
+ lineHeight = 1.6,
2265
+ color = "#505050",
2266
+ opacity = 100,
2267
+ hoverEffect = "spotlight",
2268
+ hoverStrength = 0.85,
2269
+ hoverRadius = 0.18,
2270
+ hoverColor = "#d4ff00"
2271
+ } = options;
2272
+ const cols = Math.max(1, Math.floor(width / fontSize));
2273
+ const rows = Math.max(1, Math.floor(height / (fontSize * lineHeight)));
2274
+ const frame = buildTextFrame(text, cols, rows, color, opacity);
2275
+ const renderOpts = {
2276
+ ...DEFAULT_OPTIONS,
2277
+ hoverEffect,
2278
+ hoverStrength,
2279
+ hoverRadius,
2280
+ hoverColor
2281
+ };
2282
+ renderFrameToCanvas(ctx, frame, renderOpts, width, height, 0, hoverPos ?? null);
2283
+ }
2284
+
2237
2285
  // src/core/record.ts
2238
2286
  function createRecorder(canvas, options = {}) {
2239
2287
  const {
@@ -2823,6 +2871,6 @@ function tryCreateWebGLRenderer(canvas) {
2823
2871
  }
2824
2872
  }
2825
2873
 
2826
- export { ART_STYLE_PRESETS, CHARSETS, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
2874
+ export { ART_STYLE_PRESETS, CHARSETS, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyVideo, buildTextFrame, createRecorder, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, recordAndDownload, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, tryCreateWebGLRenderer, videoToAsciiFrames };
2827
2875
  //# sourceMappingURL=index.js.map
2828
2876
  //# sourceMappingURL=index.js.map