Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
LIBRARY:TutorialsVideo TutorialsReviewsInterviewsEditorialsFeaturesBusinessAuthorsRSS FeedTraining DVDs

Animating a Walk-Cycle Using Loop Expressions

COW Library : Adobe After Effects Tutorials : Dan Ebberts : Animating a Walk-Cycle Using Loop Expressions
Animating a Walk-Cycle Using Loop Expressions


from CreativeCow.net's ''25 Cool Things about After Effects 5.5'' Series


Animating a Walk-Cycle Using Loop Expressions
Dan Ebberts Dan Ebberts,
Sacramento, California, USA

©2002 by Dan Ebberts and CreativeCow.net. All rights are reserved.

Article Focus:
With version 5.5 of After Effects, Adobe has included some new keyframe-looping expressions that can be very useful for cyclic animation and layer-looping. In this tutorial, Dan Ebberts walks us through the basics of how to set up and use these expressions and then use one to loop a walk-cycle as you might do in a simple character animation.


Movie Not currently available Project file (includes ai file) Download Stuffit Expander for Windows

The new loop expressions can be a little confusing until you get used to them. Basically, you define the region that you want looped by setting one or more keyframes. Then, the type of loop expression you use determines whether looping occurs before the first keyframe (loop_in) or after the last keyframe (loop_out). The parameters that you provide determine the nature of the looping (cycle, pingpong, offset, or continue) and the duration of the segment that gets looped. An example might make things more clear. Let’s say that you have an animated sequence at the start of a layer and you want it to repeat over and over for the duration of the layer. You might use the following expression in each of the animated properties:

loop_out(“cycle”,0)

(Note that Adobe’s documentation shows these expressions in the form loop_out(type= ”cycle”, num_keyframes= 0), but you can safely leave out the type= and num_keyframes=. I prefer the shorter form and that’s what we’ll use in this tutorial).

This expression tells After Effects to take the sequence between the first and last keyframes and, starting from the last keyframe, repeat the sequence until the layer’s Out point is reached. Note that the second parameter defines the length of the sequence to be looped by telling After Effects how many keyframes (counting backwards from the last one) to loop. A “zero” in this parameter says to use all keyframes. The expression given above is probably the one you will use most often and it’s the one we’ll use for the walk-cycle animation.


O.K. Let's Begin

Go Ahead and open the “loop_project” file in After Effects. Then open the “intro” comp. This comp has layers set up with position keyframes and loop_out expressions applied. You will want to examine the various layers in this comp to see how the loop expressions work. I’ve set these up so that the keyframes start one second into the comp so that you can see that nothing happens before the first keyframe. Select the “cycle_1” layer. As you examine each of these layers, you’ll want to make sure that it is the only layer visible (besides “grid”) and that you hit the “u” key to expose the keyframes in the position property and that you open the little twirly so you can see the expression. Step through the keyframe area and beyond. You might expect, since this is supposed to be a cyclic loop, that the segment between the two keyframes would loop over and over. That’s not quite what happens as you’ll notice as you move past the keyframed segment.



at first frame of new cycle, box does not return to starting position as expected

It seems that the “cycle” flavor of loop_out works best when the starting and ending positions are the same. Toggle the visibility of “cycle_1” off and turn “cycle_2” on. You’ll see that we’ve solved this little anomaly by adding one more keyframe and moving the square back to the starting position. Now it works the way you would expect. This is something that you need to keep in mind when using “cycle”. Toggle off the visibility of “cycle_2” and turn on “ping_pong”. As you step through this layer, you’ll notice that it works exactly the way you would expect – the little square moves back-and-forth along its path. Turn off “ping_pong” and turn on “offset”. You’ll see that the “offset” version repeats the motion but starts from where the previous cycle left off. Turn off “offset” and turn on “continue”. I’ve changed the path somewhat for this example so you can more easily see the effect. You’ll notice that the little square keeps moving with the direction and velocity it had at the last keyframe.

Feel free to experiment with these layers until you feel comfortable with what’s going on. I’d recommend changing the expressions to the “loop_in” variety and seeing that the looping action now occurs before the first keyframe. You might also want to experiment with the num_keyframes parameter, although “0” will probably be what you use the most often. Also try the loop_in_duration and loop_out_duration varieties, where the second parameter is time (in seconds) instead of keyframes.

Go ahead and open the “model” comp. This comp is an Illustrator file that was imported as a comp. It has a separate body part in each layer. To keep things somewhat simple I made each arm as only one piece and the head is combined with the torso.



