Skip to content

Commit acd38fd

Browse files
CopilotJusterZhu
andcommitted
Improve animations with GPU acceleration and remove inline styles
Co-authored-by: JusterZhu <11714536+JusterZhu@users.noreply.github.com>
1 parent 2482051 commit acd38fd

2 files changed

Lines changed: 53 additions & 13 deletions

File tree

website/src/pages/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ function CosmicHero() {
1414
<div className={styles.planets}></div>
1515
<div className={styles.satellite}></div>
1616
<div className={styles.shootingStar}></div>
17-
<div className={styles.shootingStar} style={{ animationDelay: '3s', top: '30%' }}></div>
18-
<div className={styles.shootingStar} style={{ animationDelay: '5.5s', top: '60%' }}></div>
17+
<div className={styles.shootingStar2}></div>
18+
<div className={styles.shootingStar3}></div>
1919
</div>
2020
<div className={styles.heroContent}>
2121
<div className={styles.pixelLogo}>

website/src/pages/index.module.css

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@
230230

231231
@keyframes float {
232232
0%, 100% {
233-
transform: translateY(0px) translateX(0px);
233+
transform: translate3d(0, 0, 0);
234234
}
235235
50% {
236-
transform: translateY(-25px) translateX(10px);
236+
transform: translate3d(10px, -25px, 0);
237237
}
238238
}
239239

@@ -279,19 +279,19 @@
279279

280280
@keyframes satelliteOrbit {
281281
0% {
282-
transform: translate(0, 0) rotate(0deg);
282+
transform: translate3d(0, 0, 0) rotate(0deg);
283283
}
284284
25% {
285-
transform: translate(60px, -30px) rotate(90deg);
285+
transform: translate3d(60px, -30px, 0) rotate(90deg);
286286
}
287287
50% {
288-
transform: translate(80px, 20px) rotate(180deg);
288+
transform: translate3d(80px, 20px, 0) rotate(180deg);
289289
}
290290
75% {
291-
transform: translate(40px, 50px) rotate(270deg);
291+
transform: translate3d(40px, 50px, 0) rotate(270deg);
292292
}
293293
100% {
294-
transform: translate(0, 0) rotate(360deg);
294+
transform: translate3d(0, 0, 0) rotate(360deg);
295295
}
296296
}
297297

@@ -315,25 +315,65 @@
315315
opacity: 0;
316316
}
317317

318+
.shootingStar2 {
319+
position: absolute;
320+
top: 30%;
321+
right: 10%;
322+
width: 4px;
323+
height: 4px;
324+
background: #fff;
325+
box-shadow:
326+
0 0 0 4px #fff,
327+
4px 4px 0 4px rgba(255, 255, 255, 0.9),
328+
8px 8px 0 4px rgba(255, 255, 255, 0.7),
329+
12px 12px 0 4px rgba(255, 255, 255, 0.5),
330+
16px 16px 0 4px rgba(255, 255, 255, 0.3),
331+
20px 20px 0 4px rgba(255, 255, 255, 0.1),
332+
0 0 15px rgba(255, 255, 255, 0.8);
333+
animation: shootingStar 6s ease-in infinite;
334+
animation-delay: 3s;
335+
opacity: 0;
336+
}
337+
338+
.shootingStar3 {
339+
position: absolute;
340+
top: 60%;
341+
right: 10%;
342+
width: 4px;
343+
height: 4px;
344+
background: #fff;
345+
box-shadow:
346+
0 0 0 4px #fff,
347+
4px 4px 0 4px rgba(255, 255, 255, 0.9),
348+
8px 8px 0 4px rgba(255, 255, 255, 0.7),
349+
12px 12px 0 4px rgba(255, 255, 255, 0.5),
350+
16px 16px 0 4px rgba(255, 255, 255, 0.3),
351+
20px 20px 0 4px rgba(255, 255, 255, 0.1),
352+
0 0 15px rgba(255, 255, 255, 0.8);
353+
animation: shootingStar 6s ease-in infinite;
354+
animation-delay: 5.5s;
355+
opacity: 0;
356+
}
357+
318358
@keyframes shootingStar {
319359
0% {
320360
opacity: 0;
321-
transform: translateX(0) translateY(0) rotate(45deg);
361+
transform: translate3d(0, 0, 0) rotate(45deg);
322362
}
323363
5% {
324364
opacity: 1;
325365
}
326366
15% {
327367
opacity: 1;
328-
transform: translateX(-300px) translateY(300px) rotate(45deg);
368+
transform: translate3d(-300px, 300px, 0) rotate(45deg);
329369
}
330370
20% {
331371
opacity: 0;
332-
transform: translateX(-400px) translateY(400px) rotate(45deg);
372+
transform: translate3d(-400px, 400px, 0) rotate(45deg);
333373
}
334374
100% {
335375
opacity: 0;
336-
transform: translateX(-400px) translateY(400px) rotate(45deg);
376+
transform: translate3d(-400px, 400px, 0) rotate(45deg);
337377
}
338378
}
339379

0 commit comments

Comments
 (0)