- View Offline
The After Effects Apprentice videos on lynda.com were created by Trish and Chris Meyer and are designed to be used on their own and as a companion to their book After Effects Apprentice. We are honored to host these tutorials in the lynda.com Online Training Library®.
- Creating and managing expressions
- Linking together different parameters
- Randomizing a layer's movement
- Looping an animation
- Controlling multiple layers from a single source
Skill Level Intermediate
Next, I'd like to show you our favorite expression of all, Wiggle. First I'll clean up my display by closing all of my previous comps and open up 05-wiggle*starter. In it I just have a little gizmo in the middle of my screen just doing his own little animation. Let's say I want this gizmo to wander around the screen. In other words, I want to wiggle its position. I'll type P to reveal the position value, hold down Option or Alt to enable expressions for Position, click, and in place of the default expression transform.position, I am going to type wiggle, open parentheses, and I need to enter two numbers, how fast I want to wiggle and how much I want to wiggle by.
Let's say I only want to wiggle at a pace of one wiggle a second, fairly sedate, and let's say I want to wiggle by 100 pixels. Note that I separated the numbers with a comma. The space is not necessary; I put that in just to make it easier to read. And then close parentheses. Press Enter on numeric keypad, 0 to RAM Preview, and now my gizmo is indeed wandering around my screen. If I want him to wander faster, I increase the 'how fast' number from 1 to 2, RAM Preview.
Now he is much more kinetic and much crazier. If I don't want him wandering by quite as much, I enter a different number, like, say, 50 pixels, Enter, and preview. So now he sticks closer to the side of the screen, although he is wiggling very quickly. I'll go back to where we started, one wiggle a second and 100 pixels of wiggle. Notice that by default you don't see any motion path. We've not keyframed position. We just added wiggle on to the current position.
If you want to see that path, you need to enable the Post-Expression Graph button that we showed you in the previous movie. As soon as I turn that on, you will now see the motion path for the wiggle. As I drag the Current Time Indicator, you'll see him move along that wiggly path. Now you might run into occasions where that path is not long enough. We're not seeing the entire path. If you run into that, go into your Preferences and open Preferences > Display.
This is where you get to pick how long of a motion path you get to see. The default is 15 seconds, centered around your current time. We almost always set this to All Keyframes, so we get to see the entire motion path, no matter how long our composition is. However, if you find that's too much information that's cluttering your display, you can go back to one of these other options. But I am going to click All Keyframes for now. Note that Wiggle adds itself to the current position. You don't need to do plus value; it doesn't that automatically. So if I was going to go back to the start of my composition, I am going to turn off my Post-Expression Graph for now, move my gizmo down into the lower-left corner.
Now if I can turn off the Wiggle expression, so I get a true idea of where he really is, enable keyframing for position, press End to go to the end of the composition, drag him up to the upper right, now I have a very slow animation from the lower left to upper right. Turn the Wiggle expression back on and now he will wiggle along that path. So Wiggle can be used as an offset to create say shaky-cam effects or just more natural random movements.
If I want to see that path, I enable the Post-Expression Graph, and now I see my new modified path, and we'll preview again. Or you just drag the Current Time Indicator along the path to see what's going on. This is another case where the Graph Editor also comes in really handy to visualize what's happening. I am going to enable the Graph Editor. I have my Post-Expression Graph already turned on. If it was turned off, I would just get my flat animation, but now that it's turned on, I am seeing my Speed Graph for Position.
If I want to see the Value Graph for position, I need to go down here underneath Graph Type and change it to Value Graph. I want to see how my red and green lines for my X and Y position values are changing over time. The straight lines are my keyframed position. The curvy lines are with the expression added in. And again, I could turn off that graph or turn it on to see the results. RAM Preview and now you get a graphic representation of what's happening with the wiggle.
I'll turn that off for now. Position is not the only parameter you can wiggle. In fact, you can wiggle virtually any parameter. If you can keyframe it, you can apply an expression to it, and in virtually all cases, that means you can wiggle it. So I am going to type Shift+Plus+R to Reveal Rotation, Option+Alt+Click on the stopwatch to enable expressions. Type wiggle, open parentheses, how fast? Let's do a slow Rotation of 0.5 wiggles per second, or a wiggle gyration every two seconds, comma, and let's wiggle by 45.
The value is always the natural value range of the parameter. Close parentheses, press Enter, and now that only is this little guy flying along his path, he is also rotating randomly as well. He is looking a little bit drunk now, if you ask me, or maybe it's just a high wind. If I want to see him just centered in the screen, I'll just go ahead and turn off my keyframes for Position, but the expression is still enabled unless I was to turn that off as well. Now we'll see him sit in one place and rotate around.
One more thing about Wiggle is that it randomizes based on the layer number of the comp you are in. So if I was to take this gizmo and duplicate him, not only do I have two gizmos, they're each wiggling differently from each other. And you start going crazy and just hit Command+D or Ctrl+D to create a whole swarm of these guys moving around all together, and this creates a lot of fun. That's indeed what we did in the finished composition 05-Wiggle_final. Press Home, RAM Preview. We gave a background, just make life more interesting.
This gives you an idea of how you can quickly create swarming complex animations with a minimum amount of effort on your part. Well, some of you at this point are probably torn. You go, you know this is looking like a lot of fun, but it does require me to type in code, and it does require me to remember how the wiggle expressions has formed. Well, in this case you have a way of cheating. Sometimes cheating is good. I will turn off the expressions, and then I go over to the Effects & Presets panel, twirl open the Animation Presets, then twirl open the category know as Behaviors.
I'll go ahead and drag this a little bit wider so you can see these names. Down at the bottom of Behaviors there is a whole set of wiggle presets you can apply to your layer. For example, if you want to wiggle the position, select for layer and then either double-click this or drag it onto your layer, zero to RAM Preview, and now once again, you've got your gizmo wandering around the screen. But this time, rather than having code, you actually have what looks like an effect. We've got a controller effect up top where you get to enter Wiggle Speed and Wiggle Amount, and underneath is the Transform effect that's using to actually perform the movement.
Those who watched the previous After Effects Apprentice lesson on nesting and pre-composing, saw that we love the Transform effect. You can do a lot of stuff with it. You can go on and add Wiggle Rotation on top of that and add that added in as well. There are several other ones, Scaling, Wigglerama, which has a bunch of parameters, et cetera. Now one nice thing about these behaviors is that you do get this user interface where you get to scrub a value interactively, rather than having to retype it down on the Timeline panel, and you get to keyframe it.
Well, in the next movie, I am going to show you how you can add a user interface and to build the keyframe to an expression you write. You don't need to rely on a preset.
Sign up for a Premium Membership to download courses for Internet-free viewing.
Watch offline with your iOS, Android, or desktop app.Start Your Free Trial
After signing up, download the course here or from the iOS/Android App.