Skip to content

Commit 576987d

Browse files
committed
🦄 Effect: Added Floaty Effect
1 parent 930b51f commit 576987d

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React, { ReactNode } from "react";
2+
import { motion } from "framer-motion";
3+
4+
interface FloatyEffectProps {
5+
children: ReactNode;
6+
}
7+
8+
const FloatyEffect = ({ children }: FloatyEffectProps) => {
9+
const floatyVariants = {
10+
float: {
11+
y: [0, -20, 20, 0],
12+
x: [0, -6, 6, -6, 6, 0],
13+
rotate: [0, -1, 1, -1, 1, 0],
14+
transition: {
15+
y: {
16+
duration: 4,
17+
repeat: Infinity,
18+
repeatType: "reverse",
19+
ease: "easeInOut",
20+
},
21+
x: {
22+
duration: 6,
23+
repeat: Infinity,
24+
repeatType: "mirror",
25+
ease: "easeInOut",
26+
},
27+
rotate: {
28+
duration: 8,
29+
repeat: Infinity,
30+
repeatType: "mirror",
31+
ease: "easeInOut",
32+
},
33+
},
34+
},
35+
};
36+
37+
return (
38+
<motion.div variants={floatyVariants} animate="float">
39+
{children}
40+
</motion.div>
41+
);
42+
};
43+
44+
export default FloatyEffect;

0 commit comments

Comments
 (0)