Monday, 9 May 2011

Creating a Clock

After getting to a point with my animation and deciding that it is symbolizing six hours i have realized that I have not got a clock to show this so i need to find out how to create a animated clock in after effects.

After researching how to do this i found a tutorial with some code here...

Universal Up/Down After Effects Clock

with in this tutorial it shows this variable code
rate = -2;
clockStart = 3604.999;

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(hr) + ":" + padZero(min) + ":" + padZero(sec) + "." + ms

and the code works by this analysis

No comments:

Post a Comment