Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Amit Zinman on February 4, 2010 at 6:18 pm

    Hi,
    I need to create the following expression:
    hold a number for three second, then advance one number up in the next second, then hold it for three seconds, then advance, etc.

    so for the first three seconds the value will be 1, then it will grow from second three to second four to 2, then hold for three second, etc.

    Amit Zinman replied 16 years, 3 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    February 4, 2010 at 7:13 pm

    Is this what you mean?

    Math.floor(time/3) + 1

    Dan

  • Amit Zinman

    February 4, 2010 at 7:34 pm

    This not exactly what I wanted. It does go from 1 to 2 after three seconds, but not gradually.

  • Dan Ebberts

    February 4, 2010 at 7:47 pm

    Closer?

    holdTime = 3;
    rampTime = 1;
    numDecimals = 2;

    period = holdTime + rampTime;
    n = Math.floor(time/period) + 1;
    t = time%period;
    if (t < holdTime){ result = n }else{ result = linear(t,holdTime,period,n,n+1) } result.toFixed(numDecimals) Dan

  • Amit Zinman

    February 4, 2010 at 10:59 pm

    Thanks man, you’re the best!

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