缩放淡入
元素从缩小状态放大至原始尺寸并淡入,适合卡片、弹窗等组件入场。
交互预览
动效定义与代码
{
"slug": "scale-in",
"name": "缩放淡入",
"nameEn": "Scale In",
"description": "元素从缩小状态放大至原始尺寸并淡入,适合卡片、弹窗等组件入场。",
"descriptionEn": "Element scales up from a smaller size while fading in. Great for cards, modals, and tooltips.",
"category": "entrance",
"tags": [
"scale",
"zoom",
"entrance",
"mount"
],
"trigger": "on-mount",
"difficulty": "beginner",
"duration": "400ms",
"easing": "cubic-bezier(0.16, 1, 0.3, 1)",
"cssProperties": [
"opacity",
"transform"
],
"isGPUAccelerated": true,
"previewBg": "light",
"keywords": [
"scale",
"zoom in",
"entrance",
"grow",
"expand"
],
"useCases": [
"Modal/dialog entrance",
"Tooltip appearance",
"Image gallery reveal",
"Notification popup"
],
"relatedAnimations": [
"fade-in-up",
"blur-in"
],
"recommendedStyles": [
"neumorphism",
"soft-ui",
"claymorphism"
],
"codeSnippets": [
{
"label": "CSS Keyframes",
"language": "css",
"code": "@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.9);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.scale-in {\n --sk-duration: 400ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n animation: scale-in var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .scale-in {\n animation: none;\n opacity: 1;\n transform: none;\n }\n}"
},
{
"label": "Tailwind CSS",
"language": "css",
"code": "@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.9);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@utility animate-scale-in {\n --sk-duration: 400ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n animation: scale-in var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .scale-in {\n animation: none;\n opacity: 1;\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, scale: 0.9 } for initial\n\n<motion.div\n initial={{ opacity: 0, scale: 0.9 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={{ duration: 0.4, ease: [0.16, 1, 0.3, 1] }}\n>\n Content\n</motion.div>"
}
]
}