Article Focus:
This tutorial from Chris Zwar is a bit of a one trick pony, but its a trick thats worth knowing. Cogs and gears are nice looking design elements and are popular in all sorts of backgrounds. If you do a search on the internet, its easy to find a range of techniques for creating cogs in Photoshop and Illustrator, and Illustrator even comes with a few included.
Theres a little gotcha for anyone whos tried to animate cogs and gears in After Effects.
In order for two cogs to work together, the teeth must be the same size and have the same spacing regardless of the size of the cogs.
So if we have a large cog with 36 teeth on it, and we want a smaller cog a quarter of the size to turn it, we cant simply scale the larger cog down because this also scales the size and spacing of the teeth. If you try and scale an image of a cog to give you different sizes, then the teeth dont mesh correctly.
Smaller cogs need less teeth of the same size not the same teeth scaled down.
And this where our trick comes in
By creating the teeth of our cogs using text, (the letter V), we can control the size and spacing of these teeth using the Path Text effect. And because were creating our cogs and gears in AE, we can utilize all the effects and filters we have to make a wide range of great looking gears, all of which will mesh perfectly and combine to form really impressive animations.
---There are a few parts to this tutorial---
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.
In part three, we extend the same techniques to construct a worm gear.
And part four demonstrates how we can use simple expressions to create amazing animations using the parts we created in parts 1, 2 & 3.
---Requirements---
This tutorial was designed for and written in After Effects version 5.5, however the basic principles can be used in any version of After Effects.
This tutorial is font dependent. I have chosen Arial Black because it was the only font I could think of which is native to both Mac and Windows machines. You can use any font you like I find that Gill Sans Ultra Bold works best for me, but it will depend on what youve got.
If you are on a Windows machine, or if your Mac doesnt have Arial Black, then you can use any other font but youll have to tweak the numbers yourself.
---Part 1: Creating simple cogs and gears.---
Begin by opening After Effects, and creating a new composition which is 200 x 200 pixels in size. The Frames per Second doesnt matter because we arent doing any animation, but ensure you are using square pixels.
Add a new Solid to the comp which is the size of the comp, and apply the Path Text effect. The colour of the solid doesnt matter, because the Path text effect makes the solid transparent.
A window will pop up where you type in the text. Type in 24 letter Vs (capitals), and select the Arial Black font.
Why?
If you look at any cogs, youll see that the teeth are tapered slightly. We want the power and flexibility of the Path Text tool, but because its designed for text we need to create our teeth using letters. The letter V is the letter which most resembles the teeth on a cog.
Of course, this is totally up to you you can also use the letter I, U or A, and it really depends on the font. Originally, I used Gills Sans Ultra Bold because the gap between the two sides is so small. Youll see how this is an advantage later.
In this case, Im using Arial Black because its available on both Windows and Mac machines, but the choice is really up to you. If you have any Dingbat fonts with triangles then they can also look very effective.
Your composition window will now look something like this, so we need to tweak a few settings.
The first thing we need to do is change the shape to circle. So we can rotate the circle around the centre of the composition, set the Vertex points to the middle in this case, 100,100.
The Tangent value determines the size of the circle, and its easiest to adjust if one of the axes is aligned with the centre of the comp. So set the X value of the tangent to 100 as well.
Our window now looks something like this still not much like a cog. So lets flip our Vs around, using the Character rotation setting.
Change it to 180 degrees.
Now that our letter Vs are flipped, drag the Y value of the Tangent until we start to get something which looks usable. Because our composition is 200 pixels wide, I set the Y Tangent to 190, so the letters dont run outside the composition window.
With the diameter and thus the size of the cog set (by the Tangent value), we need to find a range of font-size settings which we like the look of, aesthetically, and which will work when we go to animate the cog later on. Notice in the image above how there are teeth overlapping at the bottom of the circle we need to find the right size and spacing so the teeth are evenly positioned all around the circle.
This is where the power of the Path Text effect really comes in handy.
After a bit of trial and error its actually quite fun I found a bunch of numbers which give me the look Im after.
Set the font size to 32, and the tracking to 2.4.
Set the horizontal scale to 85%, and the vertical scale to 125%.
And change the colour of the text to white.
Notice how all the teeth are evenly spaced. This is absolutely vital.
All we need to do now is to fill in the middle and we have a simple cog. The most flexible way of doing this is to add a mask, and apply the stroke effect.
Pressing Apple-Shift-N creates a new mask, and pressing m will reveal the mask properties in the timeline. If you click on shape, a box will come up which allows you to change the shape to an Oval.
The mask boundaries now appear in the composition windows.
Double click on a mask vertex, which will allow you to scale the mask. By holding down the shift-key, the mask is constrained to a perfect circle, and by also holding down the apple-key, the mask is scaled from the centre, not the corner.
Scale the mask down until it is inside the letters, and apply the stroke effect.
Increase the brush hardness to 100%, and increase the size of the brush until youre happy with the result. You may want to alter the size of the mask as well.
And there we have it our first cog.
In order to demonstrate how essential the Path Text effect is to the animation process, well follow exactly the same procedure to create another cog.
To keep things organized, change the name of this composition to Cog 1 24 teeth, and create a new composition called Cog 2 12 teeth. It will be a smaller cog, so the dimensions can be 160 x 160.
Add a solid the size of the comp, then switch back to our first composition and copy the path text effect.
When you switch back to the new composition and paste the path text effect to our new solid, the window opens for you to type in your new text.
Type in 12 capital Vs making sure that you are using the same font as the first comp.
Because weve copied and pasted the effect, all the settings are there from our first cog.
These are our magic numbers, which have determined the size and spacing of the teeth. We cant change these numbers or our cogs wont mesh together correctly.
However, we obviously dont have a cog, so we need to alter the size of the circle.
Basically, the size of our letter Vs is set. And weve decided that this cog will have 12 teeth. The only variable left to alter is the size of the circle, which is determined by the Y value of the Tangent slider.
Begin by centering the circle in our composition change all the 100s to 80s. Our composition is 160 x 160, so the centre is half that 80 x 80.
Experiment with different Tangent values until the spacing of the letters is even.
It is important with the Path Text effect to ensure the layer is set to Best Quality, and when youre fine tuning your tangent value, zooming in to 200% can help. In this case, after zooming in to 200% I could see that a slight adjustment was needed.
So change the Y value of the tangent to 125.
Now that our letters are evenly spaced, we can add a mask and stroke it to fill in the cog.
Exactly as we did in with our last cog, add a mask and change it to an oval.
Scale the mask keeping it circular and centred by holding down the shift and apple keys while scaling until it is inside the body of the cog.
Once again, apply the stroke effect and set the brush hardness to 100%.
Then experiment with different settings until youre happy with the result.
In this case, a brush size of 14 worked well, but it will depend on the size of your mask. Incidentally, in the screenshot above the brush hardness is 99%. Thats a mistake, but it wont make much difference.
This is our second cog with 12 teeth.
Now comes the fun part animating them.
Create a new composition which is large enough to fit both cogs. I used the PAL settings of 768 by 576, but this is overkill.
Drag in both the cogs which we just created, and position them so their teeth mesh.
In the timeline, set keyframes for the rotation of both cogs - at the start, they can both be 0.
Go to the ten-second mark, and set the rotation of the larger cog (24 teeth) to 1, so it does a full rotation over the ten seconds.
As the smaller cog has half the number of teeth, it will do twice as many revolutions, in the opposite direction. So set its rotation to 2.
And voila! There we have it animating cogs.
---Finished here? Go on to the next part---
If you think that these cogs look a bit ordinary, then move onto the next stage, where we use exactly the same techniques to make more decorative looking cogs.
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.
In part three, we extend the same techniques to construct a worm gear.
And part four demonstrates how we can use simple expressions to create amazing animations using the parts we created in parts 1, 2 & 3.