Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions AE Expressions, rounding to nearest multiple 5

  • AE Expressions, rounding to nearest multiple 5

    Posted by Tom Holmes on October 9, 2014 at 2:42 pm

    Hello!

    So have an audio amplitude data on a slider which started out reading to 2 decimal places (i.e, 14.32). I used the Math.round expression to round out the decimal places so it now reads 14. The issue is that i would like the dynamic value to read to the nearest multiple of 5, rather than 1. so if the value is 11 it would read 10, and if the value if 23 it would read 25..

    how would i accomplish this?

    Many Thanks!

    Tom

    Nischal Masand replied 9 years, 7 months ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    October 9, 2014 at 4:31 pm

    Something like this should work:

    Math.round(your_slider_value/5)*5

    Dan

  • Tom Holmes

    October 10, 2014 at 8:58 am

    Dan, you’re a genius 🙂 works like a charm!

    Thanks very much!

    Tom

  • Nischal Masand

    September 30, 2016 at 11:08 am

    Thanks a lot!!!

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