Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions calculate complimentary colors from shape layer

  • calculate complimentary colors from shape layer

  • Luke Jaeger

    February 14, 2019 at 9:32 pm

    hi all,

    I have a comp with multiple lights and I’d like to be able to control the hues of the lights parametrically.
    I can create a shape layer and a light, and use an expression to make the light color the same as the color of the shape layer.

    What I’d like to do:

    Make a spot light and an ambient light, and have the hues of these 2 lights always be opposite colors (180 degrees away in the HSL wheel), or something like that. eg, if the spot light is red, ambient light is cyan. As spot light moves toward yellow, ambient light moves toward blue.

    This involves coercing the RGBA color of the shape layer to HSL, changing just the H value, then coercing back to RGBA.
    I tried this but get error in line 1, “array piece can’t expand to more than one value”

    Anyone have syntax for making this work? thanks!!

    masterCol = (thisComp.layer("Shape Layer 1").content("Fill 1").color) ;
    hslCol = rgbToHsl(masterCol) ;
    hue = hslCol [1] ;
    sat = hslCol [2] ;
    lum = hslCol [3] ;
    newHue = hue + 180 ;
    newCol = [newHue,sat,lum] ;
    [hslToRgb(newCol)] ;

  • Dan Ebberts

    February 14, 2019 at 11:13 pm

    Try it this way:

    masterCol = (thisComp.layer(“Shape Layer 1”).content(“Fill 1”).color) ;
    hslCol = rgbToHsl(masterCol) ;
    hue = hslCol [0] ;
    sat = hslCol [1] ;
    lum = hslCol [2] ;
    newHue = (hue + .5)%1;
    newCol = [newHue,sat,lum,1] ;
    hslToRgb(newCol);

    Dan

  • Luke Jaeger

    February 15, 2019 at 2:42 am

    YOU ARE THE BEST

  • Arne Münch

    May 5, 2020 at 9:30 pm

    Another question concerning this is how to calculate real complementary colors in AE in general. To shift the H value 180 degrees is not what the eye feels as complemantry, i guess.
    The adobe color tool (https://color.adobe.com/de/create/color-wheel) uses this colorwheel, and when you set a hue of 1, the complemantry hue is 137, (and not 180)
    So my question, is there a way to calculate complemantary colors inside AE.
    And if not, does anyone know of a way to calculate these complemantry hues manually, or also triade hues?

Viewing 1 - 4 of 4 posts

Log in to reply.

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