Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions make solid change color at a certain time (expression NOT keyframed)

  • make solid change color at a certain time (expression NOT keyframed)

    Posted by Thor64 on December 27, 2005 at 7:26 pm

    Well it’s not excactly what I’m going to do – but lets keep it simple 🙂

    I have an animation controlled by a slider (value 1-15).
    I need a solid to change smoothely between colors depending on the value of the slider.
    E.g. 100% yellow at 1, 100% red at 7 and 100% yellow at 15.
    I could imagine something with Math.sin, but it would be rather complex in order to hit the 100% colors, since I need them to be placed rather assymetrical on the 1-15 line of values.

    How do I make that in expressions?
    with some if-then-else stuff and some sort of interpolation?

    Thor64 replied 20 years, 4 months ago 3 Members · 5 Replies
  • 5 Replies
  • Mylenium

    December 27, 2005 at 8:04 pm

    Use multiple colored solids in a sub-comp(alternatively use multiple instances of the Fill effect on one solid and control their opacity) and remap your slider values to their opacity using the interpolation methods. example:

    out_opacity=linear(slider_value,3,4,100,0)

    [out_opacity]

    This will make the layer fade between slider values 3 and 4. Outside these values opacity will be constant. This means that all you need to take care of is the stacking order of your effects to make one color appear beneath the other. Increment/ decrement the values for each layer as needed. This is the simplest and cleanest solution. Of course there are more complex ways by calculating the colors properly, but I don’t recommend it. Next to mangling time related stuff with expressions, colors are the second most difficult thing to do.

    Mylenium

    [Pour Myl

  • Dan Ebberts

    December 27, 2005 at 9:52 pm

    A Fill color expression like this might do what you need:

    slider = effect(“Slider Control”)(“Slider”);
    green = Math.min(linear(slider,0,7,0,1),linear(slider,7,15,1,0));
    [1,green,0,1]

    Dan

  • Thor64

    December 27, 2005 at 11:22 pm

    I think its just the linear expression you wrote I needed.
    It gave me and idea. Thanks 😀

  • Thor64

    December 27, 2005 at 11:41 pm

    Wow, you are always here to reply 🙂

    well I thought it would be easier to explain my problem with colors,
    but what i really want to do is to bend a beam at different speeds and amounts (positive and negative) in a smooth way. really a job for keyframes, but I have decided to go with expressions on this one.

    I only manipulate one layer so tried:

    bend=linear(time,3,5,0,40); // bends from 0 to 40 (fast)
    bend=linear(time,6,10,40,50); // slow bend

    I just tried this but it doesnt really work. It only reacts to the first.

  • Thor64

    December 27, 2005 at 11:43 pm

    I think you have showed the way of doing it in your reply actually 🙂

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