ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Time remap with a Slider?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alexander Noelke
Time remap with a Slider?
on Apr 22, 2014 at 8:28:06 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?


Return to posts index

Dan Ebberts
Re: Time remap with a Slider?
on Apr 22, 2014 at 9:06:33 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:

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



Dan



Return to posts index

Alexander Noelke
Re: Time remap with a Slider?
on Apr 22, 2014 at 9:35:28 pm

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


Return to posts index


Dan Ebberts
Re: Time remap with a Slider?
on Apr 22, 2014 at 9:44:53 pm

time remapping

Dan



Return to posts index

Alexander Noelke
Re: Time remap with a Slider?
on Apr 22, 2014 at 9:58:59 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


Return to posts index

Rafael Potenza
Re: Time remap with a Slider?
on Mar 17, 2017 at 3:29:43 pm

This's awesome! Thanks for sharing!


Return to posts index


Rafael Potenza
Re: Time remap with a Slider?
on Mar 17, 2017 at 5:36:30 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?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]