Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to change solid color using slider control ?

  • How to change solid color using slider control ?

    Posted by Mike Jones on July 22, 2014 at 1:53 pm

    Hello,

    I have a solid layer and I want to change its color using a slider control.

    example: (if value = 0, color = yellow //// if value = 1, color = red)

    I tried using the below expression that I found in this thread:
    slider = Math.floor(effect("Slider Control")("Slider").value);
    if (slider == 0)
    [.5,.5,.5,1] // medium grey
    else if (slider == 1)
    [0,1,0,1] // green
    else [1,0,0,1] // red

    but I am getting an error that the expression result must be of dimension 1, not 4.

    So how can I do this ?

    Tom Holmes replied 11 years, 9 months ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 22, 2014 at 4:14 pm

    You need to apply the expression to a color parameter, like that in the Fill effect.

    Dan

  • Tom Holmes

    July 24, 2014 at 4:29 pm

    Hey,

    Id add two colour controllers to the layer. set one colour to the yellow and the other to red and then write your if else statement but don’t write the 4 value array just pickwhip to the colour controllers.

    if(effect(“Slider Control”)(“Slider”)==0)effect(“Color Control” (“Color”)else if(effect(“Slider Control”)(“Slider”)==1)effect(“Color Control 2”)(“Color”)}

    hope this helps!

    Tom

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