Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity › Forums › Adobe After Effects Expressions › looping noise()

  • Posted by Criszero on February 1, 2007 at 5:30 pm

    Hi 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,
    Chris

    Criszero replied 19 years, 7 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 1, 2007 at 7:16 pm

    There’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 am

    Thanks 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 pm

    Ah, 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

  • Criszero

    February 6, 2007 at 2:55 pm

    Ha haaa!! Yay! That’s great. Thank you Dan

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy