Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Automatically wrap variable text with a color boundary box

  • Automatically wrap variable text with a color boundary box

    Posted by James Ree on February 19, 2013 at 6:29 am

    Hi Creative Cow,

    I’m attempting to add some customised subtitles to a video. I’m using the following expression to link Metadata Speech function produced in Premiere 5.5, and then imported into After Effects.

    What I’d like to do is wrap this text in a 80% grey transparent box that varies in x according to the number of words on screen at any one time. The text color I can easily change, but I can’t figure out how to highlight the text in a box. Thanks in advance.

    James

    L = thisComp.layer("name of your video. extension");
    max = 5; // number of words to display
    n = 0
    if (L.marker.numKeys > 0){
    n = L.marker.nearestKey(time).index;
    if (L.marker.key(n).time > time){
    n--;
    }
    }
    s = " ";
    if (n > 0){
    base = Math.floor((n-1)/max)*max + 1;
    for (i = base; i < base + max; i++){
    if (i <= L.marker.numKeys){
    s += L.marker.key(i).comment + " ";
    }
    }
    }
    s

    Stephan Walsch replied 13 years, 5 months ago 2 Members · 1 Reply
  • 1 Reply
  • Stephan Walsch

    February 20, 2013 at 11:45 pm

    hi James,
    mega weird “not really a lot of expressions” approach:

    -download the awesome (and free) BLOKK Font at blokkfont.com
    -create a text layer under your current text, set it to be the blokk font
    -change size and color to your liking
    -link the text of this layer to your actual text above via expression

    this should do what you want
    Cheers!

    Stephan

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