Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions sourceRectTime boxes to align horizontally

  • sourceRectTime boxes to align horizontally

    Posted by Ramondo Robinson on March 15, 2019 at 8:40 pm

    So I am trying to figure out how to get a bunch boxes to line up flush horizontally. They all are already using an expression to be sized to some text inside of them. I just need them to line up no right next to each other now…I know they need to use the position data of the first box, and then account for the width. I assume each one after that would do the same but would be the width of box 1 multiplied? I am using cc18

    Ramondo Robinson replied 7 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • Kalleheikki Kannisto

    March 16, 2019 at 1:40 pm

    If they are all the same width, that would be pretty much it.

    The second box would be (in pseudocode)

    padding = something;
    R = myfirsttextlayer.sourceRectAtTime();
    xPos = R.left + R.width + padding;
    [xPos, value[1]]

    The xPos line on the third box would be

    xPos = R.left + 2*(R.width + padding)

    etc.

    Assuming the anchor point is at the left edge of the box. If it is in the middle I believe you will have to make them 0.5 and 1.5 respectively.

    Kalleheikki Kannisto
    Senior Graphic Designer

  • Ramondo Robinson

    March 18, 2019 at 1:05 pm

    Hmmm where is value[1] defined?

  • Ramondo Robinson

    March 18, 2019 at 1:33 pm

    layerNum = 1;
    x_start_pos = 0;
    y_start_pos = 50;

    textLayer = thisComp.layer(“TEXT”);
    width = textLayer.sourceRectAtTime().width+30;
    height = textLayer.sourceRectAtTime().height;

    xPos = (width * layerNum) + x_start_pos;
    yPos = y_start_pos;
    [xPos, yPos];

  • Ramondo Robinson

    March 20, 2019 at 1:06 pm

    code changed… this is tied to a gap slider on original text layer1:

    var layerNum = 1;
    var x_start_pos = 0;
    var y_start_pos = 13.3;

    gapWidth = thisComp.layer(“TeamNickName”).effect(“Gap Width”).slider;

    textWidth = thisComp.layer(“TeamNickName”).sourceRectAtTime().width + gapWidth;

    textWidth *= layerNum;

    xPos = textWidth;
    yPos = y_start_pos;
    [xPos,yPos];

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