Skip to content

Commit 64a64b9

Browse files
committed
refactor: 페르소나 메시지 애니메이션 구현
1 parent a1afb4c commit 64a64b9

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

src/app/(protected)/immersion/_components/PersonaMessage.tsx

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function PersonaMessage({
2121
}: PersonaMessageProps) {
2222
const [messageType, setMessageType] = useState<TimeMessageType>("start");
2323
const [message, setMessage] = useState<string>("");
24+
const [isAnimated, setIsAnimated] = useState(false);
2425

2526
useEffect(() => {
2627
const updateMessage = () => {
@@ -39,6 +40,9 @@ export default function PersonaMessage({
3940
// 초기 메시지 설정
4041
updateMessage();
4142

43+
// 애니메이션 시작
44+
setIsAnimated(true);
45+
4246
// 1분마다 메시지 업데이트 (필요에 따라 주기 조정)
4347
const intervalId = setInterval(updateMessage, 60 * 1000);
4448

@@ -55,22 +59,47 @@ export default function PersonaMessage({
5559
};
5660

5761
return (
58-
<div
59-
className="s3 flex items-center justify-center whitespace-nowrap rounded-[999px] px-[14px] py-[10px] text-[#BDBDF5]"
60-
style={{
61-
background: "var(--Elevated-PointPriamry, rgba(107, 107, 225, 0.20))",
62-
backdropFilter: "blur(30px)",
63-
}}
64-
>
65-
<Image
66-
src="/icons/onboarding/clap.svg"
67-
alt="박수"
68-
width={16}
69-
height={15}
70-
className="mr-1"
71-
priority
72-
/>
73-
<span>{message}</span>
74-
</div>
62+
<>
63+
<div
64+
className={`s3 flex items-center justify-center whitespace-nowrap rounded-[999px] px-[14px] py-[10px] text-[#BDBDF5] float-up-animation ${isAnimated ? "animated" : ""}`}
65+
style={{
66+
background: "var(--Elevated-PointPriamry, rgba(107, 107, 225, 0.20))",
67+
backdropFilter: "blur(30px)",
68+
}}
69+
>
70+
<Image
71+
src="/icons/onboarding/clap.svg"
72+
alt="박수"
73+
width={16}
74+
height={15}
75+
className="mr-1"
76+
priority
77+
/>
78+
<span>{message}</span>
79+
</div>
80+
81+
{/* 애니메이션 스타일 */}
82+
<style jsx>{`
83+
@keyframes floatUp {
84+
0% {
85+
opacity: 0;
86+
transform: translateY(100px);
87+
}
88+
100% {
89+
opacity: 1;
90+
transform: translateY(0);
91+
}
92+
}
93+
94+
.float-up-animation {
95+
opacity: 0;
96+
transform: translateY(100px);
97+
}
98+
99+
.float-up-animation.animated {
100+
animation: floatUp 1s ease-out forwards;
101+
}
102+
`}</style>
103+
</>
75104
);
76105
}

0 commit comments

Comments
 (0)