Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggle… amplify on Z axis

  • Wiggle… amplify on Z axis

    Posted by Robert Morris on October 12, 2007 at 9:23 pm

    Hello all expression gurus. I am working on an animation where I have a camera with a wiggle expression applied to it, and the wiggle’s value tied to a slider. What I want to do is have the camera position wiggle on all axis (which it does now), but have the Z axis more pronounced as if the camera is being jerked forward and backward. I supposed I could tie it to a separate wiggle slider and just have the value higher. But is there a way to tie it all to the one slider that controls the amount of wiggle? This is what I tried, but it doesn’t really work:

    x = wiggle(3,thisComp.layer(“null”).effect(“Slider Control”)(“Slider”));
    y = wiggle(3,thisComp.layer(“null”).effect(“Slider Control”)(“Slider”));
    z = wiggle(3,thisComp.layer(“null”).effect(“Slider Control”)(“Slider”))*5;
    [x[0], y[1], z[2]];

    Help?
    -Robert

    Darby Edelen replied 18 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 12, 2007 at 9:40 pm

    This should work:

    zMult = 5;
    w = wiggle(3,thisComp.layer(“null”).effect(“Slider Control”)(“Slider”)) – value;
    value + [w[0],w[1],w[2]*zMult]

    Dan

  • Robert Morris

    October 12, 2007 at 9:55 pm

    Awesome! That seemed to work. I’m a bit fried to figure out why, but it does. Thank you. I’m new to expressions, but I hope to slowly learn more and more.

    Thanks, Dan!

  • Darby Edelen

    October 16, 2007 at 11:28 pm

    The wiggle() function returns a modified version of what it is supplied. What this means is that if you have a layer at [360, 240, 200] and apply an expression that reads wiggle(1, 5) you will get results between [355, 235, 195] and [365, 245, 205].

    In your earlier example you were multiplying the results of wiggle() directly. With our previous example and your expression you would get results between [355, 235, 975] and [365, 245, 1025], not only is that a difference of 50 on the Z-axis (5 * 5 should be a difference of 25) but it’s much much farther away on the Z-axis than it should be! What gives?

    What you want to do is multiply the offset that the wiggle() is generating, not the result itself. In Dan’s expression wiggle(3,thisComp.layer("null").effect("Slider Control")("Slider")) - value; gives you the difference between the layer’s ‘normal’ position and it’s wiggled position (in the example we’ve been using this would be values between [5,5,5] and [0,0,0]).

    You don’t want to use this offset directly in your result, instead you want to multiply the offset’s Z value by 5 (giving us [5,5,25]) and then add the original position back into this vector, again from Dan’s expression:

    value + [w[0],w[1],w[2]*zMult]

    The other thing to note about Dan’s expression is that he only used wiggle() once and assigned that value to a variable. This cleaner for the position property because wiggle() will give you a vector in the form of [x,y,z] when applied to the position property. Calling wiggle() three times will give you 3 different [x,y,z] vectors (9 total values of which you’re only using 3) and take (theoretically) three times as long to compute.

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

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