exploded view of model showing the pieces

I’ve taken care of the animation of one cycle of the walk-cycle (since the focus of this tutorial is using the loop expressions, not character animation), but I’ll briefly go over what I did. The first step was to move all the anchor points to the center of rotation for that body part. For the feet this would be the ankle, for the lower legs it’s the knee, for the upper legs it’s the hip joint, and for the arms it’s the sholder joint. I did this in the comp window using the Pan Behind tool.



repositioned anchor points

After the anchor points were in the correct positions, I “stitched” the character together by establishing parent relationships. Look at the parent column in the time line and you’ll see that the torso is the parent of the arms and the upper legs, the upper legs are parents of the lower legs, and the lower legs are parents of the feet.



parent relationships

This means that when, for example, an upper leg is rotated, it will rotate around the hip joint and the lower leg and foot will follow. I started the animation with the legs at their maximum distance apart and set rotation keyframes for the arms, upper legs, lower legs, and feet and a position keyframe for the torso. I copied all these keyframes and pasted them in at the end of the cycle (1:02 in this case). I other words, at time 1:02 our model will be back to her starting position. Then I went to the halfway point ( 0:16) and swapped the left and right values. That is, halfway through the cycle the model will be in a position that is reversed from the start of the cycle. Scrub through the timeline and you’ll see what I mean. I then stepped through the cycle, adjusting the rotation of the limbs to generate a smooth motion. I changed all the keyframes to Bezier to smooth out the action even more. This is really the time-consuming part – adjusting the positions of the body parts to give a convincing walking motion.



keyframes for walk-cycle


Adding the Loops

Once you’re happy with the cycle, it’s time to add the loops. If you twirl down the rotation property of one of the limbs or the position property of the torso, you’ll see that I’ve applied the loop_out(“cycle”,0) expression to each. You’ll notice that even though the last keyframes are at 1:02, the walk-cycle repeats to the end of the comp.

You might be thinking that it’s kind of a pain to enter an expression for each body part (really it’s not – you just copy and paste). There are, of course, at least a couple other ways to accomplish the same looping effect. You could pre-render the walk-cycle, re-import it and set the layer to however many loops you want in the “interpret footage” dialog. Or, you could copy and paste the keyframes repeatedly to the end of the comp. One advantage of doing it with expressions is that if you need to tweak the walk-cycle in some way to make it look better, you just turn off the expression, make the adjustment, turn the expression back on and you’re done.

Go ahead and open the “final” comp. All I’ve done here is animate the “model” comp moving from left to right at a speed such that her feet don’t slip. Try moving the last keyframe around and watch the effect it has on how her feet contact the ground. I also added a “ground” layer for her to walk on and a little drop shadow.


One More Thing

If you open the “extra” comp you’ll see another trick that’s pretty cool. For this comp I used a version of the “model” comp that has the loop expressions removed (“model_no_loops”). For this layer I enabled Time Remapping. If the time remapping keyframes aren’t already visible, select the “model_no_loops” layer, type “rr” on the keyboard, and open the Time Remapping twirly so you can see the expression. When you enable Time Remapping, After Effects sets keyframes at the start of the layer and one frame past the Out point of the layer. I moved the Time Marker to 1:02 and set another keyframe. Then I deleted the last keyframe. Then I added our old friend loop_out(“cycle”,0) to the Time Remapping property.



time remapping applied

If you scrub through the timeline, you’ll see that the results are the same as the “final” comp. What’s so cool about that? Well, for one thing, you only have to enter one expression instead of one for each body part. Also, now you can adjust the walk-cycle in the “model” comp without having to disable and re-enable the expressions.

##Dan Ebberts

Feel Free to discuss this technique in the After Effects forum here at CreativeCOW.






Please visit our forums and view other articles at CreativeCOW.net if you found this page from a direct link.


  View 1 Comment(s)

  Adobe After Effects Tutorials   •   Adobe After Effects Forum
Reply   Like  
Comments

Re: Animating a Walk-Cycle Using Loop Expressions
by Raphi Stein
Very useful tutorial and nice job on the walk cycle


Related Articles / Tutorials:
Adobe After Effects
What's new in After Effects CS6: Shapes from Vector Layers

What's new in After Effects CS6: Shapes from Vector Layers
  Play Video
In this tutorial, Kevin P McAuliffe shows you how, using the great new "Create Shapes from Vector Layers" command in After Effects CS6, you can create 3D extruded client logos in minutes, as opposed to having to wait hours for a 3D application to render it out.

