ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Conditional expression for box size

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew McClure
Conditional expression for box size
on Oct 4, 2018 at 4:35:04 pm

Hi all, I'm trying to create a text box that will size to the to width of the longest text.

Currently using this conditional expression but it only works for the first 2 values

n = thisComp.layer("NAME TEXT").sourceRectAtTime();
p = thisComp.layer("PROFESSION TEXT").sourceRectAtTime();
u = thisComp.layer("USERNAME TEXT").sourceRectAtTime();

if ((n.width > p.width) || (n.width > u.width)) {
[n.width + 100, 135]
}
else if ((p.width > n.width) || (p.width > u.width)) {
[p.width + 100, 135]
}
else {
[u.width + 100, 135]
}


Not sure what I am doing wrong, thanks for your help!


Return to posts index

Dan Ebberts
Re: Conditional expression for box size
on Oct 4, 2018 at 5:24:36 pm

Try it with && instead of ||

Dan



Return to posts index

Andrew McClure
Re: Conditional expression for box size
on Oct 4, 2018 at 5:38:39 pm

Worked! Thank you so much Dan!


Return to posts index

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