| ---Part Three: The Worm Gear--- |
So far weve seen how we can use the Path Text effect to construct cogs, and that if we keep the font size and tracking the same, we can create different sized cogs which will happily mesh together and animate seamlessly.
In Part 2, we saw how the Path Text effect can not only create teeth for our cogs, but decorative bodies as well.
In this tutorial, well see how we can also use the Path Text effect to create a worm gear.
As I mentioned earlier, this series of tutorials is basically a one trick pony. In our case, using the Path Text to make teeth for our cogs is the trick, and now were just doing variations on a theme. Subsequently, this tutorial will not go into as much detail, because otherwise wed just be repeating what we did in parts 1 and 2. The idea is to see how we can adapt our trick to new situations.
A worm gear is a long rod with a thick thread running around the outside. To create our worm gear we need a rotating rod in two sizes one cylinder for the main body of the rod, and another larger one for the thread.
Ive already created two looping cylinder movies, because AE doesnt have a cylinder effect as standard. The movies are 25 frames long each.

The Thin version of the cylinder is our central rod, and basically theres nothing we need to do to it. The trick is to create the thread which runs around the outside. Because the thread is wider than the central rod, well use the thicker cylinder as the source.
Open the project file we created in Part 1, and worked on in Part 2. Import the two Cylinder movies. In some cases, you may need to re-link media in the project files that you've downloaded.
Drag the Thick Cylinder movie onto the composition icon at the bottom of the project window. This will create a new composition with just the Thick cylinder movie in it. The duration of the new composition will be the same as the movie 1 second.
Open up our original Cog composition the 24 teeth one and copy the Path Text effect. Then close the composition to keep our display tidy.
Add a new solid and make it the size of the comp, and paste the Path Text effect. You should see something like this:

Because our project is long and skinny the screenshots only show the top of the frame.
We need to alter the Path Text settings to make our teeth run vertically.
Change the shape type to line.
Change the first vertex position to 92, 0 and the second to 92, 768.

This makes our letters run in a straight line, like this:

Now we need to duplicate our effect for the other side, so select the Path Text effect in the effects window, and duplicate it by pressing Apple-D.

Because we want to see the first set of teeth we need to composite the second Path Text effect onto the original:

Each letter V on the right represents a full revolution of the same thread, so the Vs on the left side need to be halfway between the Vs on the right side. Use the left margin setting to move the new set of Vs until they sit halfway. In this case, our thread will move upwards so use a negative value. In our case, -12 works.

Our two sets of teeth are identically spaced, and evenly positioned.

To flip our second set of teeth over, reset the Orientation to 0 degrees. All the Vs now face the other way.

We need to re-position the new teeth as well. Because our composition is 100 pixels wide, and our right side had an X-value of 92, our left side will have a value of 100-92, or 8.
So change the vertex positions to 8,0 and 8,768.

Which will give you this:

Now that our teeth are in the correct position, we need to remove the excess parts of the letter.
Add a mask, and re-size it until you cant see the split in the letter V.

With this font, Arial Black, the settings are:

Then apply the Fill effect, selecting the mask from the pop-up menu. If you dont select the mask, then the fill command will turn the text red.

Set the colour of the fill to black. To ensure that your worm gear doesnt have any tiny holes in it, turn off the visibility of the cylinder layer. If your mask is too narrow, you will see tiny black dots in the middle of the teeth, where the split in the letter V is visible. Increasing the width of the mask will solve this. Your window should look like this:

The next stage is to create the diagonal threads linking the left and the right sides. Once again well use the Path Text tool, although this time it will be the letter I and not the letter V.
Apply the Path Text effect and type in lots of letter Is I lost count of exactly how many. If you havent added more letter Vs to the other Path Texts yet, do so now so the whole window is full of teeth from top to bottom. It wont matter if you type in too many.
Set the Path Text effect to line, and set the position to 50,0 and 50,768. Make your Is white.
Using trial and error, we will adjust the font size, tracking, horizontal scale, baseline shift, orientation and left margin settings until all our letter Is perfectly link our teeth.
Begin by getting one of the top teeth looking this this:

And tweak away.
In this case, the magic settings are:
- Font size of 47
- Tracking is 5.26
- Orientation is 10 degrees
- Vertical scale is 205 percent
- Left Margin is 16.10
- Baseline shift is -17

Which gives us:

Now that we have our thread, the next step is to animate the position to give the illusion that the thread is rotating.
In this case, we will be animating the Left Margin of the three Path Text settings, so that the thread rises.
Because our cylinders loop over a 1 second period, we will make our thread loop over a 1 second period as well.
Each time the worm gear does a full revolution, the threads end up in the same position, although it appears that they have moved one tooth higher. To create this illusion, we need to set keyframes for our threads so that their position at 1:00 is the same as at 0.
Begin by opening up the effects controls in the window and setting keyframes for the Left Margins, at 0.

Make sure the layer is set to Best Quality, and take a snapshot of the composition window by clicking the camera icon at the bottom.
Press the end button to go to the last frame of the animation. We need to find the values for Left Margin which have moved the text up so its in exactly the same position, but one tooth higher.
Because we recorded the composition window at frame 0 by pressing the camera button, we can view that frame at any time by pressing the picture icon next to the camera. This will allow us to flick between the first and last frames of the animation, and ensure they are identical.

