Sunday, February 10, 2013

Tutorial - Working with a Motion Path created in Illustrator in After Effects



Illustrator to After Effects: A Roller Coaster Ride


Overview:
The goal of this tutorial is to demonstrate a specific motion graphics workflow using Illustrator and After Effects.
This tutorial walks through the steps of importing Adobe Illustrator-created motion path and artwork into After Effects and setting up a looping animation. 
Time to complete tutorial is approximately 30 minutes.

Technical Details:
The following techniques are covered:
  • Importing Illustrator art as a composition for use in After Effects (AE)
  • Using an Illustrator path as a motion path in AE
  • Adjusting time length of the motion path by modifying the key frames in AE
  • Adjusting the anchor point of the object to be animated in AE
  • Orientating the animated object to the motion path in AE
  • Set up Time Remapping and an Expression to loop the animation in AE

Software:

Adobe After Effects CS6 and Adobe Illustrator CS6


Step 1 – The project

The project files and techniques documented here create a looping animation of a roller coaster car following a track as seen in the above video.  Although the video does not loop, the animation set up in After Effects is set to loop with Time Remapping and an Expression.  



Step 2 – Assets

Layers panel from rollercoaster.ai

Let’s first look at our assets that make up our animation. We will start with one Illustrator file named rollercoaster.ai that can be downloaded here. This document has a dimension of 1280 x 720 and contains four layers: 

  • background (the background art)
  • track (the art of the roller coaster track the car appears to follow)
  • car (the art of the car, the object that animates with the motion path)
  • motion path (the path used inside After Effects to apply the motion)


Step 3 - Importing the Illustrator art to use as footage in AE




Screen cap of importing rollercoaster.ai into After Effects





In After Effects, select from the top menu “File > Import > File...” In the import file window, browse to your file then change the “Import As” drop down to “Composition - Retain Layer Sizes”. Click the “Open” button.


After Effects imports the file as a composition. 

The composition name is the same as the Illustrator file rollercoaster which can be seen in the Project panel. (The illustrator art layers are also bundled together in a folder in the Project panel.)



Step 4 – Applying the Motion Guide


Step 4.1 - Delete the motion path art/footage


Double click on the rollercoaster composition in the Project panel to open it. Locate the  “motion path” layer in the timeline (it is a thick black line that follows the red roller coaster). Since the motion path is imported as footage, it contains no path data needed for the motion path, therefore we do not need this layer. Select this layer and delete it - we will import the path data from Illustrator (select layer then press the delete key on your keyboard). 
Stop 4.2 - Align the car Anchor Point
Zoomed in view of anchor point.

Screen cap of the repositioned anchor point.

Select the “car” art then select the “Pan Behind” tool. Click and drag the Anchor Point of the car to the bottom of the art, where the wheels meet the track (the Anchor Point is located in the center of the car and looks like a bullseye). This aligns the wheels to the motion path we will import in the next step.
Step 4.3 - Import the Motion Path

Layers panel in Illustrator. Select the motion path.

In Illustrator, select and copy (Command-C on a Mac) the motion path line. Be sure to select the whole path before copying. You have now copied the path data into your computer clip board. Jump back into After Effects and select the “Position” transform (under the Transform twirl down) for the car layer. Paste (Command-V on a Mac) the motion path. 


Screen cap of motion guide and corresponding key frames.

You will see the motion path in your composition work area and key frames associated with it applied to the car layer’s “Transform > Position” attribute (you may need to adjust the position of the path by using your right or left arrow on your keyboard. Nudge the path until it overlays the track.) 
You can scrub the timeline current frame indicator to preview the animation. You should see the roller coaster car gleefully follow the motion guide.


Step 4.4 - Auto Orientate (or Fix my wheels, they are not touching the track!)
Screen cap of the Auto-Orientation dialog box.

You will notice that although the car is following the path from the anchor point we set up step 4.2, it does not orientate to the path. From the top menu select “Layer > Transform > Auto Orient...” On the following pop up box, select “Orient to Path.”



