2023-02-14 04:02:41 +00:00
|
|
|
<template>
|
|
|
|
<span>{{ number(Math.floor(tweened.number)) }}</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref, reactive, watch } from 'vue';
|
|
|
|
import gsap from 'gsap';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
value: number;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const tweened = reactive({
|
|
|
|
number: 0,
|
|
|
|
});
|
|
|
|
|
|
|
|
watch(() => props.value, (n) => {
|
2023-02-15 18:34:17 +00:00
|
|
|
gsap.to(tweened, { duration: 0.6, number: Number(n) || 0 });
|
2023-02-14 04:02:41 +00:00
|
|
|
}, {
|
|
|
|
immediate: true,
|
|
|
|
});
|
|
|
|
</script>
|