Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Contrast object color

  • Contrast object color

    Posted by Vinícius Moia amaro on November 23, 2014 at 5:41 pm

    Hi i have two objects in After Effects (shape layer). The second object must have the same color as the first, but i want the two objects have contrast in this way when the first is darker than a certain color then the brightness of the second will be 50 and when less will be -50 . Can anyone help me with this ?

    Vinícius Moia amaro replied 11 years, 5 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    November 23, 2014 at 11:08 pm

    It’s not clear (to me at least) exactly what you’re after here. Are you looking for an expression for the fill color of the second layer, or an expression for the Brightness property of the Brightness and Contrast effect? How would you do it by hand?

    Dan

  • Vinícius Moia amaro

    November 24, 2014 at 11:26 am

    Hi Dan, thanks for help me. Layer 1 has the fill effect (let’s call it fill1 ) and layer 2 has the fill effect (let’s call it fill2 ) connected in fill1 . Thus the layer 2 will have the same color of the layer 1 automatically , that’s easy . Layer 2 also has the brightness and contrast effect and should have the brightness of +50 or -50 depending on how dark the fill 1 color. This is the part that I can not do. The result is that when the fill1 color is changed, the layer 2 receives the same color automatically and will also have the brightness set to 50 or -50 depending on how dark is the fill 1 color. I hope I was clear now

  • Marcus Round

    November 26, 2014 at 9:41 am

    color = content("Rectangle 1").content("Fill 1").color;

    if (rgbToHsl(color)[2] < 0.5) -50 else 50

    it converts the Red/Green/Blue values to Hue/Saturation/Lightness and returns a value of -50 or 50 depending whether the Lightness is lesser or greater than 0.5

  • Vinícius Moia amaro

    November 26, 2014 at 4:14 pm

    Hi Marcus Round, thanks for help me. This code works works perfectly .
    I am very grateful for your help

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