symdesign
7/10/2015 - 9:08 PM

Countdown Expressions

countspeed = 1;
clockStart = 0;
 
function times(n){
  if (n < 10) return "0" + n else return "" + n
}
 
clockTime = clockStart +countspeed*(time - inPoint);
 
if (clockTime < 0){
  minus = "-";
  clockTime = -clockTime;
}else{
  minus = "";
}
 
t = Math.floor(clockTime);
h = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(3).substr(-3);
minus + times(h) + ":" + times(min) + ":" + times(sec) + "." + ms
slider = effect("Slider Control")("Slider");
numDecimals = 0;
commas = false;
dollarSign = false;
percentSign = true;
s = slider.value.toFixed(numDecimals);
prefix = "";
suffix = "";
if (s[0] == "-"){
  prefix = "-";
  s = s.substr(1);
}
if(dollarSign) prefix += "$";
if(percentSign) suffix = "%";
if (commas){
  decimals = "";
  if (numDecimals > 0){
    decimals = s.substr(-(numDecimals + 1));
    s = s.substr(0,s.length - (numDecimals + 1));
  }
  outStr = s.substr(-s.length, (s.length-1)%3 +1);
  for (i = Math.floor((s.length-1)/3); i > 0; i--){
    outStr += "," + s.substr(-i*3,3);
  }
  prefix + outStr + decimals + suffix;
}else{
  prefix + s + suffix;
}
Math.floor(thisComp.layer("counter").effect("Slider Control")("Slider"))
startCount = 0;
endCount = 10000000;
duration = 5;
n = ease(time, 0, duration, 0, 10000000);
s = "" + Math.round(n);
s.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
rate = -1;
clockStart = 300;

function padZero(n){
  if (n < 10) return "0" + n else return "" + n
}

clockTime = Math.max(clockStart + rate*(time - inPoint),0);

t = Math.floor(clockTime);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
min + ":" + padZero(sec)