Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Need expression to animate slider between integers and hold for specific duration

  • Need expression to animate slider between integers and hold for specific duration

    Posted by Mike Park on October 29, 2009 at 8:28 pm

    I know this sounds random, but i need an expression to animate a slider control between two integers in increasing value for one second, and then to hold for 4 seconds at that value, and then increase again by one over one second and then hold for 4 seconds.

    For example value of 1 between 0 and 4 seconds, then linerally animate between 1 and 2 between 4 and 5 seconds, then hold at 2 between 5 and 9 seconds, then animate to 3 between 9 and 10 seconds.

    I thought about using a loop but was unsure about how to best write the code. Any suggestions? Thanks in advance.

    Mike

    Mike Park replied 16 years, 6 months ago 3 Members · 3 Replies
  • 3 Replies
  • Xinlai Ni

    October 29, 2009 at 9:13 pm

    This does what you’ve described:

    bucket = Math.floor(time / 5);
    linear(time, bucket * 5 + 4, bucket * 5 + 5, bucket + 1, bucket + 2)

    Xinlai Ni
    Software Engineer, Google Inc.

  • Dan Ebberts

    October 29, 2009 at 9:18 pm

    Something like this should work:

    1 + Math.floor(time/5) + linear(time%5,4,5,0,1)

    Dan

  • Mike Park

    October 29, 2009 at 10:43 pm

    Thank you very much. Genius!

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