A responsive image-to-ASCII renderer with image, flowing ripple, and signal-glitch variations.
pnpm dlx shadcn@latest add @componentry/ascii-effect| Prop | Type | Default |
|---|---|---|
imageSrc | stringImage URL rendered as ASCII characters. | — |
variant | "image" | "flow" | "glitch"Visual effect variation. | "image" |
chars | stringCharacters ordered from darkest to brightest. | " .:-=+*#%@" |
fontSize | numberCharacter height in pixels. | 9 |
fontFamily | stringFont stack used to draw the characters. | Arial, Helvetica, sans-serif |
fontWeight | number | stringCanvas font weight. | 400 |
lineHeight | numberCharacter row height multiplier. | 1 |
characterSpacing | numberHorizontal character-cell spacing multiplier. | 1 |
brightnessBoost | numberMultiplier applied to sampled image luminance. | 2.2 |
contrast | numberContrast applied before character selection. | 1.1 |
threshold | numberDark-pixel cutoff used to keep the background clean. | 0.06 |
posterize | numberNumber of luminance steps. | 32 |
dither | "none" | "floyd-steinberg" | "bayer"Dithering algorithm used to preserve photographic detail. | "floyd-steinberg" |
ditherStrength | numberAmount of error diffusion or ordered dithering. | 0.8 |
flowSpeed | numberFlow cycles per second for the flow variant. | 0.22 |
flowDirection | numberFlow direction in degrees. | 0 |
flowStrength | numberDirectional displacement in pixels. | 12 |
flowFrequency | numberSize of the flowing wave field. | 0.018 |
mouseRadius | numberRadius of the pointer ripple in pixels. | 150 |
mouseStrength | numberPointer ripple displacement in pixels. | 22 |
mouseWaveSpeed | numberSpeed of the pointer ripple. | 1.2 |
scale | numberImage zoom inside the ASCII field. | 1.15 |
fit | "cover" | "contain" | "stretch"How the source image fits the canvas. | "cover" |
colors | string[]One or more colors used as a luminance gradient. | — |
colorMode | "gradient" | "source"Use a supplied gradient or colors sampled from the image. | "gradient" |
backgroundColor | stringCanvas background color. | "#07090d" |
invert | booleanReverse the luminance-to-character mapping. | false |
glitchIntensity | numberStrength and number of displaced signal bands. | 0.65 |
glitchFrequency | numberApproximate glitches per second. | 1.4 |
revealDuration | numberRadial reveal duration in milliseconds. | 1400 |
alt | stringAccessible label for the canvas. | "ASCII rendering" |
className | stringAdditional classes for the container. | — |
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.
import { AsciiEffect } from "@/components/ui/ascii-effect"
<div className="h-[520px] overflow-hidden rounded-2xl">
<AsciiEffect
variant="image"
imageSrc="/images/portrait.jpg"
fontSize={9}
scale={1.15}
/>
</div>