Components/AI
AI Agent Animation
Animated AI agent with progress tracking, dot grid visualization, and customizable animation states
●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
Prop | Type | Default | Description |
---|---|---|---|
title | string | "Agent" | Title displayed before the percentage |
duration | number | 3000 | Animation duration in milliseconds |
onAnimationComplete | () => void | undefined | Callback called at the end of the animation |
columns | number | auto-calculated | Number of dot columns (auto-calculated if not specified) |
rows | number | 3 | Number of dot rows |
className | string | undefined | Additional CSS classes for styling |
pauseDuration | number | 500 | Pause duration between each cycle in milliseconds |
isRunning | boolean | false | External control of the animation state |
onAnimationStart | () => void | undefined | Callback called when the animation starts |
onAnimationStop | () => void | undefined | Callback called when the animation stops |
onAnimationReset | () => void | undefined | Callback 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