Skip to main content
meghedim6342969
Inspiring
March 22, 2024
Répondu

I want rotation loop to slowly stop after looping a while then continue backwards

I'm using loop out expretion for a fan to continously loop.

But I want it to stop with ease after looping for maybe 2 seconds,

start continuing backwards with ease then regain speed.

Ce sujet a été fermé aux réponses.
Meilleure réponse par Dan Ebberts

This explains the issues with speed control:

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

What you'd want to do is use the linear keyframe integrator expression and key frame your slider to go forward, slow to a stop, then back up. Here's the expression, for reference:

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);
    accum += (k1.value + k2.value)*(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);
}
value + accum

 

 

1 commentaire

Dan Ebberts
Dan EbbertsRéponse
Community Expert
March 22, 2024

This explains the issues with speed control:

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

What you'd want to do is use the linear keyframe integrator expression and key frame your slider to go forward, slow to a stop, then back up. Here's the expression, for reference:

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);
    accum += (k1.value + k2.value)*(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);
}
value + accum

 

 

meghedim6342969
Inspiring
March 22, 2024

I'm very new to coding and this is a bit difficult for me to digest.

But I love challenge and this made my day !

Thank you ! 

Dan Ebberts
Community Expert
March 22, 2024

If you get stuck, just ask.