Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Add “Inertial Bounce” Expression to a current Expression

  • Add “Inertial Bounce” Expression to a current Expression

    Posted by Roland R. kahlenberg on September 22, 2011 at 6:46 pm

    Following is the Inertial Bounce Expression Script –
    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;
    }
    ——————
    I now have the following Expression script in my X-rotation which is linked to the y-rotation on another layer –

    Delay = effect(“Pop-up Delay”)(“Slider”)/25;
    Source = thisComp.layer(“Page 01”).transform.yRotation.valueAtTime(time-Delay);
    ease(Source,0,180,-90,0)

    ——————-

    How do I get Inertial Bounce to work with my x-rotation script. Take note that I can’t apply the Inertial Bounce to the other layer’s y-rotation as that layer should not have the Inertial Bounce effect.

    TIA
    RoRK

    Intensive AE & Mocha Training in Asia.

    Roland R. kahlenberg replied 14 years, 8 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 23, 2011 at 1:22 am

    Hmmm…. I don’t think it will work. Because of the ease, the x-rotation will have zero velocity at the times corresponding to the y-rotation’s keyframes. No velocity, no inertial bounce. If you use the y-rotation’s velocity the bounce won’t look right.

    Dan

  • Roland R. kahlenberg

    September 23, 2011 at 2:46 am

    Thanks Dan. For my, rotation script, I changed its ‘source’ layer to a proxy layer with KFs identical to the original ‘source layer’. The proxy is of course a Null and I can apply the Inertial Bounce script to its KFs.

    This works but requires the proxy layer to be created and updated manually.

    Cheers
    RoRK

    Intensive AE & Mocha Training in Asia.

  • Dan Ebberts

    September 23, 2011 at 3:37 am

    I think you could modify the proxy layer’s bounce expression to point at the keyframed property on the original source layer. That way you wouldn’t have to update the proxy. I haven’t tested it, but it would look like this:


    p = thisComp.layer("Page 01").transform.yRotation;
    n = 0;
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n--;
    }
    if (n == 0){
    t = 0;
    }else{
    t = time - p.key(n).time;
    }

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

    Dan

  • Roland R. kahlenberg

    September 23, 2011 at 10:41 am

    That works very well Dan. Thanks a bunch!

    Regards
    RoRK

    Intensive AE & Mocha Training in Asia.

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