Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Text expression with double change (font style and text)

  • Text expression with double change (font style and text)

    Posted by Chenar Dupressoir on July 12, 2022 at 1:21 pm

    Hello,

    I spend a lot of time on this trouble but i can find the right solution.The trouble is : I have 2 array, one for my value text and one for my font style.

    i have only one of two change work. when i have the text i can’t change the style and inversely too. I try to have the change of the text in another layer and the style in the main. but same, i can’t find the solution.

    I’m using javascript expression and not the legacy system.

    Thanks for your help.

    var array = ;

    var myFont = ;

    var t = Math.floor(random(1,6));

    var f = Math.floor(random(1,4));

    var textstyle = style.setFont(myFont );

    var textcontent = style.setText(array );

    myText.sourceText = array .style.setFont(myFont );

    myText;

    Dan Ebberts replied 4 years, 1 month ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    July 13, 2022 at 2:24 am

    This should work:

    array = ["first","second","third","fourth"];
    myFont = ["ArialMT","Calibri","LucidaConsole","MyriadPro-Regular"];
    t = Math.floor(random(array.length));
    f = Math.floor(random(myFont.length));
    s = style;
    s.setFont(myFont[f]).setText(array[t]);

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy