How to limit the number of decimals a Slider shows
Hi all!
I'm currently working on a timer in AE — it will be used for SAT tests, so I have to make sure that it keeps perfect time. Here's the code I've used to create it:
slider=effect("Slider Control")("Slider");
sec=slider%60;
min=Math.floor(slider/60);
function addZero(X){
if(X<10)return"0"+X else return X;
}
addZero(min)+":"+addZero(sec)
While this function does keep perfect time, it displays all the decimals in between each whole second (00:00.96666666...). Is there a code I can insert that limits the displayed decimals to just the minutes and seconds, and doesn't round up the numbers? (I've found using slider = Math.round(effect("Slider Control")("Slider")); rounds the time up and displays the seconds before they should. EX: 00:02 shows up at 00:01:15 instead of 00:02:00)
Any and all help is greatly appreciated.
Thanks, have a great day!
— Joshua L
