Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Add scale modifier to specific item in “if else” statement

  • Add scale modifier to specific item in “if else” statement

    Posted by Christian Simpson on September 22, 2017 at 2:34 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;

    Christian Simpson replied 8 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    September 22, 2017 at 3:53 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

  • Christian Simpson

    September 22, 2017 at 4:31 pm

    Thanks Dan, that works perfectly.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy