Skip to content

Commit af494ef

Browse files
DaHyeonDaHyeon
authored andcommitted
Design : 대포 게임 스타일 변경
1 parent d41f961 commit af494ef

2 files changed

Lines changed: 139 additions & 57 deletions

File tree

src/components/BattleAnimation.tsx

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,34 @@ interface BattleProps {
77
}
88

99
export default function Battle({ fire, explode, result }: BattleProps) {
10-
// 아무 상태도 아니면 렌더링 안 함
11-
if (!fire && !explode) return null;
10+
if (!fire && !explode && !result) return null;
1211

1312
return (
14-
<div className="battle-field">
15-
{/* 대포 */}
16-
<div className={`cannon ${fire ? "fire" : ""}`}>🧨</div>
13+
<div className="battle-overlay">
14+
<div className="battle-stage">
15+
{/* 대포 */}
16+
<div className={`cannon ${fire ? "fire" : ""}`}>
17+
🧨
18+
</div>
1719

18-
{/* 포탄 */}
19-
{fire && <div className="bullet" />}
20+
{/* 포탄 */}
21+
{fire && <div className="bullet" />}
2022

21-
{/* 폭발 */}
22-
{explode && (
23-
<div className="explosion">
24-
💥
25-
<div className="result-text">{result}</div>
26-
</div>
27-
)}
23+
{/* 폭발 */}
24+
{explode && (
25+
<div className="explosion">
26+
💥
27+
</div>
28+
)}
29+
30+
{/* 결과 */}
31+
{result && !fire && !explode && (
32+
<div className="result-card">
33+
<p className="result-label">🎯 선택된 참가자</p>
34+
<h2 className="result-name">{result}</h2>
35+
</div>
36+
)}
37+
</div>
2838
</div>
2939
);
3040
}

src/styles/cannon.css

Lines changed: 115 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,149 @@
11
.battle-field {
22
position: fixed;
33
inset: 0;
4-
background: radial-gradient(circle at bottom left, #111, #000);
5-
overflow: hidden;
64
z-index: 9999;
5+
overflow: hidden;
6+
7+
/* 더 깊이 있는 배경 */
8+
background:
9+
radial-gradient(circle at 15% 85%, rgba(255, 171, 93, 0.18), transparent 55%),
10+
radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.08), transparent 50%),
11+
radial-gradient(circle at bottom left, #141414, #000);
12+
13+
/* 살짝 블러/필름 느낌 */
14+
backdrop-filter: blur(2px);
15+
}
16+
17+
/* 바닥 라인(무대감) */
18+
.battle-field::after {
19+
content: "";
20+
position: absolute;
21+
left: 0;
22+
right: 0;
23+
bottom: 46px;
24+
height: 2px;
25+
background: linear-gradient(to right, transparent, rgba(255,255,255,0.18), transparent);
26+
opacity: 0.7;
727
}
828

29+
/* 대포 */
930
.cannon {
1031
position: absolute;
11-
bottom: 60px;
12-
left: 60px;
32+
bottom: 56px;
33+
left: 56px;
1334
font-size: 64px;
14-
transform-origin: center;
35+
transform-origin: 60% 60%;
36+
filter: drop-shadow(0 12px 18px rgba(0,0,0,0.45));
1537
}
1638

39+
/* 반동 + 살짝 회전 */
1740
.cannon.fire {
18-
animation: recoil 0.3s ease-out;
41+
animation: recoil 0.28s ease-out;
1942
}
2043

2144
@keyframes recoil {
22-
0% { transform: translateX(0); }
23-
50% { transform: translateX(-15px); }
24-
100% { transform: translateX(0); }
45+
0% { transform: translateX(0) rotate(0deg); }
46+
45% { transform: translateX(-14px) rotate(-8deg); }
47+
100% { transform: translateX(0) rotate(0deg); }
2548
}
2649

