淡出下滑
元素向下滑动并逐渐消失,最常见的退场动画之一。
交互预览
动效定义与代码
{
"slug": "fade-out-down",
"name": "淡出下滑",
"nameEn": "Fade Out Down",
"description": "元素向下滑动并逐渐消失,最常见的退场动画之一。",
"descriptionEn": "Element fades out while sliding downward. One of the most common exit animations.",
"category": "exit",
"tags": [
"fade",
"slide",
"exit",
"unmount"
],
"trigger": "manual",
"difficulty": "beginner",
"duration": "400ms",
"easing": "cubic-bezier(0.4, 0, 1, 1)",
"cssProperties": [
"opacity",
"transform"
],
"isGPUAccelerated": true,
"previewBg": "light",
"keywords": [
"fade out",
"slide down",
"exit",
"leave",
"unmount animation"
],
"useCases": [
"Modal dismiss",
"Toast notification exit",
"Dropdown close",
"Card removal"
],
"relatedAnimations": [
"fade-in-up",
"fade-in-down"
],
"recommendedStyles": [
"glassmorphism",
"minimalist-flat",
"soft-ui"
],
"codeSnippets": [
{
"label": "CSS Keyframes",
"language": "css",
"code": "@keyframes fade-out-down {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(20px);\n }\n}\n\n.fade-out-down {\n --sk-duration: 400ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.4, 0, 1, 1);\n will-change: transform, opacity;\n animation: fade-out-down var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fade-out-down {\n animation: none;\n opacity: 0;\n transform: none;\n }\n}"
},
{
"label": "Tailwind CSS",
"language": "css",
"code": "/* Add to your global CSS or Tailwind v4 theme */\n@keyframes fade-out-down {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(20px);\n }\n}\n\n@utility animate-fade-out-down {\n --sk-duration: 400ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.4, 0, 1, 1);\n will-change: transform, opacity;\n animation: fade-out-down var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fade-out-down {\n animation: none;\n opacity: 0;\n transform: none;\n }\n}"
},
{
"label": "Framer Motion",
"language": "tsx",
"code": "import { motion } from \"framer-motion\";\n\n// Tip: respect user's motion preferences\n// import { useReducedMotion } from \"framer-motion\";\n// const reduced = useReducedMotion();\n// Use reduced ? { opacity: 0 } : { opacity: 0, y: 20 } for exit\n\n<motion.div\n initial={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: 20 }}\n transition={{ duration: 0.4, ease: [0.4, 0, 1, 1] }}\n>\n Content\n</motion.div>"
}
]
}