airbnb / lottie-web

Render After Effects animations natively on Web, Android and iOS, and React Native. http://airbnb.io/lottie/
MIT License
30.54k stars 2.87k forks source link

Regarding Text exports one character per <text> element #657 #2412

Open DTDK opened 3 years ago

DTDK commented 3 years ago

Hi hernan iIf I understand correctly in order to get a single string of text instead of per character I need to use a tspan pair of tags, where do I add the tspans? in the .json file?

bodymovin commented 3 years ago

hi, that happens automatically when certain conditions are met. No animators and no box text.

saadbruno commented 2 years ago

@bodymovin I think there is a regression on this on 5.9.0

I created a new text layer with no animations, and no box text, and the web player still renders it as one character per element. If I use 5.8.1, it will render as a single <tspan>

Spo-oky commented 2 years ago

I have the same problem, I've testes all versions and work ok but none of the versions 5.9.X. In all 5.9.X the word turns into separate characters.

Anyone found out how to fix this or what do we need to do in After Effects to be a word again?

saadbruno commented 1 year ago

Still looking into this issue.

There has definitely been some changes to the code that dictates how the text should render.

Seems like this is the piece of code that will render text as a single <tspan>: https://github.com/airbnb/lottie-web/blob/14dc0cb12d17158900165fa5f7beae7d77887029/player/js/elements/svgElements/SVGTextElement.js#L113-L150

But it seems that singleShape will never evaluate to true, because the part that sets it to true is commented out:

https://github.com/airbnb/lottie-web/blob/14dc0cb12d17158900165fa5f7beae7d77887029/player/js/utils/DataManager.js#L486-L490

Seems like the commit that changed it was https://github.com/airbnb/lottie-web/commit/2af2f64c65488d1ac072fa72aeea64c79619b806

Now, I don't understand why this was changed. I'm assuming it is to add new features and bugfixes. But losing the ability to render a single tspan is really keeping me on v5.8.1

Hernan can you give us a pointer here?