Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression help (please)

  • Expression help (please)

    Posted by Guy on January 7, 2006 at 8:48 pm

    I am trying to wiggle the position of a lyer only on the x axis.

    what I have so far gives me an error message:

    x = seedRandom(15,true); wiggle(.5,500);
    y = position[1];
    [x, y]

    any way to do this?

    thanks!

    Filip Vandueren replied 20 years, 4 months ago 3 Members · 4 Replies
  • 4 Replies
  • John Dickinson

    January 7, 2006 at 9:05 pm

    This is one way:

    wigfreq = 5; //wiggle frequency
    wigangle = 45; //wiggle amplitude
    wignoise = 3; //octaves of noise
    just = wiggle(wigfreq, wigangle, wignoise);
    [position[0], just[1]] //will wiggle just on Y.

    JD

    John Dickinson
    Motionworks
    http://www.motionworks.com.au

  • Guy

    January 7, 2006 at 10:38 pm

    excellent, thanks. One more question?

    How can I limit the number that this expression returns to be 0 to 100?

    thanks!!!

  • John Dickinson

    January 7, 2006 at 11:03 pm

    There is probably a very specific way that someone more versed in expressions could suggest but one way to limit the returned value is to use a simple math modifier. Here I’ve halved the return value for the Y property by adding “/2”

    [position[0], just[1]/2]

    John Dickinson
    Motionworks
    http://www.motionworks.com.au

  • Filip Vandueren

    January 8, 2006 at 1:03 am

    Theoretically if you Wiggle a property that has a start-value of 50, with an amplitude of 50
    you should get values of 50, plus or minus 50, so that would be 0-100

    But in reality, you’ll find the value will sometimes drop beneath 0 and over 100, particularly if you use more than one ‘noise-octave’.

    Again in theory, this:

    wigfreq = 5; //wiggle frequency
    wigangle = 45; //wiggle amplitude
    wignoise = 3; //octaves of noise
    just = wiggle(wigfreq, wigangle, wignoise, 0.5);

    (the multiplier defaults to 0.5 I believe, but you can set it explicitly as a 4th parameter in wiggle)

    would give values plus or minus 78.75
    ->
    45 + 45*0.5 + 45*(0.5*0.5) = 78.75

    so to have a range of 0-100 you should set the default (keyframed) value to 50,
    and use an amplitude of about 28.57.

    because:

    28.57 + 28.57*0.5 +28.57*(0.5*0.5) = 50

    In reality the chance that you get values that are near 0 or near 100 will be very low, because this only happens if the 3 random numbers from each of the octaves are all equal to 1 or equal to 0.
    So perhaps it’s best to use only one octave, the wiggle will be smoother, but also you will get more extreme values.

    an alternative is to set the multiplier to 1, and amp to 16.66 (50/3 octaves)
    wiggle(wigfreq, wigangle, wignoise, 1);

    you’ll get 16.66 + 16.66 + 16.66 = 50

    this will give a harsher more aggressive wiggle

    If this multiplier & octaves stuff is a bit confusing, do a google on “Perlin noise”.
    In essence it’s the same as ‘complexity’ in the fractal noise plug-in.

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