-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix for text layers without animation not rendering as a single <tspan> #3020
base: master
Are you sure you want to change the base?
Conversation
can you teach me how to modify lottie.js?Let the text become a whole label |
Sorry, but I do not understand if this bug has been fixed now or what I would have to do to get text rendered as a single tag. With the newest bodymovin plugin, I still have this problem. Thanks a lot for any help! |
I've tested the above method but it doesn't seem to work |
The title is not misleading. This is a pull request which attempts to fix the issue. It depends on other people to actually test if this pull request fixes the issue, and the owner of the Lottie-web repo to merge this into the main branch and release a new version. That's how open-source projects work. If you wanna test if my changes actually work, you have to build lottie-web from the pull request, or the fork itself:
Another option is to use lottie-web v5.8.1, which is and older version that doesn't contain this bug by getting it in one of the following ways:
|
Thank you saadbruno! Sorry, as you certainly noticed, I'm not on the coding but on the design side of the world... Samuel Osborne who works at Lottiefiles made a video tutorial "Dynamic Text And Font With Lottie Animations" in 2021 He shows how he creates text in AE, exports it with bodymovin and gets a Lottie file with text in a tspan tag. Hello Youtube :-) I tried to reproduce the exact same file, but always got text split up. Does that mean, it worked in older bodymovin versions? Or do we have some AE presets that add animators to text layers by default, making bodymovin to split up text in single characters? I produce quite complex interactive information visualizations with a lot of text. If lottie could handle text (formats) better, it would put it on a whole new level. It's a pity... |
I can confirm that all text is on a tspan. But as soon as I uncomment: Is there a way that I can fix this? |
This should fix #657 #2358 #2412 #2866 #2961 #3013
This fixes the issue where a piece of text without character-level animation would not render as a single
<tspan>
tag on the DOM, which is a regression on version 5.9.0.As I mentioned on #2412 (comment), it seemed that the piece of code that defined the text as a
singleShape
was commented out, which means the text would never render as a single<tspan>
.This is because there was a change to this line:
lottie-web/player/js/elements/svgElements/SVGTextElement.js
Line 133 in 14dc0cb
this.textSpans[]
is empty in some cases, which means thatthis.textSpans[i].span
doesn't exist, breaking the condition, and then the text wouldn't render.Seems like this is accounted for with this condition:
lottie-web/player/js/elements/svgElements/SVGTextElement.js
Lines 139 to 144 in 14dc0cb
But this comes AFTER the previously mentioned line, which creates the bug.
This PR fixes this issue, and the text renders as a single
<tspan>
again: