Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Set transparency if color is white

  • Set transparency if color is white

    Posted by Mats Jacobsson on February 12, 2010 at 12:33 pm

    Hi!

    Coukd someone please tell me why this expression isn’t working?

    I have a Fill Effect on a Solid that is controlled by a Color Control in another Comp.

    I want the transparency of the Solid to be 50% only if the Color Control is set to 100% white.

    I get 100% transparency even if it’s white.

    And why is there four arrays? Isn’t it RGB?

    Thanks!


    if (comp("COLOR").layer("Null 2").effect("COLOR 2")("Color") == [255,255,255,1])
    transp = 50;

    else
    transp = 100;

    transp

    Dan Ebberts replied 16 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Mats Jacobsson

    February 12, 2010 at 1:14 pm

    Ok, i figured out that the fourth array is the Alpha. I also tried [1,1,1,1] but still the same result

  • Dan Ebberts

    February 12, 2010 at 3:15 pm

    Expressions expect color values between zero and one. Try it this way:

    C = comp(“COLOR”).layer(“Null 2”).effect(“COLOR 2”)(“Color”);
    if (C[0] == 1 && C[1] == 1 && C[2] == 1) 50 else 100

    Dan

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