Created
January 19, 2026 09:59
-
-
Save bonrow/e929ee5eb3b612d550fb72b820ca7e51 to your computer and use it in GitHub Desktop.
A portable react component to render a blurry fade-in from bottom animation, using motion/react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use client"; | |
| import { motion, type Transition, type Variants } from "motion/react"; | |
| import type React from "react"; | |
| const fadeVariants = Object.freeze({ | |
| hidden: { opacity: 0, y: 15, filter: "blur(3px)" }, | |
| shown: { opacity: 1, y: 0, filter: "blur(0)" }, | |
| }) satisfies Variants; | |
| const fadeTransition = Object.freeze({ | |
| type: "spring", | |
| bounce: 0, | |
| duration: 1, | |
| }) satisfies Transition; | |
| export function BlurryFadeInWrapper({ | |
| delay, | |
| ...restProps | |
| }: React.ComponentProps<typeof motion.div> & { | |
| /* Alternative to staggerChildren */ | |
| delay?: number; | |
| }) { | |
| return ( | |
| <motion.div | |
| key="greeting" | |
| variants={fadeVariants} | |
| transition={{ ...fadeTransition, delay }} | |
| initial="hidden" | |
| animate="shown" | |
| {...restProps} | |
| /> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment