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.
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.
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.
Here in the Outliner window, we can see all the object groups as Minute, Hour, Watch_Body_Plate, Center_Point and Numbers group.
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.
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.
Now the pivot points of both the Hour and Minute hands are shifted to the bottom and now will rotate around that pivot/axis.
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.
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.
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.
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.
With the Rotate X attribute selected for the Minute hand, click on Edit > Expressions in the channel box.
This opens the Expression Editor window. Here you can see the Minute object selected. Now select rotate X also under the Attributes group.
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.
Now, select the Hour hand in the Outliner window and check what happens when you rotate it in the X-axis.
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.
Now, Unhide all objects. Then Select all the objects in Outliner window and press Shift+H to show the hidden objects.
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.
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!
Subscribe below and we’ll send you a weekly email summary of all new 3D & Motion Graphics tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post