一键导入
dev-patterns-ui-animations
Game UI and HUD animation patterns with Framer Motion. Use when animating HUD elements.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Game UI and HUD animation patterns with Framer Motion. Use when animating HUD elements.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Complete Developer workflow orchestration - task research sequence, implementation flow, validation gates, PRD synchronization, exit conditions.
Complete Game Designer workflow - skill invocation protocol, GDD creation, playtest flow with GDD review, design sessions. MUST load before starting assignments.
Complete PM Coordinator workflow - task assignment, project orchestration, PRD management, worker coordination. Use proactively when starting PM agent work.
Complete PM Coordinator workflow - task assignment, project orchestration, PRD management, worker coordination. Use proactively when starting PM agent work.
Complete QA Validator workflow orchestration. References specialized skills for each validation step. Load at session startup for full protocol.
Base instructions and guidelines for all agents in the system. This skill provides foundational behaviors and communication protocols that all agents should follow.
| name | dev-patterns-ui-animations |
| description | Game UI and HUD animation patterns with Framer Motion. Use when animating HUD elements. |
| category | patterns |
"Smooth, responsive UI animations provide critical game feel feedback."
Use when:
import { motion, AnimatePresence } from 'motion/react';
// Kill feed entry animation
function KillFeedEntry({ kill, onExit }) {
return (
<AnimatePresence>
<motion.div
initial={{ x: 100, opacity: 0 }}
animate={{ x: 0, opacity: 1 }}
exit={{ x: -100, opacity: 0 }}
transition={{ duration: 0.3, ease: 'easeOut' }}
onAnimationComplete={onExit}
>
{kill.killer} splatted {kill.victim}
</motion.div>
</AnimatePresence>
);
}
| Need | Use |
|---|---|
| Simple entry/exit animations | CSS transitions with Tailwind classes |
| Complex choreography | Motion (Framer Motion) variants |
| Continuous value updates | CSS transforms with requestAnimationFrame |
| 3D UI attached to camera | R3F Html component + CSS animations |
| High-frequency updates | Transform only (no layout triggers) |
function KillFeedItem({ killer, victim }) {
return (
<div className="kill-feed-item animate-slide-in">
<span className="killer-name">{killer}</span>
<span className="skull-icon">💀</span>
<span className="victim-name">{victim}</span>
</div>
);
}
/* CSS */
@keyframes slideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes fadeOut {
from { opacity: 1; }
to { opacity: 0; }
}
.kill-feed-item {
animation: slideIn 0.3s ease-out;
will-change: transform, opacity;
}
function KillFeed({ kills }) {
return (
<div className="kill-feed">
<AnimatePresence mode="popLayout">
{kills.map((kill) => (
<motion.div
key={kill.id}
layout
initial={{ x: 100, opacity: 0, scale: 0.8 }}
animate={{ x: 0, opacity: 1, scale: 1 }}
exit={{ x: -100, opacity: 0, scale: 0.8 }}
transition={{
type: 'spring',
stiffness: 300,
damping: 25
}}
className="kill-entry"
>
<span className="killer">{kill.killer}</span>
<span>⚔️</span>
<span className="victim">{kill.victim}</span>
</motion.div>
))}
</AnimatePresence>
</div>
);
}
function MatchTimer({ duration, remaining }) {
const progress = remaining / duration;
return (
<div className="match-timer">
<motion.div
className="timer-bar"
style={{
scaleX: progress,
transformOrigin: 'left'
}}
transition={{ ease: 'linear', duration: 1 }}
/>
<span className="timer-text">
{Math.floor(remaining / 60)}:{(remaining % 60).toString().padStart(2, '0')}
</span>
</div>
);
}
function InkTankIndicator({ current, max }) {
const percentage = (current / max) * 100;
// Color transitions from blue (full) to red (low)
const color = percentage > 50
? '#3b82f6' // blue
: percentage > 25
? '#f59e0b' // orange
: '#ef4444'; // red
return (
<div className="ink-tank">
<motion.div
className="ink-level"
style={{ backgroundColor: color }}
animate={{ width: `${percentage}%` }}
transition={{ type: 'spring', stiffness: 200, damping: 20 }}
/>
<span className="ink-text">{Math.floor(current)} / {max}</span>
</div>
);
}
| ❌ Wrong | ✅ Right |
|---|---|
| Animating layout properties (width, height) | Use transform: scaleX/scaleX |
| Not using will-change | Add for GPU acceleration |
| Overusing spring animations | Use for UI, not game logic |
| Animating during high FPS | Consider throttling |