How to Animate Along a Path Using After Effects

Preview of how to animate along a path at the end of the tutorial

It’s surprisingly easy to create a path animation in After Effects. This is a simple tutorial for the complete and utter beginner of how to animate along a path in After Effects. I also chose to build my graphics in Illustrator first, and then convert the After Effects movie to an animated GIF with Photoshop last.

You’ll want a basic knowledge of animations before advancing to After Effects. For instance, Photoshop’s Timeline is a great introduction. There, I learned about animated GIFs, motion graphics, and video animations. So now I’m familiar with keyframes and tweening at least.  If you’re not, visit my Photoshop animated GIF tutorials part 1, 2, and 3.

However, animating along a path is one of the limitations of Photoshop’s tweening. The object rotations, positions, and keyframes must be entered manually. There’s no auto orient, and you must eyeball the path. Yet, After Effects is much more capable of handling path animations.

Prepare Your Illustrator Artwork

Create your graphic elements in Illustrator. Once editing is complete, move objects to their own layers. Each object you want to animate needs its own layer. Objects that move together may reside on the same layer. (However, grouping them is unnecessary for After Effects, so that’s up to your preference.)

Then, label layers appropriately. Since After Effects automatically assigns object names based on the Illustrator name, skipping labeling results in a slew of AE layers unhelpful names like <Path>.

Save the Illustrator document and close.

Step 1: Prepare Your Illustrator Artwork.
Step 1: Prepare Your Illustrator Artwork [GIF].

Create Your After Effects Composition

First, open After Effects and go to create a new project either from the Home screen or from File > New > New Project. Then, select “Create Composition from Footage.” This option saves a step because it automatically launches a Finder window to locate any file imports. Find the Illustration document.

Before closing the Finder window, change the “Import as:” option from “Footage” to either “Composition” or “Composition – Retain Layer Sizes.” If your graphic elements are already scaled to the size you want, choose the latter. However, if you’re still working out sizes, feel free to choose the former.

Now click “Open.”

Once imported, the Illustrator document appears in left sidebar’s Project Panel. After Effects keeps a copy of your Illustrator layers that you can click to launch Illustrator and edit once more. There’s also a new composition item in your project. It has a different thumbnail and displays “Composition” under “Type.” Double-click this composition to populate a timeline.

Step 2: Create Your After Effects Composition.
Step 2: Create Your After Effects Composition [GIF].

Choose Composition Settings

After Effects creates a 28-second long composition by default. Your animation might be longer or shorter. Because I want to create short, simple motion graphics, I need something much shorter and lightweight, like 4 seconds.

You might think you make an animation shorter by dragging the purple timeline bars left like I did. After all, this is how Photoshop determined the animation duration. This is wrong.

To set the animation duration, first go to File > Composition > Composition Settings… Then look for the Duration input box.

After Effects applies a specific format to precisely measure time. The “0:00:28:00” translates to 0 hours, 00 minutes, 28 seconds, and 00 milleseconds.

For a 4-second long animation, input “0:00:4:00”. Don’t forget the colons. Also, be sure to enter a number for every position—even if it’s just 0.

Then hit “OK.”

Step 3: Choose Composition Settings.
Step 3: Choose Composition Settings [GIF].

Learning the Timeline

Step 4: Learning the Timeline.
Step 4: Learning the Timeline.

After Effect’s timeline is both very similar and very different from Photoshop’s.

The timeline still has the familiar purple bars to adjust tween duration for each layer. Additionally, you can lengthen or shorten the duration by dragging the edge of the purple bars. However, one nice feature After Effects has that Photoshop doesn’t is the ability to select multiple purple bars at a time and adjust them altogether at once. Great!

Furthermore, the After Effects timeline has all the Transform tweening options Photoshop does. Click the down carots of the layers in the Timeline panel to open the Transform options then the keyframe options. For example, Position, Scale, and Opacity. Photoshop recorded Rotation under Transform, but After Effects also has an Anchor Point option.

Press the spacebar to play the animation. Press it again to pause. Drag the blue cursor to move up and down the timeline.

Determine the Object’s Path of Movement

