How to Use After Effects: Animate a Line

Animation. A Golden Grid overlays the proportions of the Open Heart Parrot Rescue logo design.

A super popular but surprisingly easy motion graphic to make in After Effects is animating a line. Use After Effects to animate a line to “draw” an illustration before the viewer’s eyes. Follow along with this tutorial of how I used After Effects to animate lines overlaying the Golden Ratio on my Open Heart Parrot Rescue logo. (See Open Heart’s case study too to learn how I designed the logo!)

Prepare the Illustrator Artwork.

Step 1: Prepare the Illustrator Artwork.

Like my previous After Effect tutorials, be sure to give each shape you want to animate its very own layer in the Illustrator document.

Most importantly, all the lines for the animation must be exactly that: lines. Stroke-only line objects. As a result, several animated illustrations depict monoline drawings. Therefore, to animate a line later, make it a stroke-only Illustrator shape first.

However, not every line has to have its own layer. After Effects can automatically animate a group of lines together.

To animate a line that isn’t a simple stroke—for example, the brush typography in my Smile Team logo design—requires different After Effects techniques.

Finally, label layers with names that will make sense after importing the artwork into After Effects. To help manage my After Effects workflow, I also named and ordered my Illustrator layers in the rough order of their appearance in the animation I want to build.

Import the Artwork into a New After Effects Composition.

Launch After Effects and select New Composition from Footage. Select the Illustrator document and change Import As: from Footage to Composition ­– Retain Layer Sizes. The artwork appears a new source in the Projects panel.

Next, double-click it to make a new composition from the artwork and auto-populate the Timeline panel.

Step 2: Import the Artwork into a New After Effects Composition.

Go to the Application Bar > Composition > Composition Settings (Cmd + K) to tweak settings like the video duration and background color. For example, in mine I set the duration to 16 seconds (0:00:16:00) for plenty of work room. Then, I also changed the background color from black (#000) to white (#fff).

As you’re animating, you may find you need to make changes to the Illustrator document. To learn all the tricks for syncing edits with your After Effects project, check out tip #4.

Convert the AI Lines to AE Shapes.

Select a line layer within the Timeline panel. Right-click the layer (or go to the Application Bar > Layer) > Create > Create Shape from Vector Layer.

As a result, After Effects automatically hides the original line layer. Then, a new shape layer appears in its place. After Effects also adds the word “Outlines” to the end of the shape layer’s name and changes the layer’s icon and label color.

Step 3: Convert the AI Lines to AE Shapes.

Repeat this step for each line layer to convert them into editable After Effects shapes.

At this point, I also hide my Macaws Full Color layer for a grand reveal at the end of the video.

Add Trim Paths to the Outlines.

This part might be tricky since it seems After Effects has moved around this effect with some updates. As of this tutorial, I’m using After Effects CC version 16.1.3, so the location may differ for you if you’re using a different AE version.

Select an Outlines layer in the Timeline panel and expand it to Contents > click Add > Trim Paths.

Step 4: Add Trim Paths to the Outlines.
Illustration of how to add Trim Paths to the outlines.
(An illustrated close-up.)

Next, expand Contents to reveal Trim Paths 1. Then, expand Trim Paths 1 to reveal trim path properties Start and End.

Finally, repeat this step for each outlines layer to add trim paths to them all. To work faster, select all the outlines layers in the Timeline panel, then type U to toggle expand/collapse multiple layers at once.

Animate a Line.

The next part(s) might also be tricky. You might not remember precisely how you drew each line, but Illustrator does. The first point added becomes the starting point, and the last point to finish the line becomes the ending point. This drawing order, for example, affects how Illustrator applies stroke arrowheads to the path. It also affects the path’s animation later in After Effects.

Therefore, you might find that you need to reverse/switch the steps I’m outlining in my tutorial for your project. In fact, I found I needed to do the same to finish my animation. Continue reading the next section for troubleshooting this reverse/switch.

Choose a line to animate first. I opted for one that’s big and obvious: my Golden Spiral layer. I select the layer then keep expanding it until I see Start and End stopwatches for Trim Paths 1.

Place the Timeline scrubber at 0:00f. Add the first End keyframe here. Then, set its value to 0%.

Next, move the scrubber later down the line. For example, I went to 04:00f for 4 seconds. Add the second End keyframe here and change its value to 100%.

Here’s the result when I used After Effects to animate my very first line:

Result after animating a spiral path.

Troubleshoot the Line Animation.

As I mentioned previously, the drawing order of the line’s points affects how it animates in After Effects. If the line isn’t moving in the right direction or is hiding vs. revealing, try a combination of these solutions:

Generally, to reverse path direction, reverse the 0% and 100% values. Likewise, to switch hide/reveal, switch the Start and End keyframes. (However, I didn’t find this to be consistent.)

  • Select both keyframes in the Timeline panel > right-click > Keyframe Assistant > Time Reverse Keyframes. Alternatively, you can manually switch the starting and ending values with each other. (For example, switch the 100% at 00:00f to 0% and 04:00f from 0% to 100%.)
  • Make note if the line used the Start or End keyframes and the timing for both keyframes in the Timeline panel. If Start was used, switch to End keyframes. On the other hand, if End was used, switch to Start keyframes. Copy-paste and drag-and-drop won’t work here, manually replicate the old times and values into the new keyframes.

Animate another line.

Locate another outlines layer to animate its line. For my second line, I chose an outward shape from the Golden Grid.

Again, expand the second outlines layer > Contents > Trim Paths 1 > Start and End properties.

I started animating this line like I did the first: End keyframe #1 at 00:00f with 0% then End keyframe #2 at 04:00f with 100%. This didn’t work. My line hid itself instead of revealing itself. It also animated in the wrong direction, moving against the animated spiral instead of with the spiral. To fix these issues, I completed both of the troubleshooting techniques above.

I found that to reverse path direction, reverse the 0% and 100% values. To switch hide/reveal, switch the Start and End keyframes.

To show the two lines interacting, I want to time it so that the second shape finishes drawing itself right when the spiral passes. So, I tweaked timing to taste by dragging the Timeline scrubber back and forth to identify the moment of intersection and add a keyframe there.

Result after animating two moving lines "drawing themselves."

One Last Note: Animating a Group of Lines.

Remember earlier in step one, “Prepare Illustrator Artwork,” that not every line needs its own layer? After Effects will automatically animated out a layer with a line group if you don’t need advanced control. Change the Trim Paths 1 Trim Multiple Shapes setting from Simultaneously to Individually to see how they play out.

For more ideas on how to animate a line, check out Premium Beat’s article, “5 Ways to Animate with Trim Paths in Adobe After Effects.”

My Final Result:

End result. A Golden Grid overlays the proportions of the Open Heart Parrot Rescue logo design.