mirror of
https://github.com/aljazceru/hypergolic.git
synced 2026-02-04 13:14:24 +01:00
21 lines
538 B
Svelte
21 lines
538 B
Svelte
<script lang="ts">
|
|
import { onMount } from 'svelte';
|
|
import { expoInOut } from 'svelte/easing';
|
|
import { tweened } from 'svelte/motion';
|
|
|
|
export let targetValue: number;
|
|
|
|
let currentValue = tweened(0, { duration: 3000, easing: expoInOut });
|
|
|
|
// Re-trigger animation whenever targetValue changes
|
|
$: if (targetValue !== undefined && targetValue !== null) {
|
|
currentValue.set(targetValue);
|
|
}
|
|
|
|
onMount(() => {
|
|
currentValue.set(targetValue);
|
|
});
|
|
</script>
|
|
|
|
<span class="merits">{Math.floor($currentValue).toLocaleString()}</span>
|