Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions If/else + multiple outcome for color changing depending of scale

  • If/else + multiple outcome for color changing depending of scale

  • Jeremy Crevieux

    December 15, 2022 at 3:44 pm

    Hello! First time here, and trying really hard to be better at expression. But I’m really confused when it’s about some more complex expression than basic stuff like time*100 and else, so, I’ll try to be as elaborate as I can.

    The project is about a visual with data and legend (cf image). Has you can see, there is difference size of rounds.

    So my situation is :

    I’m trying to make multiple but separate round shapes changing colors following a change of their own scale.
    I would like it to have some continuous changing, so no checkbox but more like linear.
    And there will be 3 possible outcome depending of the changing size going by redish to orange then yellow.

    exemple :
    if thislayer.transform.scale is 0 to 20 color will be R=102, G=21, B=45;
    but if thislayer.transform.scale is 21 to 50 color will be R=217, G=122, B=51;
    and if thislayer.transform.scale is 51 to 100 color will be R=236, G=183, B=49;

    I don’t know if putting an adjustment layer with some slider could help, but I need to change their own scale separately one from another.

    So there it is. Any thoughts?


  • Dan Ebberts

    December 15, 2022 at 5:00 pm

    I’m guessing this isn’t quite right, but it will probably be something like this:

    red = [.4,.0824,.1765,1];
    orange = [.851,.4784,.2,1];
    yellow = [.9255,.7176,.1922,1];
    s = scale[0];
    if (s <= 20)
    else if (s <= 50)
  • Jeremy Crevieux

    December 15, 2022 at 5:16 pm

    Wow, ok thanks that’s almost perfect. I just got a problem with the red of the beginning. He kind of don’t keep his color enough with a small size to see his first state of color before changing to the orange.
    But that’s a very great help. I already tried to change the value you put to accomodate with the best settings.

    I will be back with news soon.
    Thanks a bunch!

Viewing 1 - 3 of 3 posts

Log in to reply.

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