ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Dynamic text with divider

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
alek Ivanov
Dynamic text with divider
on Sep 17, 2018 at 4:38:27 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]]


Return to posts index

alek Ivanov
Re: Dynamic text with divider
on Sep 17, 2018 at 4:39:27 pm





Return to posts index

Dan Ebberts
Re: Dynamic text with divider
on Sep 17, 2018 at 5:22:45 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



Return to posts index


alek Ivanov
Re: Dynamic text with divider
on Sep 17, 2018 at 8:43:27 pm

Perfect! Thank you yet again.


Return to posts index

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