Skip to content

Commit 2965cc4

Browse files
committed
Merge remote-tracking branch 'origin/main' into next
2 parents 874c277 + 4eb62c8 commit 2965cc4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

www/src/components/fade-in.tsx

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"use client";
2+
3+
import { motion, HTMLMotionProps, type Variants } from "framer-motion";
4+
5+
const container: Variants = {
6+
hidden: {},
7+
show: {
8+
transition: {
9+
staggerChildren: 0.1,
10+
},
11+
},
12+
};
13+
14+
const item = (y: boolean): Variants => ({
15+
hidden: {
16+
opacity: 0,
17+
y: y ? 16 : 0,
18+
filter: "blur(10px)",
19+
},
20+
show: {
21+
opacity: 1,
22+
scale: 1,
23+
y: 0,
24+
filter: "blur(0px)",
25+
transition: {
26+
type: "spring",
27+
stiffness: 150,
28+
damping: 19,
29+
mass: 1.2,
30+
},
31+
},
32+
});
33+
34+
function Container(props: HTMLMotionProps<"div">) {
35+
return (
36+
<motion.div
37+
variants={container}
38+
initial="hidden"
39+
animate="show"
40+
{...props}
41+
/>
42+
);
43+
}
44+
45+
function Item({
46+
translateAnimation = true,
47+
...props
48+
}: { translateAnimation?: boolean } & HTMLMotionProps<"div">) {
49+
return <motion.div variants={item(translateAnimation)} {...props} />;
50+
}
51+
52+
export { Container, Item };

0 commit comments

Comments
 (0)