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

Controlling the Speed of offset Turbulence

New Here ,
Dec 23, 2024 Dec 23, 2024

Hi, I have a solid with fractal noise, I want the noise always going downward so the first thing that comes to my mind is using the offset turbulence parameter and increasing the Y property with the "time" expression. I also want to control the speed of movement so I added a slider control to the same solid and called it "Speed". I use this code on offset turbulence but the problem is when I animate the Speed from 10 to 5, the movement should go downward with a slower speed but it goes UP, I also make a chart to show the Y changes. I don't know what is the problem. is my math incorrect or does the code have issues?
thanks a lot.code.jpgchanges.jpg

TOPICS
Expressions , Scripting
343
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 1 Correct answer

Community Expert , Dec 23, 2024 Dec 23, 2024

This article explains what you're seeing:

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

I've modified the linear keyframe integrator to fit your situation:

spd = effect("Speed")("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.
...
Translate
Community Expert ,
Dec 23, 2024 Dec 23, 2024

This article explains what you're seeing:

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

I've modified the linear keyframe integrator to fit your situation:

spd = effect("Speed")("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 + [0,accum]
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
New Here ,
Dec 24, 2024 Dec 24, 2024
LATEST

thanks a lot for the article and the code, it worked perfectly. I didn't think coding in After Effects could be this hard.

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