Copy link to clipboard
Copied
I need to create a template composition with a text box that has both its text content and text styling controlled through two different expressions. Ultimately, I need to make multiple versions of the same comp where both text source and style can be changed with the essential graphics panel. The issue that I'm running into is that the new text expressions seem like they can control either styling or content, but not both - whatever bit of code I write into the expression undoes what I had done previously. For example, if I were to write...
text.sourceText.content = "Adjusted Text"
text.sourceText.style
.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
.setFont("arial")
...then I would get the styling that I want, but I wouldn't be able to change the content. If I were to re-arrange the code to look like this...
text.sourceText.style
.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
.setFont("arial")
text.sourceText.content = "Adjusted Text"
...then I would be able to control the source text, but not the styling.
I've looked through the resources that Adobe has posted, but I don't see anything that would allow me to do what I need to do. Does anyone know how to control both the content and the style of a text layer with two different expressions?
Any help would be appreciated
Try it this way:
txt = "Adjusted Text";
text.sourceText.style
.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
.setFont("Arial")
.setText(txt)
Copy link to clipboard
Copied
Try it this way:
txt = "Adjusted Text";
text.sourceText.style
.setFontSize(thisComp.layer("effectsSliders").effect("FontSize")("Slider"))
.setFont("Arial")
.setText(txt)
Copy link to clipboard
Copied
That did it! Thank you for your quick and simple reply, and thank you for saving my career for the past decade 🙂
Find more inspiration, events, and resources on the new Adobe Community
Explore Now