## Clock hands

Moderators: Disciple, zlovatt

tarwin
Posts: 2
Joined: September 12th, 2006, 9:46 pm
Just put this code on some clock hands, initially pointing north (12 o'clock). You can change the start time with "forwardtime".

Hours

Code: Select all

``````forwardtime = 10;
starttime = time+(forwardtime*3600);
h =starttime/3600;
s = Math.floor(h);
s2 = h-s;
if (s2 > 0.99){
transform.rotation = (Math.floor(h)*30)+((s2-0.99)*(1/0.01)*30);
}else{
transform.rotation = Math.floor(h)*30;
}``````
Minutes

Code: Select all

``````forwardtime = 11;
starttime = time+(forwardtime*60);
m = starttime/60;
s = Math.floor(m);
s2 = m-s;
if (s2 > 0.9){
transform.rotation = (Math.floor(m)*6)+((s2-0.9)*(1/0.1)*6);
}else{
transform.rotation = Math.floor(m)*6;
}``````
Seconds

Code: Select all

``````timer = time+23;
s = Math.floor(timer);
s2 = timer-s;
if (s2 > 0.7){
transform.rotation = (Math.floor(timer)*6)+((s2-0.7)*(1/0.3)*6);
}else{
transform.rotation = Math.floor(timer)*6;
}``````
mrblifil
Posts: 3
Joined: February 1st, 2005, 12:17 pm
Location: NYC
Contact:
What is the use of the "transform" property? Is that an After Effects 7 thing?
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:
Yes it is. You also get it with the pick whip and the default expression.

Dan
afaj
Posts: 5
Joined: February 2nd, 2007, 9:30 pm
When trying to use any of these expression texts, I get the message:

"Expression result must be of dimension 2, not 1. Expression disabled."

Any ideas? Thanks.