Skip to main content
junats
Participant
October 16, 2024
Question

Create a dropdown that chooses the text alignment

  • October 16, 2024
  • 1 reply
  • 160 views

Hi! As for the new update with the text styling expressions, it was amazing yet I cannot get the results that I need such as having a dropdown that controls the alignment of the text to center, left, and right.

This is the expression that I am using: It still does not work but I do not have expression errors anymore

var dropdown = thisComp.layer("Control Layer").effect("Alignment")("Menu");
var myStyle = text.sourceText.style;

switch (dropdown.value) {
    case 1:
        myStyle.setJustification("alignLeft"); // Left Justify
        break;
    case 2:
        myStyle.setJustification("alignCenter"); // Center Justify
        break;
    case 3:
        myStyle.setJustification("alignRight"); // Right Justify
        break;
}

myStyle;

 

This topic has been closed for replies.

1 reply

Legend
October 16, 2024

Simply remove the last line

 

junats
junatsAuthor
Participant
October 16, 2024

Now working! Thanks for that!