Skip to content

Commit

Permalink
Improve localization scrolling animation
Browse files Browse the repository at this point in the history
  • Loading branch information
mircearoata committed Oct 7, 2024
1 parent 3b839b0 commit b2008f6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/lib/components/Marquee.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { onDestroy } from 'svelte';
import { cubicInOut } from 'svelte/easing';
import { sineInOut } from 'svelte/easing';
import { type Tweened, tweened } from 'svelte/motion';
let running = false;
Expand All @@ -22,7 +22,10 @@
const visibleWidth = element?.clientWidth || totalWidth;
scrollableWidth = totalWidth - visibleWidth;
animationDuration = scrollableWidth / animationSpeed * 1000;
hoverTranslation = tweened(0, { duration: animationDuration, easing: cubicInOut });
if (scrollableWidth < 2) {
animationDuration = 0;
}
hoverTranslation = tweened(0, { duration: animationDuration, easing: sineInOut });
}
$: {
Expand Down

0 comments on commit b2008f6

Please sign in to comment.