Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Difficulty figuring out script to change font style over time

  • Difficulty figuring out script to change font style over time

    Posted by Sergio Pol on December 30, 2014 at 9:18 pm

    Hello I’ve been tormenting myself for like two weeks with after effects scripting to be able to generate a script that changes a font style at intervals of half a second. I came to the following script mainly from the AE scripting guide so I don’t understand it completely. But right now all it does is change the Font Style for a specific layer. I tried mixing this script with another found in the same source but couldn’t make it work. It used the .setValueAtTime() method but I did a really good mess.

    I thought that if I created an array for the font styles I wanted I could call it instead of generating individual variables for each style but it never worked. I’m sure there’s a way but it beats me. Please help!!


    var textLayer = app.project.item(1).layer(7);
    var textProp = textLayer.property("Source Text");
    var textDocument = textProp.value;
    textDocument.font = "DINNextLTPro-Bold";
    textProp.setValue(textDocument);

    Sergio Pol replied 11 years, 8 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 30, 2014 at 11:23 pm

    Something like this should cycle through your specified fonts:


    var fonts = ["ArialMT","Impact","MyriadPro-Regular","Verdana"];
    var textLayer = app.project.item(1).layer(7);
    var textProp = textLayer.property("Source Text");
    var textDocument = textProp.value;
    var t = textLayer.inPoint;
    var idx = 0;
    while (t < textLayer.outPoint){
    textDocument.font = fonts[idx];
    textProp.setValueAtTime(t,textDocument);
    t += .5;
    idx = (idx+1)%fonts.length;
    }

    Dan

  • Sergio Pol

    December 30, 2014 at 11:54 pm

    That’s exactly what I needed Dan, as usual. Thank you very much!!!

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