(Page 1 of 1 pages for this article )

Sunday, August 01, 2010

Filed under: Motion GraphicsPost ProductionVisual Effects

Deeper Modes of Expression, Part 8: Going for a Loop

Chris Meyer | 08/01

Causing animations or footage to loop by repeating already-placed keyframes or segments of time.

Our previous installment was about decision-making loops (if/then and while/do statements). This installment is about a different kind of loop: repeating an animation without having to loop footage or places copies of an animation end-to-end.

After Effects supports the ability to loop a number of keyframes in an animation, repeating their values and timing. There are four different looping methods, found under the Property submenu in the expression language menu:

looping(“type”, keyframes)

loopInDuration(“type”, time)

loopOut(“type”, keyframes)

loopOutDuration(“type”, time)

The two loopIn methods repeat the property’s animation from the first keyframe back to the trimmed in point of the layer. The two loopOut methods repeat the animation from the last keyframe to the trimmed out point.

The “type” is typically one of three words; each must be in parentheses:

  • The type “cycle” (parenthesis required) repeats the keyframed values, as if you copied and pasted them end to end.
  • The type “pingpong” loops these keyframes back and forth.
  • The type “offset” is a version of “cycle” that automatically offsets the value of the property so that when the expression loops back to the first keyframe, the animation proceeds smoothly rather than jumps in value.
  • The type of “continue” automatically increments or decrements the value based on the rate of change of that value at the specified keyframe.

You don’t need to include the comma and second value (keyframes or time); if you leave them off, After Effects will assume you want to loop as much as possible – for example, all the keyframes, the entire duration from the in point to the last keyframe (loopOutDuration), or the entire duration from the first keyframe to the out point (loopInDuration). Otherwise, you can specify the number of keyframes, or the length of time in seconds. Note that loopIn always hinges around the first keyframe, and loopOut always hinges around the last keyframe.

Spinning Wheel

That all sounds very abstract so far, so let’s look at a few examples. As before, we’re going to use the Graph Editor has it helps reveal both what the original keyframes are doing, and what the result of the expression will be:

In the example above, the layer has just two Rotation keyframes, going from 0° at time 0:00 to 140° at time 1:00 (shown as the solid portion of the line in the Graph Editor). But if you to play this animation, you will see that the tire rocks back and forth for the entire duration of the comp (represented by the dotted lines after 1:00 in the timeline). This is because Rotation has the expression loopOut(“pingpong”), which loops back and forth between these keyframes.

Note that if we were to slide the keyframes later in time, the tire would not rotate until the first keyframe is reached, but will keep rocking back and forth afterward. This because the method loopOut is concerned about what happens after the existing keyframes -not before.

Indeed, below is a second example, with a similar set of keyframes - except they start later in time. In this case, the tire layer would rock back and forth before the first keyframe is reached. This is because we used the expression loopIn(“pingpong”):

When you loop based on keyframes, After Effects tries to make the first and last keyframes exist at the same point in time. This is great if you have keyframed a seamless loop, but creates perhaps unexpected results if the first and last keyframes do not have the same value: As you move one frame beyond the last keyframe looped, you will see the same parameter value as one frame after the first keyframe – not the same as the first keyframe itself.

To illustrate this, in the next example we used the expression loopOut(“cycle”). As you can see from the resulting graph, the tire layer rotates forward from 0° to 140°, then on the next frame jumps to 0.5° – the same value as one frame after the first keyframe:

To have this animate smoothly, one solution would be to edit the expression text to change the type from “cycle” to “offset” and preview again: Now the motion is smooth, because the “offset” type resolves the difference between the first and last keyframe values:

The same concept applies to controlling Position or other properties.

The method loopOut(“cycle”) has the interesting characteristic where the value of the first keyframe exists at essentially the same time as the last keyframe. As you move one frame beyond the last keyframe looped, you will see the same parameter value as one frame after the first keyframe – not the same as the first keyframe itself.

Looping Time

The loop expressions can also be used to loop a footage item or a precomp. This is especially useful as there is otherwise no way to loop a comp other than to prerender it (and then loop the resulting footage item). To pull this off, apply the loop expressions to Time Remap keyframes.

In our final example, the layer [Ex.18_precomp] contains an animation that seamlessly loops, but only one copy of this loop is contained in the comp. This could be any looping animation you create.

In the master comp shown below, we applied Layer > Time > Enable Time Remapping to this layer, and dragged the layer’s out point to the end of the comp. We then added the expression loopOutDuration(“cycle”, 2.5) to Time Remap, where 2.5 equals the duration of the precomp in seconds. As a result, our animation loops seamlessly for the duration of its new comp:

Note that we did not use loopOut(“cycle”), which would rely on keyframes. There are many potential pitfalls in using this technique with Time Remapping, as you can get glitches around the last keyframe. As discussed in the sidebar “The Real Out Point” in the Frame Rate Manipulation chapter in our book Creating Motion Graphics, Time Remapping places its second keyframe on the frame after the end of the source. Additionally, loopOut assumes the first and last keyframe exist at the same point in time – all of which is difficult to untangle in the case of looping footage or a precomp.

