Skip to content

Commit 362ed00

Browse files
committed
fix: enhance marquee component layout and animation for better performance
1 parent ad53a31 commit 362ed00

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/components/design/Marquee.vue

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@
99
role="marquee"
1010
>
1111
<h4
12+
v-for="_ in 2"
13+
:id="`marquee-item-${_}`"
14+
:key="`marquee-item-${_}`"
1215
class="sm:heading-1 flex w-full items-center text-3xl font-bold text-nowrap whitespace-nowrap max-sm:mx-6"
1316
>
1417
Full Stack Developer
15-
<div class="ms-1 w-fit scale-50 sm:scale-75">
18+
<div class="w-fit scale-50 sm:scale-75">
1619
<svg
20+
class="ms-10 me-10"
1721
style="width: var(--heading-display)"
1822
viewBox="0 0 100 101"
1923
xmlns="http://www.w3.org/2000/svg"
@@ -32,11 +36,15 @@
3236
role="marquee"
3337
>
3438
<h4
39+
v-for="_ in 2"
40+
:id="`marquee-item-${_}`"
41+
:key="`marquee-item-${_}`"
3542
class="sm:heading-1 flex w-full items-center text-3xl font-bold text-nowrap whitespace-nowrap max-sm:mx-6"
3643
>
3744
Full Stack Developer
3845
<div class="mx-2 inline-block scale-50 sm:scale-75">
3946
<svg
47+
class="ms-10 me-10"
4048
style="width: var(--heading-display)"
4149
viewBox="0 0 100 101"
4250
xmlns="http://www.w3.org/2000/svg"
@@ -91,22 +99,19 @@
9199
duration: duration,
92100
ease: 'none',
93101
repeat: -1,
94-
modifiers: {
95-
x: gsap.utils.unitize((x) => {
96-
return x % (itemWidth * cloneCount);
97-
}),
98-
},
99102
});
100103
};
101104
onMounted(() => {
102-
createMarquee('#marquee-1', 1, 25);
103-
createMarquee('#marquee-2', -1, 25);
105+
createMarquee('#marquee-1', 1, 50);
106+
createMarquee('#marquee-2', -1, 50);
104107
105108
const tl = gsap.timeline({
106109
scrollTrigger: {
110+
markers: !true,
111+
107112
trigger: '#marquee-section',
108-
start: 'top 65%',
109-
end: 'bottom center',
113+
start: 'top 75%',
114+
end: 'center 75%',
110115
scrub: 0.1,
111116
},
112117
});

0 commit comments

Comments
 (0)