Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Accelerating Rotation through Expressions and Slider

Explorer ,
Mar 13, 2025 Mar 13, 2025

Hi, I'm trying to do here an accelerating rotation, but I'm just unable to solve one issue. 

 

I have here a wind turbine, which is rotation in constant speed, however in One moment, I want it to speed up to reach a set peek of speed and then slowly slow down to normal speed. 

 

I'v set up expressions on the rotation:

baseSpeed = 100;
boostAmount = effect("Boost")("Slider");
value + time * (baseSpeed + boostAmount);

I'v added Slider, named it Boost and set up 3 keyframes at values 0-100-0, added Easy In and Out. 

 

However I found out, that during the peek speed, the turbine rotation switches to the other direction and in the end slowly stops and starts rotating back its original direction. When I look at the speed graph,i guess it is trying to compensate the value of speed, which went up, by doing it in negative values. Which in many cases is necessary in order of the rules of physics, but here it is not.

Tygnar_0-1741861660593.pngexpand image

Tygnar_1-1741861787399.pngexpand image

 

I'v tried to find solution on the internet and tried to solve it through ChatGPT, but I wasn't successful. 

 

TOPICS
Expressions , How to
225
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Mar 13, 2025 Mar 13, 2025

It's not that simple. From Dan Ebbert's Motionscript site, use this expression:

 

spd = effect("Boost")("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*
...
Translate
Community Expert , Mar 15, 2025 Mar 15, 2025

My guess is that you're using eased keyframes on your slider, which won't work with the linear keyframe integrator expression. To fix it, you can try switching your keyframes to linear, which might work because the expression creates a built-in easing. Or, you can switch to the brute-force, frame-by-frame method described further down in the article:

https://motionscript.com/articles/speed-control.html#frame-by-frame

which would end up looking  like this:

baseSpeed = 100;
spd = effect("Boost")("
...
Translate
Community Expert ,
Mar 13, 2025 Mar 13, 2025

It's not that simple. From Dan Ebbert's Motionscript site, use this expression:

 

spd = effect("Boost")("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

 

Then, you animate the slider from the number of degrees per second that you want to start with (360 = 1 rotation per second) to the fastest speed (700 = slightly less than two rotations per second) and back to a constant speed. 

 

The other thing you have to worry about is the stroboscopic effect. As the rotation speed increases, it can make the blades appear to change direction. This is commonly seen in footage of airplane propellers and stagecoach wheels in Western movies. Motion blur can help mitigate some of those problems.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 15, 2025 Mar 15, 2025

Thank you very much, its working, but with one weird movement, which seems persist no matter how I adjust the values ​​and placement of the keyframes ... It is not a big deal, but its not fully smooth either. In the end of deaccelerating, there's like a jerk forward in the direction of rotation, like 30-45 degrees maybe. I'v recorded it on the following link ... the two left wind turbines have same configurations, just in different time and have same jerk => https://ctrlv.tv/c1wW

 

I'm also trying to figure out one more thing, which shouldn't be difficult, but in these circumstances, I'v just wasn't able to do it. The idea is to create a simple light reflection on solar panel, without loop. Normally I could create like a Mask through Track Matte or maybe with Merge Paths, but here I cannot. I'v created a simple Rectangle, which I want to move across the panel and then maybe add some effect, but thats not important. However I need the Rectangle to be visible only on the surface of the blue parts of the panel, which are seperated in Group 12 (Group 1-9) and there's the struggle, as I don't know, how to do it with the Groups. It's a bit inconvenient, but the resources were already givin to me in these conditions, so I have no choice. 

Tygnar_0-1742057450324.pngexpand image

Thank you, for your help and time

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2025 Mar 15, 2025

My guess is that you're using eased keyframes on your slider, which won't work with the linear keyframe integrator expression. To fix it, you can try switching your keyframes to linear, which might work because the expression creates a built-in easing. Or, you can switch to the brute-force, frame-by-frame method described further down in the article:

https://motionscript.com/articles/speed-control.html#frame-by-frame

which would end up looking  like this:

baseSpeed = 100;
spd = effect("Boost")("Slider");
accum = 0;
for (i = timeToFrames(inPoint); i <= timeToFrames(time); i++){
  accum += spd.valueAtTime(framesToTime(i));
}
value + time*baseSpeed + accum*thisComp.frameDuration

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 15, 2025 Mar 15, 2025
LATEST

I changed it into Linear keyframes, it smoothen the whole animation and fixed the weird jerk in the end, thank you ... now I just need someone to advise me with the reflection on the solar panel 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines