Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Anthony Faulkner on June 3, 2009 at 7:29 am

    Hi there

    Im very new to expressions, and am using this..

    veloc = 7;
    amplitude = 80;
    decay = 0.7;

    amplitude*Math.sin(veloc*time)/Math.exp(decay*time)

    to swing a rope. I have changed the decay to zero to have it swing 4 times, then i want it to begin decaying to a stop.

    Is there a simple addition to this expression to allow that to happen?

    thanks

    Anthony

    Nathaniel Schweinberg replied 16 years, 6 months ago 4 Members · 4 Replies
  • 4 Replies
  • Koby Goldberg

    June 3, 2009 at 9:45 am

    Try this:
    use the delay paremether as the starting time for the decay.

    veloc = 7;
    amplitude = 80;
    decay = 0.7;
    delay = 2;

    sin = amplitude*Math.sin(veloc*time);
    (time < delay) ? sin : sin/Math.exp(decay*(time-delay))

    Koby.

  • Anthony Faulkner

    June 3, 2009 at 9:56 am

    Thanks for your reply, i got it!!

  • Brendan Mccullough

    June 3, 2009 at 2:30 pm

    I’ve got a fair handle on expressions, but you obviously have some experience with javascript, because I had to look up the if statement shorthand you used. For those that were confused by the conditional,

    (time < delay) ? sin : sin/Math.exp(decay*(time-delay))

    it is the same thing as writing

    if(time < delay) { sin; } else { sin/Math.exp(decay*(time-delay)) }

    Google gave me clarification at this link (blog.techsaints.com).

    I learned something new today! I love new shortcuts. 🙂

  • Nathaniel Schweinberg

    November 6, 2009 at 1:10 am

    so I’m using a similar expression that’s shown below…

    but for some reason it jumps down before it goes up and it looks unnatural. any ideas why its working like this?

    if (time > 1) {
    veloc=15;
    amplitude=75;
    decay=effect("Decay")("Slider");
    y=amplitude*Math.sin(veloc*time)/Math.exp(decay*time);
    position+[0,y]
    }
    else{value}

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