Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Speed expression with keyframes

  • Speed expression with keyframes

    Posted by Lloyd Alvarez on August 30, 2012 at 4:59 pm

    I have a layer speed controller that works great without keyframes but would love to add keyframable speed. Here is what I have now:

    spd = effect(“Slide Speed (px/sec)”)(“Slider”);
    [time*(spd), 0];

    This makes the layer ‘slide’ at the speed set in the slider. Problem is that is I keyframe that value then the speed transition no longer works. How can I modify the expression so that I can keyframe the speed and the layer continues in the place but at a different speed?

    Dan Ebberts
    replied 13 years, 8 months ago
    2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    August 30, 2012 at 6:11 pm

    Lloyd,

    It sounds like you need a linear keyframe integrator:

    https://www.motionscript.com/articles/speed-control.html#linear

    Dan

  • Lloyd Alvarez

    August 30, 2012 at 6:38 pm

    Hi Dan,

    Thanks that is exactly what I was looking for. Should have checked your site! Love the new design by the way.

    One note, though. If you use Hold keyframes you get a bump in the value graph:

    Works great with linear keyframes. 🙂

    https://aescripts.com

  • Dan Ebberts

    August 30, 2012 at 9:22 pm

    Lloyd,

    Good catch. I didn’t really think about hold keyframes. You just have to replace the last line of the for loop with:

    v2 = spd.valueAtTime(k2.time-.001);
    accum += (k1.value + v2)*(k2.time – k1.time)/2;

    It’s a tiny bit less accurate, so I don’t think I’d use this version with linear keyframes, but it seems to get the job done for hold keyframes. I’ll have to update the article. Thanks!

    Dan

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