Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Pendulum expression that works with external values please?

  • Pendulum expression that works with external values please?

    Posted by Lasse Gjertsen on July 25, 2013 at 11:10 pm

    Hi there.

    I have rigged a character, and her hair is linked to the rotation of the head, body and torso with a time delay to automate the hair movement (i.e. the hair stays downwards), with the possibility of keyframing via expression controls.

    But it doesn’t look completely right yet, and I want to include a pendulum-ish expression, which in theory would work great!

    I found an expression online (which I modified a bit to make it easier to see what’s going on, since I’m pretty new to Java-language), but it’s not working properly.

    It seems that I can’t use this expression with external values, i.e. only the keyframes in the same property has any effect on the expression. Are there any clever workarounds to this? Or perhaps another type of expression?

    Thank you!

    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*0.1);
    amp=50;
    freq=5.0;
    decay=5.0;
    value+(v*0.01)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
    }else{;
    value;

    Lasse Gjertsen replied 12 years, 9 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

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