Skip to main content
Participant
November 9, 2024
Question

Dynamically Change Font Size based on a defined safe zone area, with expressions

  • November 9, 2024
  • 1 reply
  • 337 views

Looking for a solution to having the text scale via another expression that is driving a slider control.

When using this in the layers Source Text, the layer will no longer display the text from txt variable, and the size will revert to the default set on the text object. When setting the .setFontSize() where the variable scaler is not driven by an expression, everything works as it should. Need to be able to use 'scaler' as an expression driven value.

 

//Set Text Source
let txt = comp("_Update Copy Here").layer("Artist Name_TEXT").text.sourceText;
 
//Set Text Scale
let scaler = effect("Text Size")("Slider").value;
 
//Text Style
text.sourceText.style
.setText(txt);
.setFontSize(scaler)
 
 
 
This topic has been closed for replies.

1 reply

Legend
November 9, 2024

Remove the semicolon at the end of .setText(txt);

//Set Text Source
let txt = comp("_Update Copy Here").layer("Artist Name_TEXT").text.sourceText;
//Set Text Scale
let scaler = effect("Text Size")("Slider").value;
//Text Style
style
    .setText(txt)
    .setFontSize(scaler)
Participant
November 9, 2024

Apologies a type on my part

still doesn't fix the issue

need to purge the ram every frame to have it update when the value is linked to an expression on another slider