saadeghi / svelte-countup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes counts past a number

taitems opened this issue · comments

I've noticed sometimes (not always) that the plugin appears to count past the target number and snap back, like an elastic overshoot easing equation. Is this deliberate? Is this a rounding/decimal error? Is it due to the easing equation?

Thanks for your plugin, of course.

Is it the same value, but the issue happens sometimes?
How can I reproduce? 🤔

Hello, managed to reproduce in a Svelte repl.

Here's the raw code. You'll hopefully see it counting up to 13 and then back to 12.

<script>
   import Countup from 'svelte-countup';
</script>

<Countup
   initial={10}
   value={12}
   duration={500}
   format={false}
/>

I see. Thanks!

Indeed it always make it lite this but when start value and new value difference is big we can't see it.
Quick solution is if difference is small, make duration small or even 1.
I'll check the code and try to figure out when I have time, maybe I can help.

Hello, I'm getting the same issue with this code -- it counts up to 7 then goes back down to 6:

<Countup value={6} />

Is it a bug with small numbers?

I tried reducing the duration but it's still a noticeable problem.

Thanks for looking into this

Fixed in latest version!