Copy link to clipboard
Copied
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.
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.
...
Copy link to clipboard
Copied
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]
Copy link to clipboard
Copied
thanks a lot for the article and the code, it worked perfectly. I didn't think coding in After Effects could be this hard.