By the way, you only need to use this trick if you are trying to loop a keyframed animation. You can loop footage directly in the Interpret Footage dialog for the desired clip.

Next Installment: Wiggly World

In the next installment, we’ll discuss one of the essential expression tools to add to your arsenal, regardless of your After Effects skill level: wiggle. Until then…

We’re in the process of serializing the Deeper Modes of Expression bonus chapter from our book Creating Motion Graphics with After Effects into a set of 12 posts here on PVC.

The latest edition of Creating Motion Graphics - covering the updates introduced in After Effects CS4 and CS5 - is shipping now.

The content contained in Creating Motion Graphics with After Effects - as well as the CMG Blogs and CMG Keyframes posts on ProVideoCoalition - are copyright Crish Design, except where otherwise attributed.

(Page 1 of 1 pages for this article )

               



You must be registered to comment. This is an effort to reduce spam. Please REGISTER HERE.

Name:

Email:

Location:

URL:

Smileys

Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:




After Effects Apprentice Free Video: Rendering a 4:3 Center Cut Movie from a 16:9 Composition
After Effects Apprentice Free Video: Using Parenting to Animate Layers as a Unit
After Effects Apprentice Free Video: Working with Nested 3D Compositions
After Effects Apprentice Free Video: Copying Paths from Illustrator to After Effects
After Effects CS6 Tutorial: Exporting 3D Camera Tracker Data to Cinema 4D
After Effects CS6 Tutorial: Targeting Properties in the new Ray-Traced 3D Engine
After Effects CS6 (P)Review
After Effects Apprentice Free Video: Exploring Shape Effects
After Effects Apprentice Free Video: Drawing Parametric Shapes
After Effects Apprentice Free Video: The Puppet Starch Tool
After Effects Apprentice Free Video: Eraser Tool Modes
After Effects Apprentice Free Video: Tracking with mochaAE
After Effects Apprentice Free Video: Performing a Motion Track
After Effects Apprentice Free Video: Creating 3D Objects using Adobe Repoussé
After Effects Apprentice Free Video: Understanding Axis Modes
Using After Effects as an Advanced Titler for Premiere Pro
After Effects Apprentice Free Video: Creating an Orbit Camera Rig
CMG Hidden Gems: Chapter 45 – What’s Your Preference?
CMG Hidden Gems: Chapter 44 – Prerendering and Proxies
CMG Hidden Gems: Chapter 43 – Advanced Rendering
CMG Hidden Gems: Chapter 42 – Render Queue
CMG Hidden Gems: Chapter 41 – Video Issues
CMG Hidden Gems: Chapter 40B – 3D Channel Effects
CMG Hidden Gems: Chapter 40 – Integrating with 3D Applications
CMG Hidden Gems: Chapter 39 – Integration 101
After Effects Apprentice Free Video: Multiple Playback Speeds
CMG Hidden Gems: Chapter 38 – Import and Interpret
CMG Hidden Gems: Chapter 37B and 37C – Expressions and Scripting Bonus Chapters
CMG Hidden Gems: Chapter 37 – Expressions
CMG Hidden Gems: Chapter 36B – Audio Effects







After Effects Apprentice Free Video: Working with Nested 3D Compositions

Chris and Trish Meyer | 05/07

How you can be two places at once inside After Effects

As we mentioned awhile back, we’ve been busy the past year and a half creating an extensive, multi-course video training…

Expression Shorts - loop

David Torno | 05/06

Learn how the loop expressions work.

image

Looping is a very common task in our industry and is mostly associated with video footage of some…

After Effects Apprentice Free Video: Copying Paths from Illustrator to After Effects

Chris and Trish Meyer | 05/01

Revealing Illustrator paths requires a few intermediate steps, involving After Effects masks and effects.

Buried in the shuffle over the announcement of After Effects CS6 is that we concluded the video training series for our book After…

After Effects CS6 Tutorial: Exporting 3D Camera Tracker Data to Cinema 4D

Chris and Trish Meyer | 04/27

You can export the results of the new 3D Camera Tracker to any application that has a way to accept AE keyframe data.

One of the major new features in After Effect CS6 (which we previously previewed here) is a built-in 3D Camera Tracker. Rather than track a specific…

To be considered for listing, contact pr (at) provideocoalition (dot) com


Copyright © 2012, HD Expo, LLC a division of Diversified Business Communications. DBA Createasphere

All rights reserved. HD EXPO, High Def EXPO, Createasphere, E-Tech, Entertainment Technology Exposition, 3D Production Workshop, VariCamp, P2 Camp, ColorCamp 101, and Lighting, Filters & Gels for HD are all trademarks of HD Expo, LLC.

Terms of Use  |  Privacy Policy

Check PageRank