Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions an expression for a loop-able wiggle

  • an expression for a loop-able wiggle

    Posted by Filip Vandueren on June 10, 2005 at 9:10 am

    Hi all,

    not sure if something like this has been posted before, but I think I rememebr seeing the question sometimes.
    if you find you need to wiggle something, but you want it to loop seamlessly, you can use this function:

    function loopedRandom (t, loopTime, seed) {
        seedRandom(seed, timeless = true);
        startPos=random([5000,5000])
        
        radius=0.25; 
        
        x=startPos[0] + Math.cos(degreesToRadians(360*t/loopTime))*radius
        y=startPos[1] + Math.sin(degreesToRadians(360*t/loopTime))*radius
    
        return noise([x,y])
    }

    This function returns a value between 0 and 1, based on t and it will return the same value every loopTime seconds.
    Unfortunately, it doesn’t have frequency and octaves like wiggle, but by increasing the radius-value you get faster changing results.
    It works by sampling the values in a noise-field on a circular path. (see Dan Ebberts’ tut. on After Effects Hidden Gem: noise() for more info on noise)

    for example use it like this:

    position + [ loopedRandom(time,10,1) , loopedRandom(time,10,2) ]*50 // 2-dimensional -> call twice with diff. seed
    
    function loopedRandom (t, loopTime, seed) {
       ...
    }
    Mylenium replied 19 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Mylenium

    June 10, 2005 at 9:30 am

    Kinda cool ;o).

    Mylenium

    [Pour Myl

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