Closed og2t closed 1 year ago
const top = computed(() => {
if (!isReady.value) {
if (prevTargetIdx.value !== -1)
return `-${prevTargetIdx.value / charSet.value.length * 100}%`
return '0%'
}
if (targetIdx.value === -1)
return `-${1 / charSet.value.length * 100}%`
return `-${targetIdx.value / charSet.value.length * 100}%`
})
<div class="roller-item__wrapper__list top-[25%]" :style="{ transform: `translateY(${top})`, transition: `transform ${duration}ms` }">
rewrote the top
calculator
it's sooo smooth now
top-[-25%]
is a tailwind class and you can change it as top: -25%
Hi!
Thanks for this fantastic library!
It works great although it slows down a lot on mobile. Can I suggest using GPU accelerated
transform: translateY()
rather thantop
?https://github.com/Andy-0414/vue-roller/blob/14511175a18474618827418b43e615003ce7e542/src/components/Roller/RollerItem.vue#L72