Skip to content

Instantly share code, notes, and snippets.

@hellokaton
Created January 2, 2025 03:10
Show Gist options
  • Save hellokaton/8b13dce38712bee0af1a5ae3de5c5172 to your computer and use it in GitHub Desktop.
Save hellokaton/8b13dce38712bee0af1a5ae3de5c5172 to your computer and use it in GitHub Desktop.
"use client";
import { motion } from "framer-motion";
export const AnimatedCard = () => {
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -20 }}
transition={{
duration: 0.3,
type: "spring",
stiffness: 260,
damping: 20,
}}
whileHover={{ scale: 1.05 }}
className="p-6 bg-white rounded-xl shadow-lg"
>
<h3 className="text-xl font-bold">动效卡片</h3>
<p>优雅的弹性动画效果</p>
</motion.div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment