(Page 4 of 4 pages for this article « First  <  2 3 4)

Sunday, June 06, 2010

Filed under: Motion GraphicsPost ProductionVisual Effects

Deeper Modes of Expression, Part 6: Managing Time, Layer Numbers, Speed, and Velocity

Chris Meyer | 06/06

Ways of manipulating time with expressions, including having one layer echo the movements of another with delay.

Keyframe and Marker Time

In addition to accessing values at certain times, After Effects allows you to access values at certain keyframes or markers. You can also access the time at which markers and keyframes are placed. This means, for example, you can have an animation triggered by the placement of markers.

To find the time of the keyframe that is nearest to the current time, use nearestKey(time).time. To find the time of this layer’s nearest layer marker, use marker.nearestKey(time).time; to find the nearest comp marker, use thisComp.marker.nearestKey(time).time. To find the time at which a numbered comp marker is located, use thisComp.marker.key() and place the desired marker number in quotes. For example, thisComp.marker(“1”) returns the time of marker #1. If you leave out the quotes, After Effects will return the time of the first marker, not the marker numbered “1.” If the marker has not been created or assigned, you may get an error.

To find how close you are in time to the nearest keyframe or layer marker, just subtract time from either of those expression phrases. This will give you a positive value if the current time is just before the nearest keyframe or marker (in other words, the current time is a smaller number than the time of the nearest key), and a negative value if the current time is just after the nearest keyframe or marker.

If you need the absolute value of this difference in time (in other words, a positive number regardless of whether you are before or after the nearest keyframe or marker), use the Math.abs(value) expression discussed earlier in this chapter – for example, Math.abs(marker.nearestKey(time).time – time).

In our final example in this installment, we’ve trained an alarm clock to scale up to 50% as it crosses a layer marker, and to scale back down to 0% whenever it is more than 0.5 seconds away from the nearest marker:

In this example, an alarm clock’s scale varies depending on how close the time indicator is to a layer marker. The three images on top are taken at 00:00, 01:00, and 02:00; look at the Timeline panel above and observe the relationship between markers and time. Alarm clock courtesy Classic PIO/Sampler; background courtesy Digital Vision/Inner Gaze

To do this, we used the following expression applied to its Scale property:

time_to_marker = Math.abs(time - marker.nearestKey(time).time);

linear(time_to_marker, 0, 0.5, [50,50], [0,0])

The first line is the same as we just discussed: Get us the absolute value of the difference between the current time, and the time of the nearest marker. The second line uses a linear interpolation method (discussed in an earlier installment) to look at this time difference. As this difference varies between 0 (right on top of a marker) and 0.5 seconds (0.5 seconds away from the nearest marker), it produces a number that varies proportionally between [50,50] and [0,0]. We used the double values inside brackets because Scale is an array with two dimensions (three, if the layer was in 3D); just plugging in 50 or 0 would not work.

Hopefully, you can start to think of some creative applications of letting markers trigger animation events. For example, you can set up the expression, then add markers by tapping along with a piece of music or narration. There are other expressions you can create to extract the values of properties at specific keyframes or markers, or even to determine how many markers or keyframes a layer has. These features are discussed in the online Help file.

Next Installment: Making Decisions

Our next installment will discuss one of the most complex subjects in expressions: how to make decisions. This includes if/then/else statements for animation decisions and error checking, do/while loops to create “simulation” animations, and additional notes on equivalence tests, accumulating values inside loops, and formatting expressions. 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 next edition of Creating Motion Graphics - for After Effects CS5 - is due out by the end of June 2010.

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 4 of 4 pages for this article « First  <  2 3 4)

               



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