Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger Expression for X value

  • Trigger Expression for X value

    Posted by Victor Nash on January 3, 2008 at 8:20 pm

    I looking to fly in an object on it’s x axis and bounce to still when it hits the center mark.. I’ve added a “marker” to trigger the expression. My question is how to modify this expression to trigger the expression again further down in the timeline. It seems like the “bounce” is relative to the beginning of the ‘time’line. Thanks Guys

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n–;
    }
    }

    if (n == 0){
    value;
    }else{
    veloc = 35;
    amplitude = 150;
    decay = 4;
    t = time – marker.key(n).time;
    x = amplitude*Math.cos(veloc*time)/Math.exp(decay*time);
    value+[x,0];
    }

    Victor Nash replied 18 years, 4 months ago 2 Members · 3 Replies
  • 3 Replies
  • Victor Nash

    January 3, 2008 at 8:52 pm

    Opps I see what I did.. Thanks anyway.

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n–;
    }
    }

    if (n == 0){
    value;
    }else{
    max_dev=35; // max deviation in pixels
    spd=150; //speed of oscillation
    decay=4; //how fast it slows down
    t = time – marker.key(n).time;
    x = max_dev*Math.sin(spd*(t))/Math.exp(decay*t);
    value + [x,0];
    }

  • Dan Ebberts

    January 3, 2008 at 8:53 pm

    Just change “time” to “t” in the line that calculates the bounce, like this:

    x = amplitude*Math.cos(veloc*t)/Math.exp(decay*t);

    That should make it trigger at each marker.

    dan

  • Victor Nash

    January 3, 2008 at 8:55 pm

    haha. I beat you Dan 🙂

    When Is your Master Series of Expressions Coming Out? 🙂

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