Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dynamic scaling and relative positioning Lower Third

  • Dynamic scaling and relative positioning Lower Third

    Posted by Alek Ivanov on December 25, 2016 at 10:56 pm

    Hello,

    I would be very grateful if someone can help me out with a problem I ‘m trying to solve.

    I have a bar which is divided in two and in each of the areas I want to have a text which stays centered relevant to it’s half but effects the overall size of the bar when you type the word. The middle divider line has to move relevantly too.

    Anything will be of help thank you very much for your time.

    0_comp10-00-00-00.jpg

    Alek Ivanov replied 8 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Alek Ivanov

    December 26, 2016 at 5:22 pm

    I was trying to use Evan’s example, which unfortunately is limited to monospaced fonts only. It will do for now if I can figure out how to connect two boxes which effect each other.

    In his example we have a text with rectangle shape, which position path is connected with the path scale
    temp = content(“Rectangle 1”).content(“Rectangle Path 1”).size[0];
    [temp/2, 0]

    And the scale is connected to the text
    The expressions used in this tutorial are:
    temp = thisComp.layer(“TEXT”).text.sourceText;
    L = temp.length;
    x =100 * (L * .9);
    [250+x, value[1]]

    If I can at least combine two of these shapes(with text) I’ll be on the right track.

  • Dan Ebberts

    December 26, 2016 at 8:06 pm

    Assuming that nothing is parented, the anchor point of the bar is on its left edge, and the two text layers are center-justified, the expressions could look something like this:

    // bar scale

    margin = 90;
    w1 = thisComp.layer(“text 1”).sourceRectAtTime(time,false).width;
    w2 = thisComp.layer(“text 2”).sourceRectAtTime(time,false).width;
    d = thisComp.layer(“divider”).width;
    w = margin*4 + w1 + w2 + d;
    [value[0]*w/width,value[1]]

    // divider position

    margin = 90;
    w1 = thisComp.layer(“text 1”).sourceRectAtTime(time,false).width;
    xb = thisComp.layer(“bar”).position[0];
    x = xb + margin*2 + w1 + width/2;
    [x, value[1]]

    // text 1 position

    margin = 90;
    w1 = sourceRectAtTime(time,false).width;
    xb = thisComp.layer(“bar”).position[0];
    x = xb + margin + w1/2;
    [x,value[1]]

    // text 2 position

    margin = 90;
    w1 = thisComp.layer(“text 1”).sourceRectAtTime(time,false).width;
    w2 = sourceRectAtTime(time,false).width;
    d = thisComp.layer(“divider”).width;
    xb = thisComp.layer(“bar”).position[0];
    x = xb + margin*3 + d + w1 + w2/2;
    [x,value[1]]

    Dan

  • Alek Ivanov

    December 27, 2016 at 5:17 pm

    Mr. Ebberts,
    Thank you so much for being the person that you are.

    This worked perfectly!

  • Alek Ivanov

    June 4, 2018 at 6:00 pm

    Hello Dan,
    Do you think this could work with the text left-justified?

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