mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-12-21 18:18:06 +09:00
28 lines
450 B
Vue
28 lines
450 B
Vue
<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) => {
|
|
gsap.to(tweened, { duration: 0.6, number: Number(n) || 0 });
|
|
},
|
|
{
|
|
immediate: true,
|
|
}
|
|
);
|
|
</script>
|