远景拉近
元素从远处快速拉近至原始尺寸,带有强烈的纵深感和冲击力。
交互预览
动效定义与代码
{
"slug": "zoom-in",
"name": "远景拉近",
"nameEn": "Zoom In",
"description": "元素从远处快速拉近至原始尺寸,带有强烈的纵深感和冲击力。",
"descriptionEn": "Element zooms in from a distance to its original size with a strong sense of depth.",
"category": "entrance",
"tags": [
"zoom",
"scale",
"entrance",
"depth"
],
"trigger": "on-mount",
"difficulty": "beginner",
"duration": "500ms",
"easing": "cubic-bezier(0.16, 1, 0.3, 1)",
"cssProperties": [
"opacity",
"transform"
],
"isGPUAccelerated": true,
"previewBg": "light",
"keywords": [
"zoom",
"scale up",
"entrance",
"depth",
"camera"
],
"useCases": [
"Hero image entrance",
"Lightbox open",
"Image gallery focus",
"Feature highlight"
],
"relatedAnimations": [
"scale-in",
"blur-in"
],
"recommendedStyles": [
"dark-mode",
"modern-gradient",
"glassmorphism"
],
"codeSnippets": [
{
"label": "CSS Keyframes",
"language": "css",
"code": "@keyframes zoom-in {\n from {\n opacity: 0;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n.zoom-in {\n --sk-duration: 500ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n animation: zoom-in var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .zoom-in {\n animation: none;\n opacity: 1;\n transform: none;\n }\n}"
},
{
"label": "Tailwind CSS",
"language": "css",
"code": "/* Add to your global CSS or Tailwind v4 theme */\n@keyframes zoom-in {\n from {\n opacity: 0;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n\n@utility animate-zoom-in {\n --sk-duration: 500ms;\n --sk-delay: 0ms;\n --sk-ease: cubic-bezier(0.16, 1, 0.3, 1);\n will-change: transform, opacity;\n animation: zoom-in var(--sk-duration) var(--sk-ease) var(--sk-delay) both;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .zoom-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.5 } for initial\n\n<motion.div\n initial={{ opacity: 0, scale: 0.5 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={{ duration: 0.5, ease: [0.16, 1, 0.3, 1] }}\n>\n Content\n</motion.div>"
}
]
}