Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Questions about the wiggle expression

  • Questions about the wiggle expression

    Posted by Sam Parker on May 12, 2016 at 3:58 pm

    With the wiggle expression, say it were to be wiggle(10,10) and the position of the object was at 960, 540, would it always be 10 pixels away from 960, 540 or does it move in any direction and doesn’t remember the initial position?

    If it is only around the initial position then is there an expression that would make it not remember the first position?

    Thanks

    wiggle(10,10)

    Filip Vandueren replied 10 years ago 4 Members · 3 Replies
  • 3 Replies
  • Xavier Gomez

    May 12, 2016 at 4:35 pm

    It is around the current trajectory (keyframes).
    If you don’t animate, it stays around the same point.

    If any trajectory suits you, you can try something like this:

    wiggle(0.2, 300) + wiggle(10, 10) – value;

    (the first wiggle is to give a random trajectory, still around a point though, and the second to wiggle around it).

    Xavier

  • Eddy Elliott

    May 14, 2016 at 11:52 pm

    The wiggle expression always wiggles relative to the position of the layer.
    wiggle(10,10) would wiggle 10 pixels away from the position of 960 x 540, 10 times every second.
    If you wanted a random motion not related to the position, around the full area of the comp you could try this:

    frequency=3 // change this value to set the speed
    posterizeTime(frequency);
    x=random(thisComp.width);
    y=random(thisComp.height);
    [x,y]

  • Filip Vandueren

    May 16, 2016 at 12:19 pm

    Expressions are not very good at the type of thing you want, because while you describe it as “the expression needs to forget the initial position”, it actually has to remember everything it has done before: a sort of running counter, of where it was the frame before, and then add a random value to that.

    Here’s an example of some kind of brownian motion or “random walk”; it is pretty inefficient, and the amp and frequency values don’t correspond 1 to 1 to their wiggle() counterparts, but you can get there with some tweaking

    p=value;
    brown=[0,0];

    f=10;
    amp=10;

    for(t=0;t<time;t+=thisComp.frameDuration) {
    brown+=[noise([t*f,0]),noise([-t*f,1234])];
    }

    p+brown*amp;

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