a2host/.agents/skills/premium-motion-animations/SKILL.md

76 lines
3.1 KiB
Markdown

---
name: premium-motion-animations
description: >-
Guides the implementation of fluid motion design, physics-based Bézier transitions, staggered entry animations,
border glows, and tactile micro-interactions for frontend components. Use when creating, animating, or polishing
interactive components, modals, chat messages, or transitions to achieve a state-of-the-art SaaS look and feel.
---
# Premium Motion & Animation Skill
## Core Animation Guidelines
1. **Physics-Based Bézier Easing**:
- Never use default linear transitions for layout elements or panels.
- Use high-end cubic-bezier curves for fluid acceleration and natural deceleration:
- **Enter / Reveal curve**: `cubic-bezier(0.16, 1, 0.3, 1)` (smooth elastic ease-out).
- **Exit / Dismiss curve**: `cubic-bezier(0.7, 0, 0.84, 0)` (crisp ease-in).
- **Snappy micro-interactions**: `cubic-bezier(0.2, 0.8, 0.2, 1)`.
2. **Staggered Cascade Entries (Lists & Messages)**:
- When rendering lists of cards, chat messages, or topic chips, stagger their entrance animations so they do not all pop in simultaneously.
- Example implementation with dynamic animation delays:
```jsx
{items.map((item, index) => (
<div
key={item.id}
className="animate-slide-up opacity-0"
style={{ animationDelay: `${index * 40}ms`, animationFillMode: 'forwards' }}
>
{item.content}
</div>
))}
```
3. **Keyframe Definitions (Tailwind / CSS)**:
- **Slide & Fade In**:
```css
@keyframes slideUpFade {
from {
opacity: 0;
transform: translateY(12px) scale(0.98);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
```
- **Beacon Pulse (Radar)**:
```html
<span className="relative flex h-2.5 w-2.5">
<span className="animate-ping absolute inline-flex h-full w-full rounded-full bg-lime-400 opacity-75" />
<span className="relative inline-flex rounded-full h-2.5 w-2.5 bg-lime-500" />
</span>
```
4. **Tactile Hover & Press Micro-Interactions**:
- Buttons, action cards, and icons must communicate physics feedback:
- Base: `transition-all duration-200 ease-out`
- Hover: `hover:scale-[1.02] hover:-translate-y-0.5`
- Active / Click: `active:scale-[0.97] active:translate-y-0`
- Subtle brightness/glow change: `hover:shadow-[0_4px_20px_rgba(132,204,22,0.2)]`
5. **Animated Border Beams & Shimmers**:
- Active cards and focused search bars can use a gradient border sweep or subtle shimmer:
```css
background: linear-gradient(60deg, rgba(255,255,255,0.05), rgba(132,204,22,0.15), rgba(255,255,255,0.05));
background-size: 200% 100%;
animation: shimmer 4s infinite linear;
```
6. **Hardware Acceleration & Performance**:
- Always animate GPU-accelerated properties: `transform`, `opacity`, `filter`.
- Never animate layout geometry properties like `height`, `width`, `top`, `left`, `margin`, or `padding` directly when animating motion; use transforms (`scale`, `translate3d`).
- Add `will-change: transform, opacity` only during active transitions, avoiding long-term memory leaks.