Skip to content

Commit d68beb7

Browse files
committed
design: LeafAnimation 추가
1 parent 0027045 commit d68beb7

File tree

2 files changed

+136
-2
lines changed

2 files changed

+136
-2
lines changed

src/app/(home)/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import Lenis from "@studio-freight/lenis";
77
import { useMediaQuery } from "react-responsive";
88
import TypewriterText from "../components/animation/TypewriterText";
99
import { IoIosArrowDown } from "react-icons/io";
10+
import LeafAnimation from "../components/animation/LeafAnimation";
1011

1112
const slides = [
1213
{
@@ -203,7 +204,7 @@ export default function LandingPage() {
203204
alt="Brand Logo"
204205
width={800}
205206
height={800}
206-
className="h-full max-h-[800px] w-full max-w-[800px] object-contain"
207+
className="h-full max-h-[600px] w-full max-w-[600px] object-contain"
207208
priority
208209
/>
209210
) : currentSlide === 4 || currentSlide === 5 ? (
@@ -294,7 +295,6 @@ export default function LandingPage() {
294295
className={`relative z-40 flex ${isLargeScreen ? "w-1/2" : "h-1/2 w-full"}`}
295296
style={{
296297
background: "linear-gradient(135deg, #71db77 0%, #56c45d 100%)",
297-
boxShadow: "0 4px 60px rgba(113, 219, 119, 0.4)",
298298
}}
299299
initial={{ width: 0 }}
300300
animate={{ width: isLargeScreen ? "50%" : "100%" }}
@@ -388,6 +388,7 @@ export default function LandingPage() {
388388
))}
389389
</motion.div>
390390
)}
391+
<LeafAnimation />
391392
</motion.div>
392393
)}
393394
</AnimatePresence>
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import { motion } from "framer-motion";
2+
import React from "react";
3+
4+
// 유틸리티 함수들
5+
const getLeafSize = (index: number) => {
6+
if (index % 3 === 2) {
7+
return {
8+
height: "17px",
9+
width: "23px",
10+
beforeTop: "12px",
11+
beforeRight: "1px",
12+
beforeHeight: "4px",
13+
beforeWidth: "4px",
14+
afterHeight: "10px",
15+
afterWidth: "2px",
16+
afterLeft: "8px",
17+
afterTop: "1px",
18+
};
19+
} else if (index % 2 === 1) {
20+
return {
21+
height: "11px",
22+
width: "16px",
23+
beforeTop: "7px",
24+
beforeRight: "0px",
25+
beforeHeight: "3px",
26+
beforeWidth: "4px",
27+
afterHeight: "6px",
28+
afterWidth: "2px",
29+
afterLeft: "5px",
30+
afterTop: "1px",
31+
};
32+
}
33+
return {
34+
height: "23px",
35+
width: "30px",
36+
beforeTop: "17px",
37+
beforeRight: "1px",
38+
beforeHeight: "5px",
39+
beforeWidth: "7px",
40+
afterHeight: "17px",
41+
afterWidth: "2px",
42+
afterLeft: "12px",
43+
afterTop: "0px",
44+
};
45+
};
46+
47+
const getLeafGradient = (index: number) => {
48+
if (index % 4 === 1) {
49+
return "linear-gradient(to bottom right, #990, #564500)";
50+
} else if (index % 2 === 0) {
51+
return "linear-gradient(to bottom right, #5e9900, #2b5600)";
52+
}
53+
return "linear-gradient(to bottom right, #309900, #005600)";
54+
};
55+
56+
const getLeafDelay = (index: number) => {
57+
const delays = [1.9, 3.9, 2.3, 4.4, 5, 3.5, 2.8, 1.5, 3.3, 2.5, 1.2, 4.1, 1, 4.7, 3];
58+
return delays[index % delays.length];
59+
};
60+
61+
const LeafAnimation: React.FC = () => {
62+
return (
63+
<div className="pointer-events-none fixed inset-0 z-50 overflow-hidden">
64+
<motion.div
65+
className="absolute -top-12 w-full text-right"
66+
initial={{ opacity: 0 }}
67+
animate={{ opacity: 1 }}
68+
transition={{ duration: 1 }}
69+
>
70+
{[...Array(15)].map((_, i) => (
71+
<motion.i
72+
key={i}
73+
className={`relative inline-block opacity-70 ${i % 3 === 1 ? "opacity-50" : ""} ${
74+
i % 3 === 2 ? "opacity-30" : ""
75+
}`}
76+
style={{
77+
height: getLeafSize(i).height,
78+
width: getLeafSize(i).width,
79+
background: getLeafGradient(i),
80+
borderRadius: "5% 40% 70%",
81+
boxShadow: "inset 0px 0px 1px #222",
82+
border: "1px solid #333",
83+
transform: "rotate(180deg)",
84+
}}
85+
animate={{
86+
x: [300, -350],
87+
y: [0, 700],
88+
rotate: [0, 90],
89+
opacity: [null, 0],
90+
}}
91+
transition={{
92+
duration: 5,
93+
repeat: Infinity,
94+
delay: getLeafDelay(i),
95+
ease: "easeInOut",
96+
}}
97+
>
98+
<motion.span
99+
className="absolute"
100+
style={{
101+
content: '""',
102+
top: getLeafSize(i).beforeTop,
103+
right: getLeafSize(i).beforeRight,
104+
height: getLeafSize(i).beforeHeight,
105+
width: getLeafSize(i).beforeWidth,
106+
transform: "rotate(49deg)",
107+
borderRadius: "0% 15% 15% 0%",
108+
border: "1px solid #222",
109+
borderLeft: "none",
110+
background: "linear-gradient(to right, rgba(0,100,0,1), #005600)",
111+
}}
112+
/>
113+
<motion.span
114+
className="absolute"
115+
style={{
116+
content: '""',
117+
height: getLeafSize(i).afterHeight,
118+
width: getLeafSize(i).afterWidth,
119+
background: "linear-gradient(to right, rgba(0,0,0,.15), rgba(0,0,0,0))",
120+
transform: "rotate(125deg)",
121+
left: getLeafSize(i).afterLeft,
122+
top: getLeafSize(i).afterTop,
123+
borderRadius: "50%",
124+
}}
125+
/>
126+
</motion.i>
127+
))}
128+
</motion.div>
129+
</div>
130+
);
131+
};
132+
133+
export default LeafAnimation;

0 commit comments

Comments
 (0)