Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions [REQ] Easing constrained to time units…PLEASE?

  • [REQ] Easing constrained to time units…PLEASE?

    Posted by Lu Nelson on November 30, 2008 at 8:15 pm

    I feel like this is a perennial post of mine, which I make in different forums because it confounds me that I can’t grasp it.

    I’m looking/hoping/wishing for a way to constrain keyframe easing by discrete units of time, causing the speed graph for any interpolation (between two simple keyframes) to be effectively divided in to three parts: 1. acceleration, 2. constant speed, 3. deceleration.

    The way I envision it, the actual KFs as set in the timeline would be just two linear KFs, and the property could be any; the important part is that the expression would take over the interpolation to force the speed of the value change to a custom curve that has a straight section in the middle.

    Important parameters in this would be what we might call an “in” time and an “out” time, during which the any necessary speed changes take place, WRT the values before/after these two KFs. In the simplest example, if the animation was 10s long, with the given property beginning and ending at a constant value, and then you set the in time to 2s and the out time to 2s, the speed of the parameter change would accelerate for the first two seconds, decelerate for the last two seconds, and there would be a 6s section in the middle where the speed was absolutely constant. You can do this with regular keyframes but you would have to set 4 of them and tweak the handles/curves by hand (also the curves would get thrown off if you then tried to retime it and you’d have to set it up again each time).

    This is actually really tough and my understanding of the math goes just far enough to tell me that 😉 I keep hoping if I post it someone will be interested in taking it on…

    Dan Ebberts
    replied 17 years, 5 months ago
    3 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    December 1, 2008 at 12:29 am

    I think I get it conceptually, but I think there’s a piece of information missing. I believe you’ll have to define what percentage of the value change from one keyframe to the next will be included in the ease portions of the curve. For example, you might say that 20% of the value change happens in the 2-second easeIn, then 60% is linear, then 20% is easeOut.

    Even with that, I think it’s still pretty tricky. You have to calulate the ease portions as if the linear portion doesn’t exist. For the example above, you’d calculate the ease as if it occured over 4 seconds and went from 0 to 40% of the value change. Then you add the linear stuff in at the mid point and the tangents should match up. A fair amount of math involved. Maybe somebody will come up with a better way.

    Dan

  • Lu Nelson

    December 1, 2008 at 1:12 pm

    Hi Dan,

    yes percentage may be the way one has to think of it; though I wonder if perhaps that could be the way the expression would handle it internally; but still allow the user to specify a value in seconds (either by an expression control or just values in the expression that are easily seen and changed) — thus if I changed the length of my example to 20s, it would fit the value change to two sections of 10% and put 80% linear in the middle.

    However I really like your way of seeing it — the idea that it was as though you just calculated the easing for a shorter section and then broke it up by inserting the linear section in the middle; I’m trying to visualize whether the tangents would match up but your way of reasoning suggests that they should.

    Thanks for that contribution, maybe someone else wants to chime in?

    Lu Nelson
    Berlin, Germany

  • Brian Berneker

    December 2, 2008 at 12:10 am

    I’m not any kind of expressions guy, but I am a programmer otherwise. Couldn’t you just calculate the number of frames difference between the start and the first “linear” frame, divide by 90 and apply a Math(sin) function? Then you would get an ease from 0 to 1 that you would then apply as a multiplier to your regular frame rate…

  • Lu Nelson

    December 2, 2008 at 3:05 pm

    That’s an interesting way of looking at it Brian but one can’t apply multiples to the frame rate through expressions I think;

    also, applying a ‘slowing’ at the beginning and end of a value change would effectively extend the whole thing by some amount, meaning the beginning and end would no longer correspond to the KFs you set.

    I think part of the reason it’s quite challenging is that the linear section isn’t the same speed (or the graph if you will does not have the same slope) as the basic linear transition that we start with. The middle section is a constant speed but slightly faster than the whole thing would be with no eases, to compensate for the easing at beginning/end.

    Lu Nelson
    Berlin, Germany

  • Lu Nelson

    December 2, 2008 at 3:43 pm

    Hi Dan,

    a further thought now, after I responded to Brian’s post — I’m not sure that the tangents *would* match up; let me know what you think because I should have pointed this out in the first post:

    If we go back to the simple example of a linear value change over 10s, let’s say for simplicity’s sake the value is going to 0 to 10 over this time. Therefore:

    at 0s, value is 0
    at 2s, value is 2
    at 8s, value is 8
    at 10s, value is 10

    However, if we add easing in the way I’m suggesting, to the first 2s and to the last 2s, then:

    at 2s value is something less than 2
    at 8s value is something more than 8
    …and the linear section in the middle has a steeper slope than the original linear curve, in order to make up for that.
    Then, to calculate what the easing curve should be like for the first/last two seconds means being able to match tangents with a new straight line in the middle which has a slope that is being affected by how much easing time you allow — it’s all interdependent and as I say it’s even hard to do by hand since the relationship would be better exemplified by the way B-Spline curves work, rather than Bezier, but I’ve never seen a B-Spline keyframe editing interface….

    Lu Nelson
    Berlin, Germany

  • Dan Ebberts

    December 2, 2008 at 4:04 pm

    You’re right – the amount that gets eased is affected by the duration and magnitude of the linear piece. I’m confident there’s a way to calulate it, I just don’t know what it is.

    Dan

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