In this case, the settings are 23.5 for the first Path Text,35.5 for the second, and 39.5 for the third Path Text effect.

At this stage, frame 24 is identical to frame 0, but to make this loop over 1 second, we need to make frame 25 identical to frame 0, not frame 24. So press page down to move one frame later, and drag the keyframes along. You wont see anything in the window, because our composition is only 25 frames long and were currently looking at the 26th frame.

We need to work at frame 24 so we can see what were doing in the composition window
but when were finished, move the keyframes one frame along:

What we have now is a loopable composition in which our thread gives the illusion of rotating. Do a RAM preview to see for yourself.
The hard work is done; we just have to finish it off.
Apply the Text layer as a Luma matte for the Thick Cylinder layer. Because weve used a black mask to cover up parts of the letter V, we need to use a luma matte in order for the black to be rendered as transparent. If we used an Alpha matte then the black areas would still show up.

Our Worm gear now looks like this:

The next step is to Pre-Render this animation, before we combine it with our central rod. By rendering, the Path Text track-matte will be saved as the alpha channel of the file and make it easier to apply effects. You could pre-compose it if you prefer, but its faster working with a rendered file and its a good excuse for a coffee.
I called the animation WormGear-teeth only.

This should render out the one-second animation and re-import it into the project. Use the Animation Codec at 100%, rendering RGB + Alpha. When the file is rendered After Effects will automatically import it into the Project window.
Create a new composition by dragging the WormGear-teeth only file onto the composition icon at the bottom of the Project window. Then drag the Thin cylinder movie into the same composition, underneath the teeth.

Our worm gear now looks much more like a worm gear:

Although this looks OK, theres a little tweak needed. In order to reduce the file size for the internet, the cylinder movies were not rendered with an alpha channel. The black areas on either side of the thin cylinder are solid. The simple solution to this is to add a mask.
So select the Thin Cylinder, add a mask by pressing apple-shift-N, and then resize it so it is the same shape as the cylinder.

Although you wont see anything different in the window, weve just made the black bits transparent. Otherwise wed have got a bit of a shock later on.
To make the worm gear look a bit more solid we need to make the teeth stand out from the central rod. The easiest way to do this is to bevel the edges, and use a drop shadow. So apply the Bevel Alpha effect, and the Drop Shadow effect.
The settings are really up to you I reduced the size of the highlight of the bevel, and had the drop shadow quite soft.

The results are quite dramatic:

I also used the levels effect on the Thin Cylinder to make the midtones a little darker, by setting the gamma to .8

If you do a RAM preview then you might notice something a little bit odd, and youre right.
When I made the two cylinder files, I wanted the larger cylinder to look a bit different from the smaller cylinder, to help give the illusion that the teeth are cut wider than the central rod. So when I rendered out one of the cylinders, I flipped it first, so the wood texture would be reversed.
Although its subtle, it makes our teeth look like theyre from a different part of the wood than the rod, but it also means they turn in the opposite direction. This is now a problem, because there are no worm gears in existence that have the thread spinning in the opposite direction to the rod in the middle.
The solution is quick and easy just play the cylinder movie backwards.
Click on the triangles at the bottom of the timeline window, to display the time stretch properties.

To play a layer backwards, we need to enter in 100% as the stretch.
The teeth are turning in the correct direction; its the Thin cylinder which needs to be reversed. Click in 100% and type in -100%

The layer is now backwards, but it also means that the out point has changed. Drag the layer into the correct position. The red stripes are to indicate the layer is reversed.

To this:

Weve now finished the worm gear animation, all we have to do is render it.
Choose Pre-render as we did before, and call the movie WormGear 1 second loop. Because its a small movie, use the Animation Codec at 100% and render with an alpha channel.
After Effects will automatically re-import the rendered file. All we have to do now is loop it. You can see here how AE has imported the file, and the information at the top tells us the file has a duration of 1 second.

Go to the interpret settings window, and under the Other Options type in 60 for the loop value. This will loop the 1-second animation 60 times, making it 1 minute long.

After Effects now reports the duration of the file as 1 minute.

So thats our worm gear.
| ---To keep you interested, here are a few other things to try--- |
By rotating the Vs a different value from 180 degrees, we can create a ratchet style cog.

These Vs are exactly the same as in our first Cog the 24 tooth one but theyre been rotated only 150 degrees.


And by using brackets (these things) instead of the letter I, we can get a different look for our 36 tooth cog:

But the most important thing to remember about all of these variations is that they will still mesh together perfectly and create seamless animations.
So now that we have a few different cogs and a nice looking worm gear, lets get on to the stage of actually making them all work together.
Before I went of to Stage 4, I had a bit of fun creating different types of cogs.

I rendered them out as still files, and well be using them in the next stage.
| ---Finished here? Go on to the next part or go back--- |
In part one, we look at the basic concept behind making cogs in After Effects, using the Path Text effect. This will demonstrate our trick in detail.
In part two, we look at how we can extend this basic technique to produce more interesting looking cogs, using textures easily found on the internet.
And part four demonstrates how we can use simple expressions to create amazing animations using the parts we created in parts 1, 2 & 3.
--- Chris Zwar
Please discuss this technique in the After Effects forum at Creativecow.net
|