Skip to main content
junats
Participant
Oct 16, 2024 8:16 AM UTC
Question

Create a dropdown that chooses the text alignment

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 is closed to new replies. Start a new post to keep the conversation going.

2 replies

Legend
Oct 16, 2024 8:26 AM UTC

Simply remove the last line

 

Translate
junats
junatsAuthor
Participant
Oct 16, 2024 8:29 AM UTC

Now working! Thanks for that! 

Translate