2023-02-14 05:02:41 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<span>{{ number(Math.floor(tweened.number)) }}</span>
|
2023-02-14 05:02:41 +01:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2023-04-08 02:01:42 +02:00
|
|
|
import { ref, reactive, watch } from "vue";
|
|
|
|
import gsap from "gsap";
|
|
|
|
import number from "@/filters/number";
|
2023-02-14 05:02:41 +01:00
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
value: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const tweened = reactive({
|
|
|
|
number: 0,
|
|
|
|
});
|
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
watch(
|
|
|
|
() => props.value,
|
|
|
|
(n) => {
|
|
|
|
gsap.to(tweened, { duration: 0.6, number: Number(n) || 0 });
|
|
|
|
},
|
|
|
|
{
|
|
|
|
immediate: true,
|
2023-07-06 03:28:27 +02:00
|
|
|
},
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2023-02-14 05:02:41 +01:00
|
|
|
</script>
|