Select a background layer from the Timeline panel, and activate the Pen tool by clicking from the Tools panel at top.

Draw a line to represent the animated object’s path of movement. Then, a new item appears under the layer above the Transform settings: Masks. The new line becomes “Mask 1,” your mask path.

In the background layer you drew the path, select Masks > Mask 1 > Mask Path, then go to Edit > Copy.

Step 5: Determine the Object’s Path of Movement.
Step 5: Determine the Object’s Path of Movement [GIF].

Animate the Object’s Path

Find the object’s layer > Transform > Position. Make sure the timeline cursor is positioned where the path animation begins. I like it to start at the beginning, so I drag the blue cursor back to 0.

Next, hit Edit > Paste to insert the mask path into the object’s position settings. As a result, the timeline populates automatically with position keyframes and tweens to animate the object moving along the mask path.

Press spacebar to preview how the object animates along its path.

Step 6: Animate the Object’s Path.
Step 6: Animate the Object’s Path [GIF].
Preview at the end of Step 6
Preview at the end of Step 6 [GIF]

Orient the Object to Rotate Along the Path

Another handy feature of After Effects is its ability to automatically rotate the object with the turns of the mask path.

Select the object’s layer, then go to Layer > Transform > Auto-Orient… Click the radio button for “Orient Along Path” in the new Auto-Orientation window that appears. Then hit “OK.”

Again, press spacebar to preview.

Now, you can animate along a path and orient the object at the same time!

Step 7: Orient the Object to Rotate Along the Path.
Step 7: Orient the Object to Rotate Along the Path.
Preview at the end of the tutorial
Preview at the end of the tutorial [GIF]

Export the Animation as a Movie

Once the animation is complete, it’s time to make the video. After Effects exports movie files like .mov. If you want an animated GIF, bring the movie back into Photoshop for the last step.

To make the video, go to File > Export > Add to Render Queue. Here the composition waits for final settings. In the Timeline panel towards the top appears a new tab beside “Composition”: the “Render Queue” tab. If it’s not in focus, click the tab to switch there.

First adjust quality and frame rate under Render Settings. (Click the black down carot to open the window.)

Then, I normally leave the Output Module setting to the default “Lossless,” especially since I plan on converting the movie into an animated GIF in Photoshop later anyway.

Lastly, choose a save location under Output To.

Finally, click the Render button to the right to execute the render. After Effects displays a progress bar for the status of the render. Short videos render rather quickly.

Convert the After Effects Movie to an Animated GIF in Photoshop

Photoshop doesn’t directly open a movie file, but it does import it. Open Photoshop and go to File > Import. Then choose “Import Video to Layers.”

Basically, Photoshop will convert the video tweens from the After Effects movie into a frame animation.

Photoshop automatically chooses a number of frames based on the frame rate you chose in After Effects’ composition settings earlier. Photoshop takes a long time to import longer animations and/or higher frame rates. Because of this, you can also choose to skip a few frames for an even smaller animation file and faster import. I left this setting as is since I liked the frame rate I chose in AE.

Most importantly at this step, be sure the “Make Frame Animation” option is clicked. Otherwise, Photoshop simply imports each frame onto its own layer. Consequently, skipping this option removes the animation part from the movie.

Finally click “OK.”

Photoshop now populates a frame animation timeline with all the frames selected from the movie. From here, go to File > Export > Save for Web (Legacy) >  GIF. Choose colors, size, and looping to taste. Finally, click “OK.”

Now the animation you illustrated in Illustrator, animated in After Effects, and processed in Photoshop is a complete animated GIF!

Animated GIF at the End of This Tutorial

Preview of how to animate along a path at the end of the tutorial
Preview at the end of the tutorial [GIF]

My Final Coral Reef Animation

The Harlequin filefish animates along a path in the shape of a loop-the-loop. I also added added another way to animate along a path, this time a circle for the small Redeye goby. Finally, a group of fish move across the screen in the background, and the sunlight rays grow and shrink.

Lara Lee. Animated coral reef scene.
My final animated coral reef scene with additional moving embellishments.

For More References:

To see After Effects timeline editing in more detail, check out Adobe’s video tutorial, “Animate an object to follow along a path.”