Baktiyar Ablaikhan

ASCII Art

Source
Aceternity UI ↗
Author
Aceternity UI
Licence
Aceternity UI licence (free component)

Loading…

A photo redrawn as ASCII characters on canvas; each hover replays the reveal in a new style.

Code

"use client";
import React, { useState } from "react";
import { AsciiArt } from "@/lab/aceternity/ui/ascii-art";

const STYLES = ["fade", "typewriter", "matrix"] as const;

export default function AsciiArtDemo() {
  // Each hover replays the reveal with the next animation style.
  const [run, setRun] = useState(0);
  return (
    <div
      className="flex h-full w-full items-center justify-center bg-neutral-950"
      onPointerEnter={() => setRun((r) => r + 1)}
    >
      <AsciiArt
        key={run}
        src="https://assets.aceternity.com/avatars/manu.webp"
        resolution={100}
        color="var(--color-neutral-500)"
        animationStyle={STYLES[run % STYLES.length]}
        animationDuration={1.5}
        animateOnView={false}
        className="aspect-square h-full max-w-full bg-neutral-950"
      />
    </div>
  );
}
Prompt

Build "ASCII Art", a canvas animation. What it does: A photo redrawn as ASCII characters on canvas; each hover replays the reveal in a new style. Write it as a single self-contained React component in TypeScript that fills its parent (w-full h-full), styled with Tailwind CSS, using motion. Technique: an HTML canvas, a requestAnimationFrame loop, the Motion library. It sits on a dark background, in a square frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://ui.aceternity.com/components/ascii-art (Aceternity UI, Aceternity UI licence (free component)).