Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to put inertia in Wiggle exponential expression ?

  • How to put inertia in Wiggle exponential expression ?

    Posted by Stephane Audrier on January 8, 2013 at 8:39 pm

    Hi i’m looking for help !

    I’ve used Dan Ebberts expression :
    https://www.motionscript.com/articles/speed-control.html#wiggle

    I’ve used his linear keyframe integrator to the time parameter to animate the frequency of the wiggle at rotation parameter of my cg rocks (videocopilot Element 3D assets), it works fine… But my rocks look like they don’t have mass or any weight when they wiggle.
    How can i put “inertia” into the wiggle expression to fake the mass/weight of the rocks and then make it more realistic ?

    Thanks for your help.
    Stephane.

    Kevin Camp replied 13 years, 4 months ago 4 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 9, 2013 at 12:38 am

    I can’t think of any easy way to do that. I’m not sure that wiggle() is the right simulation for that kind of motion. I think you’d need a random motion generator where the expression knows the duration of the current movement so that it could add ease and overshoot to simulate mass. It’s an interesting problem, and do-able, I think, but not simple.

    Dan

  • Chris Wright

    January 9, 2013 at 8:53 am

    Jumpy Wiggle 1 makes wiggle skip and hold rather than move fluidly.

    // Jumpy Wiggle 1 (moves at a random FPS)
    v=wiggle(5,50);
    if(v < 50)v=0;
    if(v > 50)v=100;
    v

    Jumpy Wiggle 2 is similar to 1, but works at a defined FPS so your “jump” will happen at a regular pace.

    // Jumpy Wiggle 2 (moves at a defined FPS)
    fps=5; //frequency
    amount=50; //amplitude
    wiggle(fps,amount,octaves = 1, amp_mult = 0.5,(Math.round(time*fps))/fps);

    Inertial Bounce is like making your moves “rubbery.” Layers will overextend, then settle into place on position and rotation keyframes.

    // Inertial Bounce (moves settle into place after bouncing around a little)
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time){
    n–;
    }
    }
    if (n == 0){
    t = 0;
    }else{
    t = time – key(n).time;
    }

    if (n > 0){
    v = velocityAtTime(key(n).time – thisComp.frameDuration/10);
    amp = .05;
    freq = 4.0;
    decay = 2.0;
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{
    value;
    }

    Sometimes you just want something to move constantly without keyframing it. Use throw.

    // Throw (move at a constant speed without keyframes)
    veloc = -10; //horizontal velocity (pixels per second)
    x = position[0] + (time – inPoint) *veloc;
    y = position[1];
    [x,y]

    Same as throw, but for rotation.

    // Spin (rotate at a constant speed without keyframes)
    veloc = 360; //rotational velocity (degrees per second)
    r = rotation + (time – inPoint) *veloc;
    [r]

    A shoutout to the brilliant folks at aenhancers.com who provided in whole or in part the basis for all of these expressions.

  • Stephane Audrier

    January 10, 2013 at 3:02 pm

    Hi !

    Thanks Chris for your answer, there are some usefull expressions here (i Think for the last one you can also use time*360, it works too), but unfortunately they don’t give the result that i want to achieve.

    I would like to fake an earthquake effect, that grows over time and add ease/inertia in the shake of my rocks to simulate they have mass, to make more real…

    Dan, thanks for your interest, i don’t know how to get that kind of motion… Maybe with using “Newton Motion Boutique” simulation datas ?

    Stephane.

  • Kevin Camp

    January 10, 2013 at 5:24 pm

    for control over the varying amount of shake, add a slider control (effects>expression controls>slider control) to the layer with the expression (or to a null). then use the expression pickwhip to link the slider value to the wiggle amount value in the expression.

    then you can keyframe the slider value to increase and decrease as needed.

    for the inertial response of the rocks, i think i might just try a simple valueAtTime() expression to offset the movement of the first wiggle expression and see how close that gets you:

    target = thisLayer("EarthQuake").position // change this to the layer with the wiggle expression
    offsetTime = .5 // change this value to change the offset time (in seconds)
    target.valueAtTime(time-offsetTime)

    you could also link the offsetTime value to a slider control and animate the amount of offset.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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