Lottie-web: Modifying Text Dynamically

Created on 3 Oct 2017  路  4Comments  路  Source: airbnb/lottie-web

I am currently working on a project in order to allow a user to preview a short animated template (e.g. for a video title) online, and fill out details such as title text or theme colours. Ideally, I'd like to be able to use After Effects templates through Bodymovin, and have the template preview update whenever inputs are changed.

While properties like colour and font size seem trivial, I have been looking at modifying text during runtime, and have gotten stuck.

While I am able to modify the keyframe data and call element.buildNewText to force it to update, buildNewText (in the case of the SVG renderer) looks at the list of letters in the keyframe data generated by the dataManager. Hence, it still displays the old text.

Is there any way to force this letter information to update in a relatively performant way? Or alternatively, some way to avoid using that letter info at all and not split data by characters? I won't be needing any advanced character effects that I believe would need this.

Most helpful comment

I've added a method "updateDocumentData" that will allow to update texts dynamically.
More here:
https://github.com/bodymovin/bodymovin/wiki/TextLayer.updateDocumentData

All 4 comments

I've added a method "updateDocumentData" that will allow to update texts dynamically.
More here:
https://github.com/bodymovin/bodymovin/wiki/TextLayer.updateDocumentData

can i do the same for iOS ?

@astrokin I don't think you can, but you should post the question on the iOS repo.
https://github.com/airbnb/lottie-ios

@bodymovin thank you for response. I've already did it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ritsraghani picture ritsraghani  路  3Comments

yannieyeung picture yannieyeung  路  3Comments

jumostudio picture jumostudio  路  3Comments

casillasluisn12 picture casillasluisn12  路  4Comments

processprocess picture processprocess  路  3Comments