From 5f107ad5e835adfad530a5899c0e4bfbe83da354 Mon Sep 17 00:00:00 2001
From: junkwarrior87 <115852752+junkwarrior87@users.noreply.github.com>
Date: Sat, 8 Mar 2025 20:09:47 +0800
Subject: [PATCH] refactor(stage-web): eliminate the need of raf, use pure css
to translate the waves (#55)
---
.../components/Layouts/AnimatedBackground.vue | 52 ++++++++-----------
1 file changed, 23 insertions(+), 29 deletions(-)
diff --git a/apps/stage-web/src/components/Layouts/AnimatedBackground.vue b/apps/stage-web/src/components/Layouts/AnimatedBackground.vue
index a8668e2c0..da97b3483 100644
--- a/apps/stage-web/src/components/Layouts/AnimatedBackground.vue
+++ b/apps/stage-web/src/components/Layouts/AnimatedBackground.vue
@@ -1,6 +1,6 @@
@@ -168,7 +142,12 @@ onUnmounted(() => {
:viewBox="`0 0 ${waveLength * Math.ceil((svgWidth * 2) / waveLength)} ${waveHeight}`"
xmlns="http://www.w3.org/2000/svg"
h="[100%]" w="auto"
- :style="{ willChange: 'transform' }"
+ :style="{
+ 'willChange': 'transform',
+ '--wave-translate': `${-waveLength}px`,
+ '--animation-duration': `${waveLength / animationSpeed}s`,
+ }"
+ class="wave"
>
@@ -176,3 +155,18 @@ onUnmounted(() => {
+
+