AI Image Loading Animation
ProDots rise from a dark floor, form the picture, and clear into the photograph.
Overview
AI Image Loading Animation is a React and Tailwind CSS loader for AI image generation, in Next.js or any React app, drawn on a 2D canvas. Dots rest on a dark floor, rise into a cloud of guesses, then sample your photo's pixels and settle into its shape and color as the picture sharpens. A ring and counter reach 100 percent the moment it is sharp, and duration can change mid run without a jump. Off screen it idles, and reduced motion jumps to the photo. The image is read through crossOrigin, so host it where CORS allows your domain.
Installation
Run the following command
pnpm dlx wensity@latest add ai-image-generator
Usage
Import AiImageGenerator from @/components/wensity/ai-image-generator and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.
import { AiImageGenerator } from "@/components/wensity/ai-image-generator";export default function Example() {return (<AiImageGeneratorsrc="https://assets.wensity.com/photos/food-culinary/blood-orange-still.webp"alt="Blood orange still life"duration={10}loopcolor="#ffffff"/>);}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
src | string | "https://assets.wensity.com/photos/food-culinary/blood-orange-still.webp" | Photograph the field resolves into. |
alt | string | "Blood orange still life" | Accessible name for the generated picture. |
duration | number | 10 | Generation time in seconds, from the empty floor to the sharp photograph. Changing it mid-run bends the remaining time instead of jumping. |
loop | boolean | true | Start again after a short hold on the finished picture. When false the card rests on the photograph until clicked. |
color | string | "#ffffff" | Resting color of the dots. White keeps the field black and white. Any other hex paints that shade until the photograph takes over. |
onComplete | () => void | - | Called each time a picture finishes generating. |
Featured in React AI chat UI components.
