Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Adding Inertia or Bounce on a Shape Layers Path?

  • Adding Inertia or Bounce on a Shape Layers Path?

    Posted by Ryan Cuppernull on August 19, 2015 at 6:31 pm

    I was wondering if it is possible to add an intertial bounce to the the path property of a shape layer?

    I have a shape layer with one filled path within a group, I have animated the path property of this shape to grow and want to add an intertial bounce (or any bounce) to this growth. When I try to add the expression, I receive the error “After Effects error: can’t compute derivative to a non-spatial custom value ( 29 :: 57 )”.

    I did some digging and could only find this thread about using expressions on paths, and am wondering if there is a way to make my path bounce via expressions.

    The expression I am trying is from here, and I’ve included it in the post as well. Thanks for any help!

    amp = .1;
    freq = 2.0;
    decay = 2.0;
    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 && t < 1){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{value}

    Stefan Saw replied 6 years, 7 months ago 6 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    August 19, 2015 at 7:30 pm

    I don’t think there’s a good way to get there with expressions because expressions can’t do any math on paths. You can link to other paths and use valueAtTime(), but that’s pretty much it.

    Dan

  • Ryan Cuppernull

    August 20, 2015 at 1:39 pm

    Gotcha. Thanks for the confirmation on that. I wonder if it is a technical limitation in scripting, or if it could be a feature request.

    Thanks for the help!

  • Santi Agustí

    March 22, 2018 at 11:50 pm

    Hi!
    sorry for bringing back this old post,
    do you think it’s now possible to add bounciness to a shape layer path animation with the new cc 2018 features?

  • Dan Ebberts

    March 23, 2018 at 6:25 am

    Yes, it seems to work. It simplifies things if you can assume that the tangents remain constant and that the number of points doesn’t change. Something like this should work:


    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if(key(n).time > time) n--;
    }
    if (n > 0){
    p0 = thisProperty.points(key(n).time - thisComp.frameDuration/10);
    p1 = thisProperty.points(key(n).time);
    p = [];
    pCur = thisProperty.points();
    t = time - key(n).time;
    freq = 3.0;
    decay = 5.0;
    m = Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    for (i = 0; i < p0.length; i++){
    v = (p1[i] - p0[i])*10*m;
    p.push(pCur[i] + v);
    }
    createPath(p,thisProperty.inTangents(),thisProperty.outTangents(),thisProperty.isClosed());
    }else
    value

    Dan

  • Santi Agustí

    March 23, 2018 at 7:55 am

    totally awesome, thanks!

  • Manojit Ghose

    January 23, 2019 at 6:35 pm

    <3

    manojit ghose
    +48512875636
    skype/ gtalk: manojitghose

  • Jacob Resch

    May 29, 2019 at 9:48 am

    Just wanted to add to this as the initial expression doesn’t have an amplitude which you can adjust.
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if(key(n).time > time) n--;
    }
    if (n > 0){
    p0 = thisProperty.points(key(n).time - thisComp.frameDuration/10);
    p1 = thisProperty.points(key(n).time);
    p = [];
    pCur = thisProperty.points();
    t = time - key(n).time;
    freq = 3.0;
    decay = 5.0;
    amplitude = 0.08
    m = (amplitude * Math.sin(freq*t*2*Math.PI))/Math.exp(decay*t);
    for (i = 0; i < p0.length; i++){
    v = (p1[i] - p0[i])*10*m;
    p.push(pCur[i] + v);
    }
    createPath(p,thisProperty.inTangents(),thisProperty.outTangents(),thisProperty.isClosed());
    }else
    value

    added an amplitude to this

  • Stefan Saw

    November 5, 2019 at 1:11 am

    Awesome! Thanks! Very usefull!

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