Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Inertia expression keeps turning itself off

  • Ale Elizondo

    February 4, 2015 at 10:46 pm

    There is an error on this line :/:

    “Class global has no property or method named “t”

  • Dan Ebberts

    February 4, 2015 at 10:51 pm

    Ah yes, sorry.

    you need to also move the definition of t outside the conditional. So change this:

    if (n == kf){
    t = time – key(n).time;

    to this:

    t = time – key(n).time;
    if ((n == kf) && (t < 5)){

    Dan

  • Dan Ebberts

    February 4, 2015 at 10:59 pm

    Nah, that’s not going to work either. Give me a minute…

    Dan

  • Dan Ebberts

    February 4, 2015 at 11:05 pm

    That’s what I get for not testing it. This should work:


    amp = .2;
    freq = 3;
    decay = 2;
    kf = 2; // only on 2nd keyframe
    n = 0;
    if (numKeys > 0){
    n = nearestKey(time).index;
    if (key(n).time > time) n--;
    }
    if (n == kf){
    t = time - key(n).time;
    if (t < 5){
    v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
    temp = value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    x = temp[0];
    y = value[0]*value[1]/x;
    [x,y]
    }else{
    value
    }
    }else
    value

    Dan

  • Ale Elizondo

    February 5, 2015 at 3:53 pm

    How forever thanks Dan!!! 😀 this works perfect and you saved me a lot of time and problems.

Page 2 of 2

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