Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Help tweaking an expression

  • Help tweaking an expression

    Posted by Michael Mazur on May 1, 2007 at 3:01 pm

    Here is the expression that I am using…

    amtOfDigits = 2;
    seconds = Math.round( time % 60 );
    minutes = Math.floor( time / 60 );
    function addLeadingZeroes( v ){
    for( i = 0; i < Math.abs( amtOfDigits - (v + "").length ); i++) v = "0" + v; return v; } addLeadingZeroes(minutes) + ":" + addLeadingZeroes(seconds) My only problem is that when I get to the 1:00 minute mark in the timeline the seconds count to :60 for a half second before switching over to 1:00. Obviously , I want the seconds to count from :59 to 1:00 directly. My comp setting is an HD 30fps set-up right now. Please help.

    Dan Ebberts replied 19 years ago 2 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    May 1, 2007 at 3:18 pm

    Try changing the second line to this:

    seconds = Math.floor( time % 60 );

    Dan

  • Michael Mazur

    May 1, 2007 at 4:10 pm

    Thanks so much man that was it. If you get a second can you explain to me why that fixed it?
    What is the difference between floor and round?

    Thanks again.

  • Dan Ebberts

    May 1, 2007 at 5:22 pm

    Math.round() rounds to the nearest integer value, which could be up or down, while Math.floor() always rounds down.

    Dan

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