ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

sourceRectTime boxes to align horizontally

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
ramondo robinson
sourceRectTime boxes to align horizontally
on Mar 15, 2019 at 8:40:58 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


Return to posts index

Kalleheikki Kannisto
Re: sourceRectTime boxes to align horizontally
on Mar 16, 2019 at 1:40:56 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


Return to posts index

ramondo robinson
Re: sourceRectTime boxes to align horizontally
on Mar 18, 2019 at 1:05:24 pm

Hmmm where is value[1] defined?


Return to posts index


ramondo robinson
Re: sourceRectTime boxes to align horizontally
on Mar 18, 2019 at 1:33:19 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];


Return to posts index

ramondo robinson
Re: sourceRectTime boxes to align horizontally
on Mar 20, 2019 at 1:06:29 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];


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]