saadeghi / svelte-countup

21 stars 5 forks source link

Sometimes counts past a number #2

Closed taitems closed 5 months ago

taitems commented 10 months ago

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.

saadeghi commented 10 months ago

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

taitems commented 10 months ago

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}
/>
saadeghi commented 10 months ago

I see. Thanks!

sbscan commented 8 months ago

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.

joefhall commented 5 months ago

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

saadeghi commented 5 months ago

Fixed in latest version!

joefhall commented 5 months ago

Great, thank you!

On Mon, 20 May 2024 at 17:18, Pouya Saadeghi @.***> wrote:

Fixed in version 0.2.7!

— Reply to this email directly, view it on GitHub https://github.com/saadeghi/svelte-countup/issues/2#issuecomment-2120775987, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7MSDTJE3SIK4WBJTIBY5LZDIO6VAVCNFSM6AAAAABB52GQSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRQG43TKOJYG4 . You are receiving this because you commented.Message ID: @.***>