Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dynamic text with divider

  • Dynamic text with divider

    Posted by Alek Ivanov on September 17, 2018 at 4:38 pm

    Hello,
    Few years ago Dan Ebberts helped with a dynamic text problem I had and it worked perfectly. You type the text and it moves with the divider the the second text.
    I cannot figure a way to solve the same issue but being left justified for the two line option.

    It works only with center justified.

    If Anyone can point me to a solution, I’ll be very grateful.

    /Divider
    margin = 50;
    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]]

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

    //Text2
    margin = 50;
    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]]

    Alek Ivanov replied 7 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Alek Ivanov

    September 17, 2018 at 4:39 pm

  • Dan Ebberts

    September 17, 2018 at 5:22 pm

    I think you’d need to update the expression for text 1 like this:

    margin = 50;
    r = sourceRectAtTime(time,false);
    xb = thisComp.layer(“bar”).position[0];
    x = xb + margin + r.left;
    [x,value[1]]

    and like this for text 2:

    margin = 50;
    w1 = thisComp.layer(“text 1”).sourceRectAtTime(time,true).width;
    r = sourceRectAtTime(time,false);
    d = thisComp.layer(“divider”).width;
    xb = thisComp.layer(“bar”).position[0];
    x = xb + margin*3 + d + w1 + r.left;
    [x,value[1]]

    The expression for the divider should be OK.

    Dan

  • Alek Ivanov

    September 17, 2018 at 8:43 pm

    Perfect! Thank you yet again.

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