50+
/* 포탄: 더 “탄환” 느낌 + 궤적 */
2751
.bullet {
2852
position: absolute;
29-
bottom: 90px;
30-
left: 110px;
31-
width: 18px;
32-
height: 18px;
33-
background: orange;
34-
border-radius: 50%;
35-
box-shadow: 0 0 12px orange;
36-
animation: fly 0.8s linear forwards;
53+
bottom: 92px;
54+
left: 118px;
55+
width: 14px;
56+
height: 14px;
57+
border-radius: 999px;
58+
59+
background: radial-gradient(circle at 30% 30%, #ffe7c8, #ffab5d 35%, #ff7a18 75%);
60+
box-shadow:
61+
0 0 14px rgba(255, 171, 93, 0.95),
62+
0 0 28px rgba(255, 122, 24, 0.55);
63+
64+
/* 꼬리 잔상 */
65+
filter: drop-shadow(0 0 10px rgba(255, 171, 93, 0.55));
66+
67+
animation: fly 0.85s cubic-bezier(0.22, 1, 0.36, 1) forwards;
68+
}
69+
70+
/* 궤적(트레일) */
71+
.bullet::before {
72+
content: "";
73+
position: absolute;
74+
left: -36px;
75+
top: 50%;
76+
transform: translateY(-50%);
77+
width: 36px;
78+
height: 3px;
79+
border-radius: 999px;
80+
background: linear-gradient(to right, transparent, rgba(255,171,93,0.85));
81+
opacity: 0.9;
3782
}
3883

84+
/* 화면 크기 따라 대충 그럴듯한 포물선 */
3985
@keyframes fly {
40-
0% {
41-
transform: translate(0, 0);
42-
}
43-
100% {
44-
transform: translate(calc(100vw - 200px), -300px);
45-
}
86+
0% { transform: translate(0, 0) scale(1); }
87+
35% { transform: translate(calc(45vw - 120px), -240px) scale(1.05); }
88+
100% { transform: translate(calc(100vw - 260px), -320px) scale(0.95); }
4689
}
4790

91+
/* 폭발: 위치 약간 조정 + 글로우 */
4892
.explosion {
4993
position: absolute;
50-
top: 35%;
51-
right: 20%;
52-
font-size: 80px;
53-
animation: explode 0.4s ease-out;
94+
top: 32%;
95+
right: 16%;
96+
font-size: 88px;
5497
text-align: center;
98+
99+
filter:
100+
drop-shadow(0 0 18px rgba(255, 171, 93, 0.35))
101+
drop-shadow(0 0 28px rgba(255, 0, 0, 0.25));
102+
103+
animation: explode 0.45s ease-out;
55104
}
56105

57106
@keyframes explode {
58-
0% {
59-
transform: scale(0.3);
60-
opacity: 0;
61-
}
62-
60% {
63-
transform: scale(1.4);
64-
opacity: 1;
65-
}
66-
100% {
67-
transform: scale(1);
68-
}
107+
0% { transform: scale(0.4); opacity: 0; }
108+
60% { transform: scale(1.35); opacity: 1; }
109+
100% { transform: scale(1); opacity: 1; }
69110
}
70111

112+
/* 결과 텍스트: 폭발 아래 “카드”처럼 */
71113
.result-text {
72-
margin-top: 16px;
73-
font-size: 36px;
74-
font-weight: bold;
114+
margin-top: 14px;
115+
display: inline-block;
116+
117+
padding: 10px 14px;
118+
border-radius: 14px;
119+
120+
font-size: 28px;
121+
font-weight: 800;
122+
letter-spacing: -0.3px;
123+
75124
color: #fff;
76-
text-shadow: 0 0 10px red;
77-
}
125+
background: rgba(0, 0, 0, 0.45);
126+
border: 1px solid rgba(255, 255, 255, 0.12);
127+
128+
box-shadow:
129+
0 12px 30px rgba(0,0,0,0.35),
130+
0 0 16px rgba(255, 0, 0, 0.20);
131+
132+
text-shadow: 0 0 10px rgba(255, 60, 60, 0.55);
133+
134+
/* 살짝 뜨는 애니메이션 */
135+
animation: resultPop 0.22s ease-out;
136+
}
137+
138+
@keyframes resultPop {
139+
from { transform: translateY(6px); opacity: 0; }
140+
to { transform: translateY(0); opacity: 1; }
141+
}
142+
143+
/* 모바일 대응: 폭발 위치/텍스트 크기 조정 */
144+
@media (max-width: 480px) {
145+
.cannon { left: 22px; bottom: 44px; font-size: 56px; }
146+
.bullet { left: 78px; bottom: 78px; }
147+
.explosion { right: 10%; top: 30%; font-size: 76px; }
148+
.result-text { font-size: 22px; padding: 9px 12px; }
149+
}

0 commit comments

Comments
 (0)