Components/AI

AI Agent Animation

Animated AI agent with progress tracking, dot grid visualization, and customizable animation states

Live Preview
Open in
Agent Loading: Ready
0.0s

Example

import AiAgentAnimation from '@/components/LY UI/AI/AiAgentAnimation'

export default function AiAgentAnimationExample() {

  const [isRunning, setIsRunning] = useState(false);
  const [hasStarted, setHasStarted] = useState(false);
  const [animationKey, setAnimationKey] = useState(0);

  const handleStart = () => {
    console.log("Animation started");
    setHasStarted(true);
  };

  const handleStop = () => {
    console.log("Animation stopped");
  };

  const handleReset = () => {
    setIsRunning(false);
    setHasStarted(false);
    setAnimationKey((prev) => prev + 1);
    console.log("Animation reset");
  };

  const handleComplete = () => {
    console.log("Animation completed");
    setIsRunning(false);
    setHasStarted(false);
  };

  const handleStartOrResume = () => {
    setIsRunning(true);
    if (!hasStarted) {
      handleStart();
    } else {
      console.log("Animation resumed");
    }
  };

  return <AiAgentAnimation
        key={animationKey}
        title="Agent Loading"
        dotType="square"
        className="w-1/2"
        isRunning={isRunning}
        onAnimationStart={handleStart}
        onAnimationStop={handleStop}
        onAnimationReset={handleReset}
        onAnimationComplete={handleComplete}
        rows={3}
        // columns={45}
        duration={40000}
        pauseDuration={1000}
      />
}

Documentation

PropTypeDefaultDescription
titlestring"Agent"Title displayed before the percentage
durationnumber3000Animation duration in milliseconds
onAnimationComplete() => voidundefinedCallback called at the end of the animation
columnsnumberauto-calculatedNumber of dot columns (auto-calculated if not specified)
rowsnumber3Number of dot rows
classNamestringundefinedAdditional CSS classes for styling
pauseDurationnumber500Pause duration between each cycle in milliseconds
isRunningbooleanfalseExternal control of the animation state
onAnimationStart() => voidundefinedCallback called when the animation starts
onAnimationStop() => voidundefinedCallback called when the animation stops
onAnimationReset() => voidundefinedCallback called when the animation is reset
dotType"round" | "square""round"Shape of the dots

Types

interface AiAgentAnimationProps {
  title?: string
  duration?: number
  onAnimationComplete?: () => void
  columns?: number
  rows?: number
  className?: string
  pauseDuration?: number
  isRunning?: boolean
  onAnimationStart?: () => void
  onAnimationStop?: () => void
  onAnimationReset?: () => void
  dotType?: 'round' | 'square'
}

Features

  • Progress Tracking: Real-time progress percentage display with smooth animations
  • Dot Grid Visualization: Animated dot grid that responds to animation state changes
  • Customizable Animation: Configurable duration, pause intervals, and dot patterns
  • External Control: Full external control over animation start, stop, and reset
  • Responsive Design: Auto-calculated columns based on container width
  • Multiple Dot Types: Support for round and square dot shapes
  • State Callbacks: Comprehensive callback system for animation lifecycle events
  • Accessibility Support: Screen reader friendly with proper ARIA attributes