Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,900 courses, including more Video and personalized recommendations.Start Your Free Trial Now
- 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
In the previous movie, we showed you how to write a Wiggle expression for virtually any parameter inside After Effects and tantalized you with the various wiggle animation presets to put a form of user interface onto the Wiggle expression. Next, I'd like to show you how you can create your own user interface for expressions. To do that, let's look a different example. Go back to the Project panel and this time open up 06-Effects*starter. I am going to press 0 on numeric keypad to RAM Preview, and what we have here is some text that's being twisted in a random wiggly fashion.
To see what's going on, we'll select that text layer and type EE, two Es in quick succession, to reveal any expressions applied to that layer. Indeed, I see that wiggle has been applied to the Angle expression for the Twirl Effect. I'll go ahead and press F3, just to open this up in the Effects Control panel. Now that you know how wiggle works, you see we are wiggling at three times a second, with an amount that can range as far as plus or minus 60 degrees. Well, frankly, this looked a bit manic, and I probably prefer something less than that.
You can either keep editing these numbers and RAM Previewing till you get something you like, or you can add a user interface onto this. To do that, we'll set this text layer underwater and apply Effect > Expression Controls > Slider. Expression controls are very special effects that do not render. They don't change any pixels. They just provide raw user interface elements that you can then use to control expressions. In addition to this Slider control, there is Point, which is X and Y parameters; layer, where you get to stick different layers from a pop-up; a color swatch, and we'll play with that in the next movie; Checkbox turn things on and off; Angle Controls, might be very useful for the Twirl Angle here; and 3D point control, that was added in After Effects CS5.5 to give you X, Y, and Z parameters as the controller.
But anyway, first I want to add a Slider control. I am going to drag this above Twirl so that the thing I really want to edit is at the very top of my Effects stack. I am going to rename it. I'll select the name, press Return, and change its name to Wiggle Speed. Secondly, I'll go to Effect > Expression Controls, and this time add an Angle Control. I will drag it up, make sure its name is selected, press Return and type "Wiggle Amount," because in this case, I'll be using an angle to control the Twirl amount in this example, and Return.
To use the handy pick whip to connect expressions, you need to have all the parameters you want to work with exposed. We already have the wiggle expression for Twirl Angle exposed. I can twirl open Wiggle Amount and Wiggle Speed down here in the Timeline panel. And by the way, you can also drag pick whips directly to parameters in the Effects Control panel. Let's wire these up. I'll go to my Wiggle expression, carefully select the number 3, or just backspace over it to delete it, making sure my cursor is before the comma in the place of the 'how fast' parameter for wiggle. Then use the pick whip to connect it to the slider for Wiggle Speed.
Don't try to connect it to the effect name. That won't work. Drag it onto slider, you'll see it highlight, then release the mouse. You will see now that an effect called Wiggle Speed has a slider, and that's what we are going to use for this first parameter. Now select that 60 for the wiggle amount, use the pick whip again, and either drag to the Angle parameter down here in the Timeline panel, or if you forgot to twirl it open, you can drag it up to this Angle control in the Effects Control panel. Release and now you can see that After Effects has typed in that code for you automatically.
Press Enter on the numeric keypad, and now my edits have been accepted. Initially, there is going to be no twirl, and the reason is is my default Wiggle Speed and Wiggle Amount are both zero. But if we go ahead and scrub the Wiggle Speed up to something like maybe one wiggle a second, then change the Wiggle Angle to something like, well, maybe something around 50 or so degrees, you will see how the comps panels automatically updated to show this wiggle getting these brand-new parameters from the user interface we created.
0 to RAM Preview, and that's a slightly less manic version of this wiggle. Now in this case the slider wants the increment in whole units of one at a time, and that's really quite a bit, in terms of Wiggle Speed. You can go ahead and use some simple math to control the range of your user interface items, such as slider. For example, say that I want a value of 100 to equal one wiggle a second, just to give myself final control. I can go down to this expression, right after the effect Wiggle Speed slider, put the cursor in the right place before the comma, and say divided by 100.
You don't need to put in the spaces. I just did that for clarity to make the expression easier to read. Press Enter and now that Wiggle Speed has been greatly reduced. If I was to RAM Preview, you will see we have the very slow Wiggle Speed, but if I scrub this back up again to maybe something just under 100 and RAM Preview, now I have finer control over this Wiggle expression. There's one more thing you can do now that you have a user interface. Notice that you have animation stopwatches right next to each of these parameters in the Timeline panel, as well the Effects Control panel.
That means you can keyframe these values and in turn keyframe what your expression is doing. For example, say I wanted this to start off sedate and then start wiggling more as time goes on. I can go back to the Wiggle Amount, turn on keyframing, set an initial value of zero, go later on time, like maybe two seconds, crank up to something really intense like 90 degrees of twirl--note that doesn't mean it's going to twirl 90 degrees, just that's the maximum it can go plus or minus--then go to 3 seconds, add another keyframe, so we are going to hold that between two and three, extend this out, and then at the very end of my timeline, let's go back down to 0 degrees of wiggle. RAM Preview.
You can see how it ramps up amount, then ramps back down again. This is particularly handy if you're adding wiggle to the position of a layer, or perhaps the 3D camera in After Effects, just to give a little bit of a handheld or shaky-cam effect. You don't necessarily want the camera shaking all the time, maybe just during a movement, so you can go ahead and keyframe how much wiggle is being added into a layer's movement over time. The Graph Editor can be your friend in figuring out what things like this are doing. I'll enable the Graph Editor.
You can see my selected parameter, Wiggle Amount, is ramping up and ramping down. I'll select the actual Twirl Angle, turn on the Post-Expression Graph, and now I can see how my twirl is varying over time, thanks to the Wiggle expression being controlled by these Expression controls. Last thing I want to throw in, these are effects. You can save effects as animation presets. So once you've created an expression you particularly like, you can select the effect that has the expression, Shift+Click your user interface for it to select those elements as well, and go ahead and save them as your own animation preset.