Tutorial, Video Tutorial
Adobe After Effects
AE Basics 44: Shaping Text And Advanced Options

AE Basics 44: Shaping Text And Advanced Options
  Play Video
AE Basics - A Creative COW series for new users of Adobe After Effects. Lesson 44: In this (more advanced) tutorial, Andrew Devis shows the options to change the way text moves through its range and explains how to change this from the default smooth animation to a much more 'digital' or abrupt instant change. Andrew then goes on to demonstrate more of the advanced options in the timeline to 'shape' your text so that it can have a more interesting or dramatic look allowing for the type of animation that would be very difficult to achieve otherwise.

Tutorial, Video Tutorial
Adobe After Effects
Create a Rotating Counter TWO: Adding & Adjusting a Bounce

Create a Rotating Counter TWO: Adding & Adjusting a Bounce
  Play Video
In the second part of this 2 part tutorial, Andrew Devis shows how to animate the rotation of this group of layers as well as how use and adjust an expression that ships with After Effects to have the layers bounce in place as they stop which can give the sense of the counter having some real mechanical properties rather than just a linear of easy-ease keyframe approach.

Tutorial, Video Tutorial
Adobe After Effects
Create a Rotating Counter ONE: Positioning 3D Layers

Create a Rotating Counter ONE: Positioning 3D Layers
  Play Video
In the first part of this 2 part tutorial, Andrew Devis shows how to create and place layers in 3d space such that they can be rotated as a single group to be used for a rotating counter. Andrew shows how to create and place the layers using both the math function of AE as well as a handy and simple expression that places layers a fixed distance or rotation from the previous layer. He then goes on the show how to create and use a controller for the multiple layers so that they act as a single group. In the next tutorial, Andrew will show how to animate the rotation of this group of layers as well as how use and adjust an expression that ships with After Effects to have the layers bounce in place as they stop which can give the sense of the counter having some real mechanical properties rather than just a linear of easy-ease keyframe approach.

Tutorial, Video Tutorial
Adobe After Effects
Confessions of a Creative Maniac: Keys to Getting It In

Confessions of a Creative Maniac: Keys to Getting It In

In the history of computing, including the extension to the notion of what actually falls under the guise of history - let's face it, smartphones are really just diminutive computers in a somewhat flimsy disguise - an often overlooked aspect of the entire discussion is something absolutely core to the idea of how these communications devices interface with us - the venerable keyboard.

Editorial
Adobe After Effects
Introducing After Effects CS6 - Extruded Text and Shapes

Introducing After Effects CS6 - Extruded Text and Shapes
  Play Video
In this introductory tutorial to the new 3D capabilities of After Effects CS6, Kevin P McAuliffe shows the basics of how to extrude text and shapes inside of After Effects CS6, and also shows how tight integration with Adobe's Illustrator will have you creating powerful client logos in minutes, instead of in separate 3D applications.

Tutorial, Video Tutorial
Adobe After Effects
Adobe After Effects: Compositing Actors in Virtual 3D Sets

Adobe After Effects: Compositing Actors in Virtual 3D Sets
  Play Video
Rob Mize follows up his Creating Virtual 3D Sets tutorial with this demonstration of how to composite real-life actors into these 3 dimensional environments. Learn how to create an effective sense of interaction between your actors and their virtual environment using only your green screened footage and AE's 3D capabilities.

Tutorial, Video Tutorial
Adobe After Effects
FreeForm Pro and Aqua Pack: Basic introductory series Part 2

FreeForm Pro and Aqua Pack: Basic introductory series Part 2
  Play Video
The second tutorial from the series describes techniques for manipulating the depth map and texture map that can be used for a logo reveal.

Tutorial, Video Tutorial
Adobe After Effects
Panning Large Scenes Using Target Layers in 3D

Panning Large Scenes Using Target Layers in 3D
  Play Video
In this follow-on tutorial to his short series on working in 3D space, Andrew Devis shows how to use this simple technique to quickly and accurately pan around large layers/compositions to zoom in to the exact point required each time. You'll use target layers to get the exact coordinates needed for accurate panning - simple but effective!

Tutorial, Video Tutorial
Adobe After Effects
FreeForm Pro and Aqua Pack: Basic introductory series Part 1

FreeForm Pro and Aqua Pack: Basic introductory series Part 1
  Play Video
Introductory series (first in a set of three) for simulation of large bodies of water, water environments and water replacement in After Effects using FreeForm Pro from Mettle and the Aqua Pack enhancement pack.

Tutorial, Video Tutorial
MORE


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2012 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]