gaoryrt / number-flip

🎰 Increase your number with flipping animation
https://codesandbox.io/embed/throbbing-flower-ncm0q
MIT License
645 stars 60 forks source link

flipping from 9 to 10 throws #27

Open EliasDerHai opened 8 months ago

EliasDerHai commented 8 months ago

After fiddling around way too long to import this into my solidjs app I notice that this throws when incrementing to a new digit (eg. 9->10, 99->100 etc.):

Uncaught TypeError: e3.ctnrArr[r4] is undefined
    value index.js:1
    value index.js:1
    value index.js:1
    AnimatedProgressBar AnimatedProgressBar.tsx:71
    runComputation dev.js:781
    updateComputation dev.js:759
    runTop dev.js:876
    runUserEffects dev.js:989
    completeUpdates dev.js:945
    runUpdates dev.js:893
    completeUpdates dev.js:945
    runUpdates dev.js:894
    writeSignal dev.js:732
    setter dev.js:217
    triggerAnimation RightHud.tsx:13
    eventHandler dev.js:859
    delegateEvents dev.js:591
    <anonymous> CharacterCreation.tsx:64
2 index.js:1:7707
    value index.js:1
    forEach self-hosted:203
    value index.js:1
    value index.js:1
    AnimatedProgressBar AnimatedProgressBar.tsx:71
    runComputation dev.js:781
    updateComputation dev.js:759
    runTop dev.js:876
    runUserEffects dev.js:989
    completeUpdates dev.js:945
    runUpdates dev.js:893
    completeUpdates dev.js:945
    runUpdates dev.js:894
    writeSignal dev.js:732
    setter dev.js:217
    triggerAnimation RightHud.tsx:13
    eventHandler dev.js:859
    (Async: EventListener.handleEvent)
    delegateEvents dev.js:591
    <anonymous> CharacterCreation.tsx:64
101budspencer commented 7 months ago

solution?

EliasDerHai commented 7 months ago

https://github.com/der-Lehmann/number-flip-animation

Not perfect (number flip over 0 is also not the best animation) but it's way better compared to this. Honestly this repos' source code is just an utter mess

gaoryrt commented 7 months ago

@EliasDerHai For solving this bug, may i ask you to provide a minimal repreducible example?

Developer must know the maximum number of digits before executing the animation. And they should set it in new Flip at first. Animations that exceed the pre-set maximum number of digits can cause an error.

set it in new Flip at first