Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions wiggle even more randomly, more extremely

  • wiggle even more randomly, more extremely

    Posted by Roger Maus on October 25, 2013 at 11:46 am

    Hi,

    how would modify a wiggle to be more extreme?

    In my special case, the wiggle algorithm is simply too balanced.

    Values should change more rarely, but if they do, to extremer values.

    Until now, I helped myself out by multiplying the same wiggle, like:

    wiggle(1,2)*wiggle(1,2)*wiggle(1,2)-value

    But this construction is quite uncontrollable, and almost too extreme, since I have to multiply it three times to maintain negative values.

    what would you do?

    Dan Ebberts replied 12 years, 6 months ago 3 Members · 9 Replies
  • 9 Replies
  • Darby Edelen

    October 26, 2013 at 5:31 am

    It’s not entirely clear what you’re after from your description but here are a couple of things to try.

    You could use the linear() or ease() expression to remap the wiggle():


    frequency = 1;
    magnitude = 2;
    w = wiggle(frequency,magnitude) - value;
    value + linear(w, -magnitude / 10, magnitude / 10, -magnitude, magnitude);

    Something like the above would make the transition from ‘-magnitude’ to ‘magnitude’ much more extreme, and the expression would be likely to hold those values for a short amount of time before changing. The above example assumes a one dimensional property (like opacity or rotation) instead of a 2D or 3D property (like position).

    Another interesting option for wiggle() is to use the octaves parameter of the wiggle() to add more layers of complexity:

    wiggle(1,2,3);

    The above essentially combines 3 unique wiggles together. This results in more high frequency wiggling without dramatically changing the overall curve of the original wiggle (it adds more detail).

    This is conceptually similar to modifying the Complexity parameter of the Fractal Noise effect. The default wiggle() has a complexity of 1 (only 1 octave) which is not very detailed.

    Darby Edelen

  • Roger Maus

    October 26, 2013 at 5:41 pm

    Thanks for your response! Holding a value is not what I wanted, but increasing the octaves is something I will use more often now.
    Until now I achieved this by combining two different wiggles, like:
    wiggle(.5,100)+wiggle(3,5)-value

    Sorry that I did not make clear what I want to achieve. I will give it another try.

    This is a normal, default wiggle:

    This is a wiggle that I’d like to get (NB: different scale):

    See? Values more extreme, but rarer. Values are most of the time around zero, but amplitudes are more “severe”.

  • Darby Edelen

    October 27, 2013 at 9:37 pm

    Well one option to simplify your expression while adding some additional functionality might be to use the Math.pow() function and account for negative returned values when the exponent is evenly divisible by 2. For example:

    sign = 1;
    exp = 3;
    w = wiggle(2,4);
    if((w < 0)&&!(exp % 2)) sign = -1;
    sign * Math.pow(w, exp);

    The more you increase the ‘exp’ value the more extreme and infrequent the returned values will be.

    Something to consider, however, is that this “more extreme and infrequent” behavior will only occur when the value is wiggling around 0. If you want to get the same behavior around other values it’ll take a slightly different approach:

    sign = 1;
    exp = 3;
    w = wiggle(2,4) - value;
    if((w < 0)&&!(exp % 2)) sign = -1;
    (sign * Math.pow(w, exp)) + value;

    Another thing to consider is that as the amplitude of your wiggle increases the Math.pow() function will make the return values exponentially more extreme. You could eliminate that behavior by doing something like this (this would be my preferred expression):

    f = 2;
    a = 4;
    exp = 3;
    sign = 1;
    w = wiggle(f,1) - value;
    if((w < 0)&&!(exp % 2)) sign = -1;
    (sign * a * Math.pow(w, exp)) + value;

    So now you have control over the spacing of the spikes in the wiggle with the ‘exp’ value and separate control over the base frequency with the ‘f’ value and the maximum/minimum intensity with the ‘a’ value.

    Darby Edelen

  • Darby Edelen

    October 28, 2013 at 4:55 am

    I’ve noticed that the last expression I posted behaves a little strangely so I’d no longer necessarily recommend it 🙂

    Darby Edelen

  • Roger Maus

    November 5, 2013 at 2:06 am

    Sorry for the late reply. It works perfectly – all three variations.

  • Roger Maus

    November 11, 2013 at 4:39 am

    Can somebody please help me getting this into 3D?

    All the before mentioned code works perfectly for a single value, but I can’s manage to apply it to the position property of a 3D layer.

    (Can’t tell exactly, but in the end it was always an error either due to div by zero or “mul() needs a scalar”)

  • Roger Maus

    November 13, 2013 at 2:30 pm

    x = Math.pow(wiggle(1,10,3)[0]-value[0],3)+value[0];
    y = Math.pow(wiggle(1,10,3)[1]-value[1],3)+value[1];
    z = Math.pow(wiggle(.5,5,.2)[2]-value[2],3)+value[2];
    [x, y, z]

    Can’t exactly tell why, but it works!

  • Roger Maus

    November 19, 2013 at 2:13 pm

    Sorry for warming this up again, but how can I get rid of the following error:
    Bad method arguments: one argument to mul() must be a scalar
    This is the faulty expression (on a 3D layer):
    x = wiggle(.5,150,3);
    y = wiggle(.5,50,2);
    z = wiggle(.1,5,2)*wiggle(.1,5,2)*wiggle(.1,5,2); //faulty line
    [x[0], y[1], z[2]]

    Is the solution to convert a vector to a scalar?

  • Dan Ebberts

    November 19, 2013 at 3:12 pm

    Try it this way:

    x = wiggle(.5,150,3)[0];
    y = wiggle(.5,50,2)[1];
    z = wiggle(.1,5,2)[2]*wiggle(.1,5,2)[2]*wiggle(.1,5,2)[2];
    [x, y, z]

    Or maybe,

    x = wiggle(.5,150,3)[0];
    y = wiggle(.5,50,2)[1];
    z = wiggle(.1,5,2)[2];
    [x, y, z*z*Z]

    Dan

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