Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Only want one part of a sin curve…?

  • Only want one part of a sin curve…?

    Posted by Darryl Torke on May 12, 2014 at 8:14 pm

    I’m trying to make continuous motion using Math.sin(time) on a positions Y value. The effect I get is as expected, a yo-yo type effect (up-down-up-down). However, what I’d like ideally is only one section/direction of movement (up-(reset to starting point)-up), etc.

    Basically only to ignore the 2nd half of the sine curve.

    I hope this makes sense.

    Kevin Camp replied 12 years ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 13, 2014 at 12:15 am

    It would help to see your expression, but if you wrap the Math.sin() calculation in Math.abs() it will make both halves of the sine wave positive. You might then have to add a minus sign if you want the value to instead always be negative:

    -Math.abs(Math.sin(xxx));

    Dan

  • Kevin Camp

    May 13, 2014 at 5:05 pm

    if you just wanted the positive values on the upward swing (then jump back to the original y value and repeat), then this might work for you.:

    yAmp = 200; // max y offset value
    y = Math.abs(Math.sin(time%(Math.PI/2)))*yAmp;
    value – [0,y]

    Kevin Camp
    Art Director
    KCPQ, KZJO & KRCW

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