设计与 UI
Add the
aceternity-ui
Add premium animated UI components built with Framer Motion and Tailwind CSS using Aceternity UI. Use when: adding animated effects (3D cards, glowing backgrounds, spotlight effects, moving borders), building visually stunning UIs, creating impressive hero sections and feature showcases in React/Next.js.
TerminalSkills · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add TerminalSkills/skills --skill aceternity-ui技能说明
name: aceternity-ui description: >- Add premium animated UI components built with Framer Motion and Tailwind CSS using Aceternity UI. Use when: adding animated effects (3D cards, glowing backgrounds, spotlight effects, moving borders), building visually stunning UIs, creating impressive hero sections and feature showcases in React/Next.js. license: Apache-2.0 compatibility: "Requires React 18+, Tailwind CSS 3+, Framer Motion 10+" metadata: author: terminal-skills version: "1.0.0" category: design tags: ["aceternity-ui", "react", "framer-motion", "animations", "tailwind"] use-cases: - "Create a 3D tilt card effect for a product or pricing showcase" - "Add a spotlight effect that follows the cursor on a hero section" - "Build an animated background with moving beams or grid patterns" - "Add a glowing moving border to highlight key elements" - "Create a wavy animated background for section dividers" agents: [claude-code, openai-codex, gemini-cli, cursor]
Aceternity UI
Overview
Aceternity UI is a copy-paste component library — not an npm package. You copy the component code directly into your project, giving you full ownership and customization power. Components are built with Framer Motion and Tailwind CSS.
Key traits:
- Copy-paste approach (no runtime dependency)
- Framer Motion for physics-based animations
- Tailwind CSS for styling
- Next.js / React compatible
- TypeScript source included
Setup
Install dependencies
npm install framer-motion clsx tailwind-merge
Add the cn utility
// lib/utils.ts
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
Configure Tailwind
// tailwind.config.ts — add animations
module.exports = {
content: ["./src/**/*.{ts,tsx}"],
theme: {
extend: {
animation: {
spotlight: "spotlight 2s ease .75s 1 forwards",
shimmer: "shimmer 2s linear infinite",
"move-to-right": "move-to-right 2s linear infinite",
},
keyframes: {
spotlight: {
"0%": { opacity: "0", transform: "translate(-72%, -62%) scale(0.5)" },
"100%": { opacity: "1", transform: "translate(-50%, -40%) scale(1)" },
},
shimmer: {
from: { backgroundPosition: "0 0" },
to: { backgroundPosition: "-200% 0" },
},
},
},
},
};
Top 5 Components with Code
1. 3D Card Effect — tilt on hover
// components/ui/3d-card.tsx
"use client";
import { useRef, useState } from "react";
import { motion } from "framer-motion";
import { cn } from "@/lib/utils";
export const CardContainer = ({ children, className }: { children: React.ReactNode; className?: string }) => {
const containerRef = useRef<HTMLDivElement>(null);
const [rotateX, setRotateX] = useState(0);
const [rotateY, setRotateY] = useState(0);
const handleMouseMove = (e: React.MouseEvent<HTMLDivElement>) => {
if (!containerRef.current) return;
const { left, top, width, height } = containerRef.current.getBoundingClientRect();
const x = (e.clientX - left - width / 2) / 25;
const y = (e.clientY - top - height / 2) / 25;
setRotateX(-y);
setRotateY(x);
};
return (
<div
ref={containerRef}
onMouseMove={handleMouseMove}
onMouseLeave={() => { setRotateX(0); setRotateY(0); }}
className={cn("group/card perspective-1000", className)}
style={{ perspective: "1000px" }}
>
<motion.div
animate={{ rotateX, rotateY }}
transition={{ type: "spring", stiffness: 300, damping: 30 }}
style={{ transformStyle: "preserve-3d" }}
>
{children}
</motion.div>
</div>
);
};
export const CardBody = ({ children, className }: { children: React.ReactNode; className?: string }) => (
<div className={cn("h-96 w-96 rounded-xl border border-white/10 bg-gray-900 p-6", className)}>
{children}
</div>
);
// Usage
export function PricingCard() {
return (
<CardContainer>
<CardBody className="flex flex-col justify-between p-8">
<h3 className="text-2xl font-bold text-white">Pro Plan</h3>
<p className="text-4xl font-bold text-white">$29<span className="text-lg text-gray-400">/mo</span></p>
<button className="rounded-lg bg-white px-6 py-3 font-semibold text-black">Get Started</button>
</CardBody>
</CardContainer>
);
}
2. Background Beams — animated gradient beams
// components/ui/background-beams.tsx
"use client";
import { cn } from "@/lib/utils";
export function BackgroundBeams({ className }: { className?: string }) {
return (
<div className={cn("absolute inset-0 overflow-hidden", className)}>
<svg
className="absolute h-full w-full"
xmlns="http://www.w3.org/2000/svg"
>
<defs>
<radialGradient id="beam1" cx="50%" cy="0%" r="50%">
<stop offset="0%" stopColor="#6366f1" stopOpacity="0.3" />
<stop offset="100%" stopColor="transparent" stopOpacity="0" />
</radialGradient>
<radialGradient id="beam2" cx="20%" cy="50%" r="40%">
<stop offset="0%" stopColor="#8b5cf6" stopOpacity="0.2" />
<stop offset="100%" stopColor="transparent" stopOpacity="0" />
</radialGradient>
</defs>
<rect width="100%" height="100%" fill="url(#beam1)" />
<rect width="100%" height="100%" fill="url(#beam2)" />
{/* Animated lines */}
{[...Array(6)].map((_, i) => (
<line
key={i}
x1={`${(i + 1) * 15}%`}
y1="0%"
x2={`${(i + 1) * 15 + 10}%`}
y2="100%"
stroke={`hsl(${240 + i * 20}, 70%, 60%)`}
strokeWidth="1"
strokeOpacity="0.15"
/>
))}
</svg>
</div>
);
}
// Usage
export function HeroSect
阅读完整来源 ↗