Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control position based on a slider's valueAtTime, but with a custom easing

  • Control position based on a slider's valueAtTime, but with a custom easing

    Posted by Joel Daniels on April 3, 2023 at 1:41 pm

    I’d like to control a layer’s position relative to its starting position, using an animated slider’s valueAtTime(). I want to do a sort of custom easing on the position change. Here’s an arbitrary example:

    When the slider is at 100, the position should be 0. When the slider is at 0, the position should be 100. But when the slider is at 40, the position is 75. Is this possible using combinations of ease() or linear(), or something else entirely?

    Adam Greenberg replied 3 years, 4 months ago 3 Members · 6 Replies
  • 6 Replies
  • Adam Greenberg

    April 3, 2023 at 8:10 pm

    the ease you can do, and thats something else, but what do you want to do for the math ?

    for example what if the slider is at 22, what do you want to the position to be ? there has to be some type of math, I am not sure how 40 and 75 relate to each other if 100 is 0 and 0 is 100

  • Tomas Bumbulevičius

    April 4, 2023 at 7:28 am

    Hey Joel, you should look exponential easing function, where “ratio of easing” could be adjusted

  • Joel Daniels

    April 5, 2023 at 4:34 pm

    Hi Tomas, I’m not familiar with this; can you elaborate?

  • Joel Daniels

    April 5, 2023 at 4:51 pm

    Hi Adam – well 40 and 75 don’t really relate to each other, that’s the point. I gave an arbitrary example, but I ran into a situation the other day where I was trying to rig up some automated movement so I didn’t have to keep animating something meticulously.

    I had the object position keyframed, and was controlling the movement between the keyframes with eg. “valueAtTime(slider)”. I had an animated slider controlling various things, and I wanted an object to move a specific amount when the slider was at 75. Then when the slider animated the rest of the way, the object needed to move the rest of its distance.

    Edit: Well, I guess some conditional statements seem to work ok.

    s = thisComp.layer("Slider Control").effect("Slider Control")("Slider");
    if (s <= 75) {
    x = linear(s, 0, 75, 0, 40);
    }
    else {
    x = linear(s, 75, 100, 40, 100);
    }
    y = value[1];
    [x, y]
  • Adam Greenberg

    April 7, 2023 at 2:15 pm

    Oh I see. There is a post in this forum that will allow to have more control over the animation curve if that is what you were looking for. Let me see if I can find it. In fact I remember saving a project that had 3 ways of doing this, and you pick the one that works best. I’ll check now and post back when I find it.

  • Adam Greenberg

    April 7, 2023 at 2:19 pm

    We can thank Dan and Kevin for these methods.

    ( if they help you )

    https://creativecow.net/forums/thread/better-than-ease/

    better than ease ?

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