Activity › Forums › Adobe After Effects Expressions › looping noise()
-
looping noise()
Posted by Criszero on February 1, 2007 at 5:30 pmHi Creative Cow!
I’ve looked through the forums for advice on how to loop the noise() effect outlined in Dan Ebberts tutorial but haven’t managed to find anything. Is this possible, and if so how would you go about it?
I’m not what you’d call a code wizz so please be gentle!
Cheers,
ChrisCriszero replied 19 years, 7 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
February 1, 2007 at 7:16 pmThere’s a little slight-of-hand maneuver you can try that’s hard to explain, but works pretty well. The key point is using two equal length segments of time, the one starting at time zero and the other ending at time zero (i.e. a segment that starts before time zero). Then you use linear() to blend them so that at the start you’re using the segment that starts at time zero, but by the end of the cycle you’re using the segment that ends at time zero – returning you to your starting point. Here’s an example for an opacity expression using noise();
cycle = 2;
t = time % cycle;amp = 50;
x = position[0];
y = position[1];
z = time;xCompress = 200;
yCompress = 200;
zCompress = .2;noiseVal1 = noise([x / xCompress, y / yCompress, t / zCompress]);
noiseVal2 = noise([x / xCompress, y / yCompress, (t – cycle) / zCompress]);
50 + amp * linear(t, 0, cycle, noiseVal1, noiseVal2)By the way, you can use this technique to loop other things (like wiggle()) that don’t normally loop easily.
Dan
-
Criszero
February 2, 2007 at 10:31 amThanks for the reply Dan.
I tried adding the extra code to the noise() code I have, but I’m getting an error. Here’s what I have now:
numRows = 7;
numCols = 16;
xyCompress = 200;
speedCompress = 1;
amplitude = 100;cycle = 2;
t = time % cycle;row = Math.floor((index – 1)/numCols);
col = (index – 1)%numCols;
x = col*width + width/2;
y = row*height + height/2;
z = time;xOffset = (this_comp.width – numCols*width)/2;
yOffset = (this_comp.height – numRows*height)/2;noiseVal1 = amplitude*noise([x/xyCompress,y/xyCompress,t/speedCompress]);
noiseVal2 = amplitude*noise([x/xyCompress,y/xyCompress,(t-cycle)/speedCompress]);
50 + amp * linear(t, 0, cycle, noiseVal1, noiseVal2)[x,y,z] + [xOffset,yOffset,0]
Hey! Like I said…I’m not really a coder! Would you be able to untangle this mess?!
Thanks again for your help. Much appreciated.Chris
-
Dan Ebberts
February 5, 2007 at 11:18 pmAh, I see. Give this a try:
cycle = 2;
t = time % cycle;numRows = 7;
numCols = 16;
xyCompress = 200;
speedCompress = 1;
amplitude = 100;row = Math.floor((index – 1)/numCols);
col = (index – 1)%numCols;
x = col*width + width/2;
y = row*height + height/2;
xOffset = (this_comp.width – numCols*width)/2;
yOffset = (this_comp.height – numRows*height)/2;z1 = amplitude*noise([x/xyCompress,y/xyCompress,t/speedCompress]);
z2 = amplitude*noise([x/xyCompress,y/xyCompress,(t – cycle)/speedCompress]);
z = linear(t, 0, cycle, z1, z2);
[x,y,z] + [xOffset,yOffset,0]Dan
Reply to this Discussion! Login or Sign Up