ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dynamic scaling and relative positioning Lower Third

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
alek Ivanov
Dynamic scaling and relative positioning Lower Third
on Dec 25, 2016 at 10:56:35 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



Return to posts index

alek Ivanov
Re: Dynamic scaling and relative positioning Lower Third
on Dec 26, 2016 at 5:22:49 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.


Return to posts index

Dan Ebberts
Re: Dynamic scaling and relative positioning Lower Third
on Dec 26, 2016 at 8:06:24 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



Return to posts index


alek Ivanov
Re: Dynamic scaling and relative positioning Lower Third
on Dec 27, 2016 at 5:17:08 pm

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

This worked perfectly!


Return to posts index

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