Step 4.5 - Adjust the time length of the motion path
Pasting the motion guide created a series of key frames that span about 2 seconds. Let’s double the time of the animation by selecting the key frame on the right and move it out to 4 seconds. This will double the time length of your animation. 


Step 5 - Tweak the timing of the key frames


Screen cap of the motion path's key frames and the available adjustments.

The motion path interpreted by AE creates a key frame based on each point of the path  that was pasted in from Illustrator. Adjust the keyframes between the starting and ending key frame to make the roller coaster car’s speed change more dramatically as it climbs up or speeds down a hill. 
By default, the key frames between the first and last one are set to Roving (meaning they move in relation to the ones next to them). Right click or control click the key frame to deselect this. Now you can reposition the key frame without effecting the others.  Set up your key frames as you see fit. (NOTE: As an extra challenge, you can also use the Graph Editor to modify the key frame velocities.)

Step 6 - Looping the Animation 

The next steps create a new composition that contains our rollercoaster composition. We will enable time remap and set an action on the rollercoaster composition to accomplish the loop.


Step 6.1 - Preparing the After Effects Composition

Screen cap of Composition Settings of
the rollercoaster comp.

The rollercoaster composition serves as the basis for our loop function. If it is not already, change your composition duration to 4 seconds (Command - K on a mac, or top menu Composition > Composition Settings...”).



Step 6.2 - Create a New Composition

Screen cap of Composition Settings dialog box
to create a new composition.

A new composition now needs to be created to place the rollercoaster comp into. In this example, I created a new composition (top menu “Composition > New Composition” or Command - N on a mac). Name it MainMovie and set the size to 1280 x 720 with a time of 16 seconds. Open this composition (double click on the MainMovie comp from the project panel) and drag the rollercoaster comp into it.



Step 6.3 - Time Remap

Screen cap of Time Remapping effect with Expression added.

Select the rollercoaster layer and right click on the layer and select “Time > Enable Time Remapping.” Now we will add the looping expression to the Time Remap. From the top menu select “Animation > Add Expression.” In the text input field replace the text “timeRemap” with loop_out("cycle",0).  Now extend the rollercoaster layer footage to fill all 16 seconds of the composition (be sure the keyframes for the Time Remap stay at 0 and 4 seconds).

Step 7 - Preview the animation
Screen cap of the RAM Preview button.

Ram preview the animation and the roller coaster car should run on the track 4 times in a seamless loop!



4 comments:

  1. I have a question. I'm attempting to do exactly this, but with an intricate drawing with upwards to 30 paths. I've attempted to join paths together in Illustrator, but there are instances where there is an intersection of 3 vertices and I can only join 2 paths when using the join function. In other instances it will connect the end of one path to another with a solid line and ruin the drawing.

    The premise for my project is that I have a drawing comprised of all paths in illustrator. I'll inport that into after effects. I'll then take the path information from illustrator and apply it to that layer in AE. This will create multiple masks. I then use the generate stroke effect and have it reveal on screen. That all works fine, but the issue comes when I take an image of a hand and try to apply the path properties to the hand's position properties. It doesn't work due the multiple paths. In addition, if I do manage to somehow get it to function it won't line up with what stroke is using to reveal the drawing.

    So here is what I really need. I need a way to take all of the illustrator paths and merge them into 1 single path. From there I would be able to use stroke and use the path information in moving the still image of the hand around to make it look like it is drawing. Does anyone have a solution to this? The reason I can't do it all by hand, because I have upwards of 20 of these to do, and I'm on a deadline.

    This effect is similar to the videoscribe software that you see all over the internet. I'm attempting to do the same effect in after effects, so I have more control over the effects that follow the hand drawn effect. Plus it saves a ton of hard drive space if I were to do it all with in the adobe suite.

    Thanks again!

    ReplyDelete
  2. Bonjour,
    merci de mettre un traducteur car tout le monde ne comprend pas forcement votre langue, mais vos idées et vos partages sont interressants
    please place traduction tool.
    Fred

    ReplyDelete