Skip to content

Commit 5a84791

Browse files
committed
feat: 밈퀴즈 시작 화면 애니메이션 추가
- MemeQuizStart 컴포넌트에 애니메이션 효과를 추가하여 사용자 경험을 향상시킴 - styled-components를 motion.div로 변경하여 애니메이션 적용 가능하도록 수정함
1 parent 8d97e41 commit 5a84791

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

apps/web/src/pages/MemeQuizPage/components/MemeQuizStart/MemeQuizStart.styles.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import styled from '@emotion/styled';
2+
import { motion } from 'motion/react';
23

3-
const Container = styled.div`
4+
const Container = styled(motion.div)`
45
position: relative;
56
width: 100%;
67
height: 100%;
@@ -14,7 +15,7 @@ const Container = styled.div`
1415
);
1516
`;
1617

17-
const TextSection = styled.div`
18+
const TextSection = styled(motion.div)`
1819
margin-top: 158px;
1920
text-align: center;
2021
width: 100%;
@@ -33,7 +34,7 @@ const Subtitle = styled.p`
3334
color: ${({ theme }) => theme.palette.common.white};
3435
`;
3536

36-
const IconSection = styled.div`
37+
const IconSection = styled(motion.div)`
3738
margin-top: 61px;
3839
width: 100%;
3940
height: 240px;
@@ -42,7 +43,7 @@ const IconSection = styled.div`
4243
align-items: center;
4344
`;
4445

45-
const ButtonWrapper = styled.div`
46+
const ButtonWrapper = styled(motion.div)`
4647
position: fixed;
4748
bottom: 0;
4849
left: 0;

apps/web/src/pages/MemeQuizPage/components/MemeQuizStart/index.tsx

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,58 @@ import {
88
ButtonWrapper,
99
StartButton,
1010
} from './MemeQuizStart.styles';
11+
import { AnimatePresence } from 'motion/react';
1112

1213
interface MemeQuizStartProps {
1314
onNext: () => void;
1415
}
1516

1617
const MemeQuizStart = ({ onNext }: MemeQuizStartProps) => {
1718
return (
18-
<Container>
19-
<TextSection>
19+
<Container
20+
initial={{ opacity: 0 }}
21+
animate={{ opacity: 1 }}
22+
transition={{ duration: 0.5 }}
23+
>
24+
<TextSection
25+
initial={{ opacity: 0, y: 30 }}
26+
animate={{ opacity: 1, y: 0 }}
27+
transition={{ duration: 0.6, delay: 0.2 }}
28+
>
2029
<Title>{`나 어쩌면 \n밈잘알일지도?!`}</Title>
2130
<Subtitle>과연 나는 밈잘알일까? 밈퀴즈 풀고 알아보자!</Subtitle>
2231
</TextSection>
2332

24-
<IconSection>
33+
<IconSection
34+
initial={{ opacity: 0, scale: 0.8 }}
35+
animate={{ opacity: 1, scale: 1 }}
36+
transition={{
37+
duration: 0.8,
38+
delay: 0.4,
39+
type: 'spring',
40+
bounce: 0.4,
41+
}}
42+
>
2543
<MemeQuizStartIcon />
2644
</IconSection>
2745

28-
<ButtonWrapper>
29-
<StartButton onClick={onNext}>밈퀴즈 시작하기</StartButton>
30-
</ButtonWrapper>
46+
<AnimatePresence>
47+
<ButtonWrapper
48+
initial={{ opacity: 0, y: 40 }}
49+
animate={{ opacity: 1, y: 0 }}
50+
exit={{ opacity: 0, y: 40 }}
51+
transition={{
52+
duration: 0.6,
53+
delay: 0.6,
54+
type: 'spring',
55+
stiffness: 100,
56+
}}
57+
>
58+
<StartButton onClick={onNext} style={{ position: 'relative' }}>
59+
밈퀴즈 시작하기
60+
</StartButton>
61+
</ButtonWrapper>
62+
</AnimatePresence>
3163
</Container>
3264
);
3365
};

0 commit comments

Comments
 (0)