ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Setting a min length while using sourceRectAtTime

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Kristjan Erusk
Setting a min length while using sourceRectAtTime
on Jan 19, 2018 at 2:25:43 pm

Hello everybody.

Is there a way to set a minimum length for a shape layer while having it change length according to a text layer?

E.g. Length = y but not shorter than x
It would look something like this.


And the other question would be if i have two shape layers that both change their length depending on text layers 1 and 2(with the sourceRectAtTime expression) then can I have shape layer 1 always be longer than shape layer 2 regardless of the length of the text?


Return to posts index

Kevin Camp
Re: Setting a min length while using sourceRectAtTime
on Jan 19, 2018 at 11:01:52 pm

you can use a Math.max() function... it would allow you to select the greater value of either A or B...

say you had this:

A = 100 ;
B = 20;
Math.max( A, B )

it would return 100, since 100 is larger than 20.

so if you had this:

A = 100 ;
B = sourceRectAtTime().width ;
W = Math.max( A, B )

if B was less than 100, W would equal 100, if B was greater than 100, then W would equal B

Just FYI, Math.min() works the same but returns the smaller value.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Kristjan Erusk
Re: Setting a min length while using sourceRectAtTime
on Jan 21, 2018 at 1:30:08 am

Thanks, this worked perfectly.


Return to posts index

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