Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Using a Slider to control RGB values

  • Using a Slider to control RGB values

    Posted by John Pritchett on November 14, 2011 at 12:31 am

    I am having a bit of trouble making this work…

    So I need to make a Slider (or any ‘Value’ control) to control a Fill effect on a Text layer.
    I need to limit to only 6 specific colours, so I need something like,
    if thisComp.layer(“ColourControl”).effect(“Slider”)=1,
    make, this layer effect(“Fill”)(“Color”)(r,g,b)255,50,20;

    If the Slider = 2 then make 255,50,42
    If Slider = 3 then make… etc etc etc, All the way to 6.

    Any help muchly appreciated!!!
    Thanks
    John

    Dan Ebberts replied 14 years, 7 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    November 14, 2011 at 1:32 am

    Something like this, most likely:


    s = thisComp.layer("ColourControl").effect("Slider Control")("Slider");
    colors = [[255,50,20],
    [255,50,42],
    [255,50,64],
    [255,50,86],
    [255,50,108],
    [255,50,140]];
    idx = Math.max(Math.min(colors.length-1,Math.round(s)-1),0);
    c = colors[idx]/255;
    [c[0],c[1],c[2],1]

    Dan

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