-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
counter animation glitches #1
Comments
Hi @bramdeba ! Sorry I didn't see this earlier. Which font are you using? I can try and reproduce and let you know what's up. This is a custom font, right? My first instinct is that the library could be calculating the spacing of the digits before the font is loaded. Or at least the library is failing to calculate the spacing properly. You could try only displaying the component after the fonts have loaded, just to see if it fixes your issue. If it does then there is work to be done in the library :) I would do something like this, just to test that it is the font loading causing the issue. function useAreFontsReady() {
const [state,set] = useState(false);
useEffect(() => {
document.fonts.ready.finally(() => {
set(true);
});
}, []);
return state
} Then you can use it like const areFontsReady = useAreFontsReady();
return areFontsReady ? <CounterAnimation text="testing" /> : null |
Actually, that code able is in the repo already! Although if you can provide a bit more details about your environment, it might help me look into it. I had actually noticed that I am not setting the font for the counter in the best way. It seems that the API is not very consistent across all browsers. So this line:
is very different in some browsers than others, and in some browsers, I was noticing that I am not sure if that is the problem for you, but it is a problem I have noticed. |
I just released |
I'm having the same exact issue. Currently using Google Chrome Desktop and Safari iOS |
Narrowed down the problem; the bug appears when specifying |
@johndebord Very cool that you were able to get to the bottom of it and thanks for sharing. Are you able to provide a reproduction? Perhaps in codesandbox or something? As I cannot reproduce here even with your description |
I have a similar problem with the rendering of the elements
Reviewing the rendered HTML I see that it misapplies the location on the translate3D property, it displaces the numbers much further than they should, at the same time which leaves it with opacity 0. For what it's worth, I had some issues between mechanical-counter and framer-motion (v 10.12.18) when installing the dependency. I think I fixed it by reinstalling framer-motion with "npm install framer-motion --legacy-peer-deps" but I don't remember exactly now |
@commandZeta it could be some kind of framer-motion bug, maybe my code is also not very optimised 😅 the peer dep is |
The animation glitches. Any idea what may be causing this?
The text was updated successfully, but these errors were encountered: