asciify-engine 1.0.54 → 1.0.56
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/README.md +5 -5
- package/dist/index.cjs +76 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -2
- package/dist/index.d.ts +52 -2
- package/dist/index.js +76 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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' | 'circles';
|
|
4
|
+
type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji' | 'circles' | 'shadows' | 'starfield' | 'geometric' | 'pipes' | 'waves' | 'shards' | 'smoke';
|
|
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
|
/**
|
|
@@ -174,6 +174,20 @@ interface AsciiOptions {
|
|
|
174
174
|
* Higher values remove more pixels. Default: `60`
|
|
175
175
|
*/
|
|
176
176
|
chromaKeyTolerance: number;
|
|
177
|
+
/**
|
|
178
|
+
* Array of charset strings to cycle through over time.
|
|
179
|
+
* The engine picks `charsetFrames[Math.floor(time * charsetFps) % length]` on each
|
|
180
|
+
* render tick, re-mapping characters from stored cell luminance.
|
|
181
|
+
* Pairs beautifully with `animationStyle` and `asciiBackground`.
|
|
182
|
+
*
|
|
183
|
+
* Use `CHARSET_SEQUENCES` for curated combinations or build your own:
|
|
184
|
+
* @example
|
|
185
|
+
* options: { charsetFrames: CHARSET_SEQUENCES.cosmic }
|
|
186
|
+
* options: { charsetFrames: [CHARSETS.standard, CHARSETS.blocks, CHARSETS.circles] }
|
|
187
|
+
*/
|
|
188
|
+
charsetFrames?: string[];
|
|
189
|
+
/** Cycle rate for `charsetFrames` in frames-per-second. Default: `2` */
|
|
190
|
+
charsetFps?: number;
|
|
177
191
|
}
|
|
178
192
|
interface AsciiCell {
|
|
179
193
|
char: string;
|
|
@@ -181,6 +195,8 @@ interface AsciiCell {
|
|
|
181
195
|
g: number;
|
|
182
196
|
b: number;
|
|
183
197
|
a: number;
|
|
198
|
+
/** Stored dithered luminance (0–255). Present when the frame was generated by the engine. Used for dynamic charset re-selection at render time via `charsetFrames`. */
|
|
199
|
+
lum?: number;
|
|
184
200
|
}
|
|
185
201
|
type AsciiFrame = AsciiCell[][];
|
|
186
202
|
interface AsciiResult {
|
|
@@ -205,7 +221,41 @@ declare const CHARSETS: {
|
|
|
205
221
|
readonly musical: " ♩♪♫♬♭♮♯";
|
|
206
222
|
readonly emoji: " ⬛🟫🟥🟧🟨🟩🟦🟪⬜";
|
|
207
223
|
readonly circles: " .·:∘○◦°•∙";
|
|
224
|
+
readonly shadows: " ·∘◦○◎⊙●◉";
|
|
225
|
+
readonly starfield: " ˙·∘∗✦✧★◆●";
|
|
226
|
+
readonly geometric: " ·△▷◇◈◆▣■█";
|
|
227
|
+
readonly pipes: " ╶─┐└├┤┬┴┼╬▒▓█";
|
|
228
|
+
readonly waves: " ˜∼≈〰≋∿∾∭∫";
|
|
229
|
+
readonly shards: " ╱╲╳◤◥◣◢△▲◆◼█";
|
|
230
|
+
readonly smoke: " ·˙⁚⁖∶∷⋮⋰⋱∴∵";
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Curated charset sequences for use with `charsetFrames`.
|
|
234
|
+
* Each sequence morphs between 2–3 complementary charsets over time,
|
|
235
|
+
* creating a living texture effect.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* asciiBackground('#hero', { charsetFrames: CHARSET_SEQUENCES.cosmic })
|
|
239
|
+
*/
|
|
240
|
+
declare const CHARSET_SEQUENCES: {
|
|
241
|
+
/** Stars → softcircles → orbs — dreamy space feel */
|
|
242
|
+
readonly cosmic: string[];
|
|
243
|
+
/** Katakana → braille dots → binary — hacker rain */
|
|
244
|
+
readonly rain: string[];
|
|
245
|
+
/** Box pipes → Claude glyphs → classic — terminal morph */
|
|
246
|
+
readonly terminal: string[];
|
|
247
|
+
/** Shards → blocks → squares — shattering crystal */
|
|
248
|
+
readonly crystal: string[];
|
|
249
|
+
/** Wave glyphs → smoke dots → circles — fluid / organic */
|
|
250
|
+
readonly fluid: string[];
|
|
251
|
+
/** Dense classic → art → blocks — maximum detail pulse */
|
|
252
|
+
readonly pulse: string[];
|
|
253
|
+
/** Braille → shadows → smoke — ethereal / dream-like */
|
|
254
|
+
readonly dream: string[];
|
|
255
|
+
/** Geometric shapes → shards → starfield — sci-fi angular */
|
|
256
|
+
readonly angular: string[];
|
|
208
257
|
};
|
|
258
|
+
type CharsetSequenceKey = keyof typeof CHARSET_SEQUENCES;
|
|
209
259
|
type CharsetKey = keyof typeof CHARSETS;
|
|
210
260
|
/**
|
|
211
261
|
* Art Style presets — each one sets render mode, charset, color mode, etc.
|
|
@@ -1032,4 +1082,4 @@ interface WebcamOptions {
|
|
|
1032
1082
|
*/
|
|
1033
1083
|
declare function asciifyWebcam(canvas: HTMLCanvasElement, { fontSize, style, options, liveOptions, mirror, constraints, dpr: dprOverride, }?: WebcamOptions): Promise<() => void>;
|
|
1034
1084
|
|
|
1035
|
-
export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifyLiveVideoOptions, type AsciifySimpleOptions, type AsciifyVideoOptions, type AuroraBackgroundOptions, BACKGROUND_TYPES, type BackgroundType, 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 RenderMode, type SilkBackgroundOptions, type SnapshotOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebcamOptions, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, videoToAsciiFrames };
|
|
1085
|
+
export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifyLiveVideoOptions, type AsciifySimpleOptions, type AsciifyVideoOptions, type AuroraBackgroundOptions, BACKGROUND_TYPES, type BackgroundType, CHARSETS, CHARSET_SEQUENCES, type CharsetKey, type CharsetSequenceKey, 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 RenderMode, type SilkBackgroundOptions, type SnapshotOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebcamOptions, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, 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' | 'circles';
|
|
4
|
+
type ArtStyle = 'classic' | 'particles' | 'letters' | 'claudeCode' | 'art' | 'terminal' | 'box' | 'lines' | 'braille' | 'katakana' | 'musical' | 'emoji' | 'circles' | 'shadows' | 'starfield' | 'geometric' | 'pipes' | 'waves' | 'shards' | 'smoke';
|
|
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
|
/**
|
|
@@ -174,6 +174,20 @@ interface AsciiOptions {
|
|
|
174
174
|
* Higher values remove more pixels. Default: `60`
|
|
175
175
|
*/
|
|
176
176
|
chromaKeyTolerance: number;
|
|
177
|
+
/**
|
|
178
|
+
* Array of charset strings to cycle through over time.
|
|
179
|
+
* The engine picks `charsetFrames[Math.floor(time * charsetFps) % length]` on each
|
|
180
|
+
* render tick, re-mapping characters from stored cell luminance.
|
|
181
|
+
* Pairs beautifully with `animationStyle` and `asciiBackground`.
|
|
182
|
+
*
|
|
183
|
+
* Use `CHARSET_SEQUENCES` for curated combinations or build your own:
|
|
184
|
+
* @example
|
|
185
|
+
* options: { charsetFrames: CHARSET_SEQUENCES.cosmic }
|
|
186
|
+
* options: { charsetFrames: [CHARSETS.standard, CHARSETS.blocks, CHARSETS.circles] }
|
|
187
|
+
*/
|
|
188
|
+
charsetFrames?: string[];
|
|
189
|
+
/** Cycle rate for `charsetFrames` in frames-per-second. Default: `2` */
|
|
190
|
+
charsetFps?: number;
|
|
177
191
|
}
|
|
178
192
|
interface AsciiCell {
|
|
179
193
|
char: string;
|
|
@@ -181,6 +195,8 @@ interface AsciiCell {
|
|
|
181
195
|
g: number;
|
|
182
196
|
b: number;
|
|
183
197
|
a: number;
|
|
198
|
+
/** Stored dithered luminance (0–255). Present when the frame was generated by the engine. Used for dynamic charset re-selection at render time via `charsetFrames`. */
|
|
199
|
+
lum?: number;
|
|
184
200
|
}
|
|
185
201
|
type AsciiFrame = AsciiCell[][];
|
|
186
202
|
interface AsciiResult {
|
|
@@ -205,7 +221,41 @@ declare const CHARSETS: {
|
|
|
205
221
|
readonly musical: " ♩♪♫♬♭♮♯";
|
|
206
222
|
readonly emoji: " ⬛🟫🟥🟧🟨🟩🟦🟪⬜";
|
|
207
223
|
readonly circles: " .·:∘○◦°•∙";
|
|
224
|
+
readonly shadows: " ·∘◦○◎⊙●◉";
|
|
225
|
+
readonly starfield: " ˙·∘∗✦✧★◆●";
|
|
226
|
+
readonly geometric: " ·△▷◇◈◆▣■█";
|
|
227
|
+
readonly pipes: " ╶─┐└├┤┬┴┼╬▒▓█";
|
|
228
|
+
readonly waves: " ˜∼≈〰≋∿∾∭∫";
|
|
229
|
+
readonly shards: " ╱╲╳◤◥◣◢△▲◆◼█";
|
|
230
|
+
readonly smoke: " ·˙⁚⁖∶∷⋮⋰⋱∴∵";
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Curated charset sequences for use with `charsetFrames`.
|
|
234
|
+
* Each sequence morphs between 2–3 complementary charsets over time,
|
|
235
|
+
* creating a living texture effect.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* asciiBackground('#hero', { charsetFrames: CHARSET_SEQUENCES.cosmic })
|
|
239
|
+
*/
|
|
240
|
+
declare const CHARSET_SEQUENCES: {
|
|
241
|
+
/** Stars → softcircles → orbs — dreamy space feel */
|
|
242
|
+
readonly cosmic: string[];
|
|
243
|
+
/** Katakana → braille dots → binary — hacker rain */
|
|
244
|
+
readonly rain: string[];
|
|
245
|
+
/** Box pipes → Claude glyphs → classic — terminal morph */
|
|
246
|
+
readonly terminal: string[];
|
|
247
|
+
/** Shards → blocks → squares — shattering crystal */
|
|
248
|
+
readonly crystal: string[];
|
|
249
|
+
/** Wave glyphs → smoke dots → circles — fluid / organic */
|
|
250
|
+
readonly fluid: string[];
|
|
251
|
+
/** Dense classic → art → blocks — maximum detail pulse */
|
|
252
|
+
readonly pulse: string[];
|
|
253
|
+
/** Braille → shadows → smoke — ethereal / dream-like */
|
|
254
|
+
readonly dream: string[];
|
|
255
|
+
/** Geometric shapes → shards → starfield — sci-fi angular */
|
|
256
|
+
readonly angular: string[];
|
|
208
257
|
};
|
|
258
|
+
type CharsetSequenceKey = keyof typeof CHARSET_SEQUENCES;
|
|
209
259
|
type CharsetKey = keyof typeof CHARSETS;
|
|
210
260
|
/**
|
|
211
261
|
* Art Style presets — each one sets render mode, charset, color mode, etc.
|
|
@@ -1032,4 +1082,4 @@ interface WebcamOptions {
|
|
|
1032
1082
|
*/
|
|
1033
1083
|
declare function asciifyWebcam(canvas: HTMLCanvasElement, { fontSize, style, options, liveOptions, mirror, constraints, dpr: dprOverride, }?: WebcamOptions): Promise<() => void>;
|
|
1034
1084
|
|
|
1035
|
-
export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifyLiveVideoOptions, type AsciifySimpleOptions, type AsciifyVideoOptions, type AuroraBackgroundOptions, BACKGROUND_TYPES, type BackgroundType, 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 RenderMode, type SilkBackgroundOptions, type SnapshotOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebcamOptions, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, videoToAsciiFrames };
|
|
1085
|
+
export { ART_STYLE_PRESETS, type AnimationStyle, type ArtStyle, type AsciiBackgroundOptions, type AsciiCell, type AsciiFrame, type AsciiOptions, type AsciiResult, type AsciifyLiveVideoOptions, type AsciifySimpleOptions, type AsciifyVideoOptions, type AuroraBackgroundOptions, BACKGROUND_TYPES, type BackgroundType, CHARSETS, CHARSET_SEQUENCES, type CharsetKey, type CharsetSequenceKey, 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 RenderMode, type SilkBackgroundOptions, type SnapshotOptions, type SourceType, type StarsBackgroundOptions, type TerrainBackgroundOptions, type TextBackgroundOptions, type VoidBackgroundOptions, type WaveBackgroundOptions, type WebcamOptions, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, videoToAsciiFrames };
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,32 @@ var CHARSETS = {
|
|
|
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
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
|
+
circles: " .\xB7:\u2218\u25CB\u25E6\xB0\u2022\u2219",
|
|
28
|
+
shadows: " \xB7\u2218\u25E6\u25CB\u25CE\u2299\u25CF\u25C9",
|
|
29
|
+
starfield: " \u02D9\xB7\u2218\u2217\u2726\u2727\u2605\u25C6\u25CF",
|
|
30
|
+
geometric: " \xB7\u25B3\u25B7\u25C7\u25C8\u25C6\u25A3\u25A0\u2588",
|
|
31
|
+
pipes: " \u2576\u2500\u2510\u2514\u251C\u2524\u252C\u2534\u253C\u256C\u2592\u2593\u2588",
|
|
32
|
+
waves: " \u02DC\u223C\u2248\u3030\u224B\u223F\u223E\u222D\u222B",
|
|
33
|
+
shards: " \u2571\u2572\u2573\u25E4\u25E5\u25E3\u25E2\u25B3\u25B2\u25C6\u25FC\u2588",
|
|
34
|
+
smoke: " \xB7\u02D9\u205A\u2056\u2236\u2237\u22EE\u22F0\u22F1\u2234\u2235"
|
|
35
|
+
};
|
|
36
|
+
var CHARSET_SEQUENCES = {
|
|
37
|
+
/** Stars → softcircles → orbs — dreamy space feel */
|
|
38
|
+
cosmic: [CHARSETS.starfield, CHARSETS.circles, CHARSETS.shadows],
|
|
39
|
+
/** Katakana → braille dots → binary — hacker rain */
|
|
40
|
+
rain: [CHARSETS.katakana, CHARSETS.braille, CHARSETS.binary],
|
|
41
|
+
/** Box pipes → Claude glyphs → classic — terminal morph */
|
|
42
|
+
terminal: [CHARSETS.pipes, CHARSETS.claudeCode, CHARSETS.standard],
|
|
43
|
+
/** Shards → blocks → squares — shattering crystal */
|
|
44
|
+
crystal: [CHARSETS.shards, CHARSETS.geometric, CHARSETS.blocks],
|
|
45
|
+
/** Wave glyphs → smoke dots → circles — fluid / organic */
|
|
46
|
+
fluid: [CHARSETS.waves, CHARSETS.smoke, CHARSETS.circles],
|
|
47
|
+
/** Dense classic → art → blocks — maximum detail pulse */
|
|
48
|
+
pulse: [CHARSETS.dense, CHARSETS.standard, CHARSETS.blocks],
|
|
49
|
+
/** Braille → shadows → smoke — ethereal / dream-like */
|
|
50
|
+
dream: [CHARSETS.braille, CHARSETS.shadows, CHARSETS.smoke],
|
|
51
|
+
/** Geometric shapes → shards → starfield — sci-fi angular */
|
|
52
|
+
angular: [CHARSETS.geometric, CHARSETS.shards, CHARSETS.starfield]
|
|
28
53
|
};
|
|
29
54
|
var ART_STYLE_PRESETS = {
|
|
30
55
|
classic: {
|
|
@@ -94,6 +119,44 @@ var ART_STYLE_PRESETS = {
|
|
|
94
119
|
charset: CHARSETS.circles,
|
|
95
120
|
colorMode: "accent",
|
|
96
121
|
accentColor: "#d4ff00"
|
|
122
|
+
},
|
|
123
|
+
shadows: {
|
|
124
|
+
renderMode: "ascii",
|
|
125
|
+
charset: CHARSETS.shadows,
|
|
126
|
+
colorMode: "accent",
|
|
127
|
+
accentColor: "#50a0ff"
|
|
128
|
+
},
|
|
129
|
+
starfield: {
|
|
130
|
+
renderMode: "ascii",
|
|
131
|
+
charset: CHARSETS.starfield,
|
|
132
|
+
colorMode: "fullcolor"
|
|
133
|
+
},
|
|
134
|
+
geometric: {
|
|
135
|
+
renderMode: "ascii",
|
|
136
|
+
charset: CHARSETS.geometric,
|
|
137
|
+
colorMode: "grayscale"
|
|
138
|
+
},
|
|
139
|
+
pipes: {
|
|
140
|
+
renderMode: "ascii",
|
|
141
|
+
charset: CHARSETS.pipes,
|
|
142
|
+
colorMode: "accent",
|
|
143
|
+
accentColor: "#00ff88"
|
|
144
|
+
},
|
|
145
|
+
waves: {
|
|
146
|
+
renderMode: "ascii",
|
|
147
|
+
charset: CHARSETS.waves,
|
|
148
|
+
colorMode: "fullcolor"
|
|
149
|
+
},
|
|
150
|
+
shards: {
|
|
151
|
+
renderMode: "ascii",
|
|
152
|
+
charset: CHARSETS.shards,
|
|
153
|
+
colorMode: "grayscale"
|
|
154
|
+
},
|
|
155
|
+
smoke: {
|
|
156
|
+
renderMode: "ascii",
|
|
157
|
+
charset: CHARSETS.smoke,
|
|
158
|
+
colorMode: "accent",
|
|
159
|
+
accentColor: "#c850ff"
|
|
97
160
|
}
|
|
98
161
|
};
|
|
99
162
|
var DEFAULT_OPTIONS = {
|
|
@@ -722,7 +785,7 @@ function imageToAsciiFrame(source, options, targetWidth, targetHeight) {
|
|
|
722
785
|
const adjustedLum = adjustLuminance(lum, options.brightness, options.contrast);
|
|
723
786
|
const ditheredLum = applyDither(adjustedLum, x, y, options.ditherStrength);
|
|
724
787
|
const char = options.customText ? customTextToChar(ditheredLum, options.customText, x, y, cols, invertVal) : luminanceToChar(ditheredLum, options.charset, invertVal);
|
|
725
|
-
row.push({ char, r, g, b, a });
|
|
788
|
+
row.push({ char, r, g, b, a, lum: ditheredLum });
|
|
726
789
|
}
|
|
727
790
|
frame.push(row);
|
|
728
791
|
}
|
|
@@ -966,9 +1029,12 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
966
1029
|
ctx.textBaseline = "middle";
|
|
967
1030
|
}
|
|
968
1031
|
let charWeights = null;
|
|
1032
|
+
const dynFrms = options.charsetFrames;
|
|
1033
|
+
const hasDyn = !!dynFrms?.length;
|
|
1034
|
+
const dynCharset = hasDyn ? dynFrms[Math.floor(Math.max(0, time) * (options.charsetFps ?? 2)) % dynFrms.length] : options.charset;
|
|
969
1035
|
if (useFastRect) {
|
|
970
1036
|
charWeights = {};
|
|
971
|
-
const csChars = [...
|
|
1037
|
+
const csChars = [...dynCharset];
|
|
972
1038
|
const csLen = csChars.length;
|
|
973
1039
|
for (let i = 0; i < csLen; i++) {
|
|
974
1040
|
charWeights[csChars[i]] = Math.max(0.1, (i + 0.3) / csLen);
|
|
@@ -979,7 +1045,9 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
979
1045
|
const rowData = frame[y];
|
|
980
1046
|
for (let x = 0; x < cols; x++) {
|
|
981
1047
|
const cell = rowData[x];
|
|
982
|
-
if (cell.
|
|
1048
|
+
if (cell.a < 10) continue;
|
|
1049
|
+
const drawChar = hasDyn && cell.lum != null ? luminanceToChar(cell.lum, dynCharset, isInverted) : cell.char;
|
|
1050
|
+
if (drawChar === " ") continue;
|
|
983
1051
|
const animMul = noAnimation ? 1 : getAnimationMultiplier(x, y, cols, rows, time, animStyle, animSpeed);
|
|
984
1052
|
if (animMul < 0.05) continue;
|
|
985
1053
|
let hoverScale = 1;
|
|
@@ -1019,7 +1087,7 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
1019
1087
|
color = getCellColorStr(cell, colorMode, acR, acG, acB, isInverted);
|
|
1020
1088
|
}
|
|
1021
1089
|
if (useFastRect) {
|
|
1022
|
-
const weight = charWeights[
|
|
1090
|
+
const weight = charWeights[drawChar] ?? 0.5;
|
|
1023
1091
|
const effAlpha = Math.min(1, cell.a * 0.00392156863 * animMul * (1 + hoverGlow)) * weight;
|
|
1024
1092
|
if (effAlpha < 0.02) continue;
|
|
1025
1093
|
if (effAlpha !== lastAlpha) {
|
|
@@ -1046,10 +1114,10 @@ function renderFrameToCanvas(ctx, frame, options, canvasWidth, canvasHeight, tim
|
|
|
1046
1114
|
if (hoverScale !== 1) {
|
|
1047
1115
|
ctx.translate(px, py);
|
|
1048
1116
|
ctx.scale(hoverScale, hoverScale);
|
|
1049
|
-
ctx.fillText(
|
|
1117
|
+
ctx.fillText(drawChar, 0, 0);
|
|
1050
1118
|
ctx.setTransform(baseTransform);
|
|
1051
1119
|
} else {
|
|
1052
|
-
ctx.fillText(
|
|
1120
|
+
ctx.fillText(drawChar, px, py);
|
|
1053
1121
|
}
|
|
1054
1122
|
}
|
|
1055
1123
|
}
|
|
@@ -2640,6 +2708,6 @@ async function asciifyWebcam(canvas, {
|
|
|
2640
2708
|
};
|
|
2641
2709
|
}
|
|
2642
2710
|
|
|
2643
|
-
export { ART_STYLE_PRESETS, BACKGROUND_TYPES, CHARSETS, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, videoToAsciiFrames };
|
|
2711
|
+
export { ART_STYLE_PRESETS, BACKGROUND_TYPES, CHARSETS, CHARSET_SEQUENCES, DEFAULT_OPTIONS, HOVER_PRESETS, PALETTE_THEMES, asciiBackground, asciiText, asciiTextAnsi, asciify, asciifyGif, asciifyLiveVideo, asciifyVideo, asciifyWebcam, buildTextFrame, captureSnapshot, gifToAsciiFrames, imageToAsciiFrame, mountWaveBackground, renderAuroraBackground, renderCircuitBackground, renderDnaBackground, renderFireBackground, renderFrameToCanvas, renderGridBackground, renderMorphBackground, renderNoiseBackground, renderPulseBackground, renderRainBackground, renderSilkBackground, renderStarsBackground, renderTerrainBackground, renderTextBackground, renderVoidBackground, renderWaveBackground, snapshotAndDownload, videoToAsciiFrames };
|
|
2644
2712
|
//# sourceMappingURL=index.js.map
|
|
2645
2713
|
//# sourceMappingURL=index.js.map
|