Copy link to clipboard
Copied
Hello! I'm brand new to Adobe After Effects and just pasted in some code for a timer, but I'm getting a syntax error on line 1. I don't know much about codeing so I was hoping sombody smarter than me might know. Here's the code:
rate = 1;
clockStart = 0;
function padZero(n){
if (n < 10) return "0" + n else return "" + n
}
clockTime = clockStart + rate*(time - inPoint);
if (clockTime < 0){
sign = "-";
clockTime = -clockTime;
}else{
sign = "";
}
t = Math.floor(clockTime);
hr = Math.floor(t/3600);
min = Math.floor((t%3600)/60);
sec = Math.floor(t%60);
ms = clockTime.toFixed(3).substr(-3);
sign + padZero(min) + ":" + padZero(sec)
Try replacing this line:
if (n < 10) return "0" + n else return "" + n
with this:
return (n < 10 ? "0" : "") + n
Copy link to clipboard
Copied
Try replacing this line:
if (n < 10) return "0" + n else return "" + n
with this:
return (n < 10 ? "0" : "") + n
Copy link to clipboard
Copied
Thanks a bunch! that worked!
Copy link to clipboard
Copied
Happened. Thank you. Everything is working.
Copy link to clipboard
Copied
Happened. Thank you. Everything is working.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now