Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Inertia expression with delay

  • Inertia expression with delay

  • Sami Bayley

    September 15, 2021 at 9:33 am

    I believe I’m using Dan Ebbert’s inertia scripts that has been modified by someone here:


    <font color=”#999999″ size=”1″>//inertial children bounce (apply on “position”)</font>

    <font color=”#999999″ size=”1″>n = 0;</font>

    <font color=”#999999″ size=”1″>amp = 2;</font>

    <font color=”#999999″ size=”1″>freq = 1;</font>

    <font color=”#999999″ size=”1″>decay = 4;</font>

    <font color=”#999999″ size=”1″>ppos=thisLayer.parent.transform.position;</font>

    <font color=”#999999″ size=”1″>if (ppos.numKeys > 0){</font>

    <font color=”#999999″ size=”1″>n = ppos.nearestKey(time).index;</font>

    <font color=”#999999″ size=”1″>if (ppos.key(n).time > time){</font>

    <font color=”#999999″ size=”1″>n–;</font>

    <font color=”#999999″ size=”1″>}</font>

    <font color=”#999999″ size=”1″>}</font>

    <font color=”#999999″ size=”1″>if (n == 0){</font>

    <font color=”#999999″ size=”1″>ppos.velocity</font>

    <font color=”#999999″ size=”1″>t = 100;</font>

    <font color=”#999999″ size=”1″>}else{</font>

    <font color=”#999999″ size=”1″>t = time – ppos.key(n).time;</font>

    <font color=”#999999″ size=”1″>}</font>

    <font color=”#999999″ size=”1″>if (n > 0){</font>

    <font color=”#999999″ size=”1″>v = ppos.velocityAtTime(ppos.key(n).time – thisComp.frameDuration/10);</font>

    <font color=”#999999″ size=”1″>value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);</font>

    <font color=”#999999″ size=”1″>}else{</font>

    <font color=”#999999″ size=”1″>value</font>

    <font color=”#999999″ size=”1″>}</font>

    This layer (L ARM CONTROLLER) is the parent of another Null named “L ARM”.

    Which has this expression on its position:

    <font size=”1″ color=”#999999″>delay = .03;</font>

    <font size=”1″ color=”#999999″>parent.fromWorld(toWorld(anchorPoint,time-delay))</font>

    The aim is basically have the arm react slightly delayed to the body (L ARM CONTROLLER is child of BODY CONTROLLER which holds positional keyframe data), to have the arm ‘drag’ behind the body. However, the inertia happens without the delay, so the arm is wiggling before it come’s to its final resting place.

    I’ve spent a good 5-6 hours trying to get this to work so some help would be greatly appreciated!


Viewing 1 of 1 posts

Log in to reply.

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