gunner89
01-10-2011, 08:48 AM
Hello, i am creating a clock animation for a watch that i am modelling that is created and modeled by python code and expressions, i have done it all and got the hour hand to be correct but i cant figure out what figures i should be putting for the minOffset and the secOffset. Any help would be greatly appreciated. Thanks
#
# Hour hand
#
cmds.rotate(0,0,-timeNow.tm_hour*30,hourHand[0])
hourOffset=-timeNow.tm_hour*30-timeNow.tm_min*0.5
cmds.expression( o='hourHand[0]', s="hourHand.rotateZ=-frame/3000+%d"%hourOffset)
#
# minute hand
#
cmds.rotate(0,0,-timeNow.tm_min*1,minHand[0])
minOffset=-timeNow.tm_min*1-timeNow.tm_min*0.5
cmds.expression( o='minHand[0]', s="minHand.rotateZ=-frame/250+%d"%minOffset)
#
# second hand
#
cmds.rotate(0,0,-timeNow.tm_sec*1,secHand[0])
secOffset=-timeNow.tm_sec*1-timeNow.tm_min*0.5
cmds.expression( o='secHand[0]', s="secHand.rotateZ=-6*frame/25+%d"%secOffset)
#
# applying the expressions
#
cmds.expression( o='secHand[0]', s='secHand.rotateZ=-6*frame/25' )
cmds.expression( o='minHand[0]', s='minHand.rotateZ=-1*frame/250' )
cmds.expression( o='hourHand[0]', s='hourHand.rotateZ=-30*frame/3000' )
#
# Hour hand
#
cmds.rotate(0,0,-timeNow.tm_hour*30,hourHand[0])
hourOffset=-timeNow.tm_hour*30-timeNow.tm_min*0.5
cmds.expression( o='hourHand[0]', s="hourHand.rotateZ=-frame/3000+%d"%hourOffset)
#
# minute hand
#
cmds.rotate(0,0,-timeNow.tm_min*1,minHand[0])
minOffset=-timeNow.tm_min*1-timeNow.tm_min*0.5
cmds.expression( o='minHand[0]', s="minHand.rotateZ=-frame/250+%d"%minOffset)
#
# second hand
#
cmds.rotate(0,0,-timeNow.tm_sec*1,secHand[0])
secOffset=-timeNow.tm_sec*1-timeNow.tm_min*0.5
cmds.expression( o='secHand[0]', s="secHand.rotateZ=-6*frame/25+%d"%secOffset)
#
# applying the expressions
#
cmds.expression( o='secHand[0]', s='secHand.rotateZ=-6*frame/25' )
cmds.expression( o='minHand[0]', s='minHand.rotateZ=-1*frame/250' )
cmds.expression( o='hourHand[0]', s='hourHand.rotateZ=-30*frame/3000' )
