ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Add scale modifier to specific item in "if else" statement

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christian Simpson
Add scale modifier to specific item in "if else" statement
on Sep 22, 2017 at 2:34:14 pm

Here is a sample of some code for an if else statement that I have applied to the source text layer of some text I am working on. My question is whether I can add a specific scale property to certain words that are too long. I need for the really long words to be smaller to fit in a specific area. In the example below "Rainbow Warrior" is much larger than the other words and needs to be scaled down. Anyway for it to be targeted specifically?

Thanks

L = comp("!Scores-Lower-Third").layer("Scores Lower Third Home Control");
if(L.effect("Air Force")("Checkbox").value)
"Falcons"
else if(L.effect("Akron")("Checkbox").value)
"Zips"
else if(L.effect("Hawaii")("Checkbox").value)
"Rainbow Warriors"
else
value;






Return to posts index

Dan Ebberts
Re: Add scale modifier to specific item in "if else" statement
on Sep 22, 2017 at 3:53:57 pm

You could use the same logic in a scale expression:


L = comp("!Scores-Lower-Third").layer("Scores Lower Third Home Control");
if(L.effect("Air Force")("Checkbox").value)
[100,100]
else if(L.effect("Akron")("Checkbox").value)
[100,100]
else if(L.effect("Hawaii")("Checkbox").value)
[50,100]
else
value;


Or, you could base the scale on the actual width of the text:

r = sourceRectAtTime(time,false);
[value[0]*200/r.width,value[1]]


Dan



Return to posts index

Christian Simpson
Re: Add scale modifier to specific item in "if else" statement
on Sep 22, 2017 at 4:31:14 pm

Thanks Dan, that works perfectly.


Return to posts index

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