question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Possible to update textlayers?

See original GitHub issue

Hi,

Im trying to update the text in a textlayer after I have created the element with bodymovin.loadAnimation. If I try to simply update the animationData-object on the animation, it wont update. I can see that the object in developertools is updated, but this will not cause a rerender of the text onscreen. I have also tried to destroy the animation and recreate the object, but this wont work ether. So this will not work to update text, only to set it initially before calling loadAnimation:

anim.animationData.layers[0].t.d.k[0].s.t = 'RandomText';

I can see that you are doing something similar in this example on Codepen, and I can recreate your example locally. But I still cant update the text of my composition. Is there anything special about text? The text is exported from AE as text and not shapes.

I can give more complex code examples if needed.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10

github_iconTop GitHub Comments

5reactions
bodymovincommented, Nov 6, 2017

@ssanthos @christianeide I’ve added a method “updateDocumentData” that allows updating text during animation. More here https://github.com/bodymovin/bodymovin/wiki/TextLayer.updateDocumentData

1reaction
InstantArcadecommented, Sep 12, 2020

Just a little more info on this for people still struggling (like I was) updateDocumentData() works, but needs to be called on an TextElement, so instead of

animData.layers[n].layers[m].t.d.k[0].s.t Instead, look at the renderer’s elements arrays

e.g. anim.renderer.elements[0].elements[4].updateDocumentData({t:"BOB"}) It helps to use the console and dig through anim.renderer.elements[n] to make sure you’re calling it on a TextElement (in my case SVGTextElement because I’m using the SVG renderer.

NOTE: You won’t see the effect until you next render a frame (which is automatic if your anim is playing), if not you can call anim.renderer.renderFrame(frameNumber) to force it, however, it still won’t update if you’re already on that frame, so choose a different one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating All Text Layers - Adobe Support Community
The only surefire way I can get all the layers updates is to manually double click on each T (indicates text layer) icon...
Read more >
How to Change Text After It Has Already Been Saved in ...
The easiest way to change text in Photoshop requires only typing over the previous text. However, the text must reside on a text...
Read more >
Edit text layers – Figma Help Center
Double-click on the text layer. Select the text layer and press the Enter or Return key. Edit the contents of the Text box:....
Read more >
Can I update multiple text layers simultaneously in Photoshop ...
To change text, double click the thumbnail (that will open a new window/tab where the text is in its own file) and change...
Read more >
Edit Multiple Type Layers - Photoshop Training Channel
Change the font family or font size of multiple type layers at once, by simply selecting the text layers that you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found