Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Time remap with a Slider?

  • Time remap with a Slider?

    Posted by Alexander Noelke on April 22, 2014 at 8:28 pm

    I’m interested in finding a way to manipulate the playback speed of a clip and have it be controlled by a slider.

    I have a waveform that I have converted into keyframes, and I have a linear value expression on the slider to change the values to whatever I need. However I can’t parent any time remapping control to a slider as it’s based off timecode and not a value

    The desired effect would be something like this:

    when the slider’s value is 100, the clip plays at 100% of normal speed
    when the slider’s value is 0, the clip is frozen

    Simple in theory, but I can’t find a simple way to execute it.

    I’ve only been using expression for a short time, and I know very little about JavaScript, maybe I could be using some sort of equation?

    Rafael Potenza replied 9 years, 5 months ago 3 Members · 6 Replies
  • 6 Replies
  • Dan Ebberts

    April 22, 2014 at 9:06 pm

    It’s not as simple as it seems. This should work for a slider with linear keyframes:


    spd = effect("Slider Control")("Slider");
    n = spd.numKeys;
    if (n > 0 && spd.key(1).time < time){
    accum = spd.key(1).value*(spd.key(1).time - inPoint);
    for (i = 2; i <= n; i++){
    if (spd.key(i).time > time) break;
    k1 = spd.key(i-1);
    k2 = spd.key(i);
    v2 = spd.valueAtTime(k2.time-.001);
    accum += (k1.value + v2)*(k2.time - k1.time)/2;
    }
    accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
    }else{
    accum = spd.value*(time - inPoint);
    }
    accum/100

    You’ll have to change the first line to get it attached to your slider.

    More info here:

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

    Dan

  • Alexander Noelke

    April 22, 2014 at 9:35 pm

    what would you add that expression too? a slider that you add to the clip? or on the time remapping effect itself?

  • Dan Ebberts

    April 22, 2014 at 9:44 pm

    time remapping

    Dan

  • Alexander Noelke

    April 22, 2014 at 9:58 pm

    works perfectly, thank you! I’ll throw a link to the completed video on this thread when done, though that won’t be for a while ha

  • Rafael Potenza

    March 17, 2017 at 3:29 pm

    This’s awesome! Thanks for sharing!

  • Rafael Potenza

    March 17, 2017 at 5:36 pm

    I’m wondering if there’s a way to divide the pre comp that has time remapping effect in 3. Let me explain: i have a lower third animation, and there’s an animation in, animation out and an animation in the whole scene. If i apply the script above and set a slower velocity it will make the whole animation slow. But the animation in and animation out should NOT be affected, just the animation in the middle.
    Here’s a gif of the animation: https://media.giphy.com/media/l0Iyh1bcst7iEjSSI/giphy.gif
    The “cube in” and “cube out” should have the same time and just the middle of animation should be longer, making this animation slower (as i stretched the duration).
    Can anybody help me?

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