Animate a Clock in Maya Using Expressions
Hey guys, today I will show you how to animate clock hands using expressions in Maya. This is a follow up to my previous tutorial "Creating An Animated Clock In 3ds Max Using Expressions & Custom Attributes". This time I am using the same techniques in Maya and I hope the Maya users will find it helpful.
Step 1
This is the basic clock I have made in Maya. I have made the Hour and Minute hands too which look overlapped and are currently showing 12 O’ clock.


Step 2
Before we start, we need to take care of some points like the Clock hands’ pivot point and proper object grouping and alignment. So first open the Outliner window as shown in the image below.


Step 3
Here in the Outliner window, we can see all the object groups as Minute, Hour, Watch_Body_Plate, Center_Point and Numbers group.


Step 4
For now, we have to work on the Clock hands only. So we will hide all the other objects except for the hands. To Hide, first select the Watch_Body_Plate, Center_Point and Numbers group objects.


Now, click on Display > Hide > Hide selection. This will hide the selected objects.


Step 5
Now we have only the clock hands left in the viewport. Select the Hour and Minute hands one by one, then hold down D and select the Y-axis, and drag the middle mouse button to the Center_Point plate.


Step 6
Now the pivot points of both the Hour and Minute hands are shifted to the bottom and now will rotate around that pivot/axis.


Step 7
Now this pivot point must be identical to the pivot point of the ‘Number_group’. To check this, select the Number_group object in the Outliner window, then go to Display > Show> Show selection.


Step 8
In the image, you can see the pivot points of the Number_group and the Minute and Hour hands are identical. If not, then adjust the pivot points accordingly.
.


Step 9
After setting the pivot points correctly, now we'll start to make expressions for the Minute and Hour hands. So first select the Minute hand object in the Outliner window.


Step 10
With the Rotate tool selected, check for the right and suitable rotation axis. In this case, Rotation on the X is the suitable axis for the clock hands rotation.


Step 11
With the Rotate X attribute selected for the Minute hand, click on Edit > Expressions in the channel box.


Step 12
This opens the Expression Editor window. Here you can see the Minute object selected. Now select rotate X also under the Attributes group.


Step 13
Now type Minute.rotateX = Hour.rotateX*12 in the Expression text area. And finally click on the Create button to create the expression. This expression states that when the Hour hand rotates 1 unit, the Minute hands rotates 12 times of the unit.


Step 14
Now, select the Hour hand in the Outliner window and check what happens when you rotate it in the X-axis.


Step 15
You will notice that the Minute hand rotates 12 times faster than the Hour hand. In other words when the Hour hand travels from 12 to 1, then the Minute hand completes one full cycle of rotation from 12 to 12.


Step 16
Now, Unhide all objects. Then Select all the objects in Outliner window and press Shift+H to show the hidden objects.




Step 17
Now you can create the animation according to your needs. To create an animation, select the Hour hand object, go to the Range slider palette at the bottom and enter a value of 300 for the end value, and press the ‘S’ key to set the initial key as shown in the image.


Step 18
Slide the range slider up to 300 frames and rotate the Hour hand from 12 O’ clock to 4 O’ clock and again press the S key to add the final key frame. Once done, play the animation. You will see the Minute hand is automatically rotating accordingly. So you see that with the help of an Expression, we can animated the Hour hand only and the Minute hand is being animated automatically and mathematically. Expressions can make life easier!

