Adobe After Effects Expressions Forum
sourceRectAtTime expression
sourceRectAtTime expression
by Asher Burridge on Feb 15, 2019 at 12:02:10 pm

Hi,

I’m trying to get a sourceRectAtTime expression to work out the longest text box length and use that to create a box behind.
However, no matter how I change the s= value, I can’t seem to work it out.

Any help would be greatly appreciated!
The current expression below:

s = thisComp.layer("TOP LINE TEXT LONGER STILLER") = if((thisComp.layer("TOP LINE TEXT LONGER STILLER")>thisComp.layer("TEXT 2”)) else thisComp.layer("TEXT 2”);

x = s.sourceRectAtTime(time-s.inPoint,true).width;

y = height = 104;

[x , y]

Thanks!



Re: sourceRectAtTime expression
by Andrei Popa on Feb 15, 2019 at 2:33:56 pm

Maybe something like this
width1 = thisComp.layer("TOP LINE TEXT LONGER STILLER").sourceRectAtTime(time,true).width;
width2 = thisComp.layer("TEXT 2").sourceRectAtTime(time,true).width;
x = Math.max(width1, width2);
y = 104;
[x , y]


Andrei
My Envato portfolio.


Re: sourceRectAtTime expression
by Asher Burridge on Feb 15, 2019 at 3:50:29 pm

Thank you so much Andrei. Worked like a charm!





© CreativeCOW.net