Activity › Forums › Adobe After Effects Expressions › Loopable Wiggle?
-
Loopable Wiggle?
Posted by Cosmo on July 19, 2005 at 8:55 pmDoes anyone know an expression (of give me some hints to write my own) that will randomly wiggle a parameter but allow it to end and begin at the same value – regardless of composition length?
In the meantime I guess I’ll see how I can do..
Cheers!
CosmoFilip Vandueren replied 20 years, 10 months ago 3 Members · 3 Replies -
3 Replies
-
Filip Vandueren
July 19, 2005 at 9:58 pmHi there,
I wrote this a few months ago.
It’s based on the 2D noise-function, and uses the logic that if you follow a circle through a “noise field”, you end up at the same value.
You have to call the function and it just returns a number, so you still have to add that number to the current value.
For 2 or 3 dimensional properties (position for example), you have to call it multiple times with different seeds:
// for a 1-dimensional property: (loopTime is in seconds)
value+loopedWiggle (freq=1,amp=50, oct=2, amp_mult= .5, t=time, loopTime=3, seed=200);function loopedWiggle (freq, amp, oct, amp_mult, t, loopTime, seed) {
seedRandom(seed, timeless = true);
startPos=random([5000,5000]);radius=(loopTime/Math.PI)*freq;
// if the looptime is long, the radius should increase, otherwise the frequency would drop. 8-PmaxValue=0;
n=0;
multiplier=1;
for (i=1; i<=oct; i++) { radius=radius*(i-0.5); x=startPos[0] + Math.cos(degreesToRadians(360*t/loopTime + oct))*radius; y=startPos[1] + Math.sin(degreesToRadians(360*t/loopTime + oct))*radius; n += noise([x,y])*multiplier; maxValue += multiplier; multiplier *= amp_mult; } return n*amp; }for position (2d) you would start out with something like this:
wiggledx=loopedWiggle (freq=1,amp=50, oct=2, amp_mult= .5, t=time, loopTime=3, seed=200);
wiggledy=loopedWiggle (freq=1,amp=50, oct=2, amp_mult= .5, t=time, loopTime=3, seed=600);value+[wiggledx,wiggledy]
function
-
Dan Ebberts
July 19, 2005 at 11:05 pmThis is kind of a hack, but it actually works quite well in most situations:
freq = 1;
amp = 100;end = thisComp.duration;
delta = wiggle(freq,amp,1,0.5,0) – wiggle(freq,amp,1,0.5,end);
wiggle(freq,amp) + delta*time/endDan
Reply to this Discussion! Login or Sign Up