Style Switcher

Predefined Colors

After Effects Expressions 404 – Presets & Pseudo Effects

There are a few steps you should take
to prepare an expression for a preset. Number one. Start in the version of After Effects
you want the preset to be compatible with. Number two. Remove any unused code or expressions. Number three. Check your variable names to ensure they are
easy to understand and edit. Number four. Add comments to your expression
to help understand how it functions.

Number five. Decide if you need any keyframes included
with the preset and remove remaining keyframes. Number six. Make sure the expression does not
reference properties on other layers. So let's create an expression preset. In this composition,
you'll notice some Star layers. If you come down and highlight Star 01,
you can press T to open the Opacity channel. So go ahead and add
a new expression to Opacity. You can apply a wiggle expression
to change the Star's Opacity over time. So start with wiggle, open parenthesis, and
then you can set 5 for the frequency, comma, and then I'm going to use value, divided by 2,
for the amplitude, close parenthesis. So if you click away from the expression,
it's going to update here. I'm going to set some keyframes so it fades
in over time. So I'm going to come to 1 second
and set a keyframe. And then I'm going to come to the very beginning
and set a keyframe at 0. And one last touch, I'm going to highlight both of
these and hit F9 to create Easy Ease keyframes. So Star 01 is located right here,
and if I RAM Preview the scene, you'll see it fade in and start to flicker.

So that's a pretty cool, simple animation. I'm going to take this a step further
and add a Slider Control to the Start layer. And I'm going to set this to 10. And I'm going to click into the expression
we just wrote, and remove 5 for the frequency. And I'm going to drag the Pick Whip
up to the Slider Control. So now if you click away from the expression, you'll notice that the frequency
of flickering has changed. So this is a pretty simple animation
and it's looking good. And I want to create a preset out of this. So to save this as an expression preset,
I'm not only going to have to select the Opacity with the expression applied, I'm also going
to need the Slider Control because the Opacity relies on that effect.

So, to do that, I'm going to come to Star
01 on the Timeline, twirl down Effects, Slider Control, and Ctrl + Click
(or Cmd + Click on a Mac) on the Slider effect. Now this is going to select both properties
and it's ready to create a preset. Now let's say I didn't want the keyframes
included here, I can just Shift and lasso these to remove them from the selection,
but in this case I want them. Now on the After Effects top level menu,
I'm going to go to Animation, Save Animation Preset at the very top. Now this window is going to pop up and it's
asking me where I would like to save this preset. I want to make sure I am in
the User Presets folder.

Now the name that you give this file is going
to be the same name that shows up in Effects & Presets. So I'm going to call this file Fade & Wiggle. And then I'm going to come down
and hit Save. So now, the preset is successfully saved
and you can actually find it in the File Explorer by going to Documents, Adobe, After Effects and
the version you are in, and the User Presets folder.

And here you can see the
Fade & Wiggle preset that I just created. So you can copy this file to other computers,
just make sure those computers are running the same version of After Effects
you're in, or later. Now if you go back to After Effects
and go into Animation Presets, you don't even need to restart After Effects
for this to show up. So this is the preset we just created and
I want to use it to apply the same effect to Stars 02 through 12. Now I'm going to move forward
2 seconds in time so you can see how the preset
is applied to the other layers. So I'm going to hit T on the keyboard, just
so I can see the Opacity properties here. And then I'm going to come over to the
Effects & Presets window, and double click on the
Fade & Wiggle preset. Now immediately, you've seen
all of the Star layers go to 0 Opacity and they have all been given a Slider Control. So if I click into one, Star 02, it has a
Slider Control set to 10, just like our original. Now if I twirl down the Opacity, you'll see
the expression matches the one we created on the first layer.

And because our play head was at 2 seconds
instead of at the beginning, all of the keyframes started at 2 seconds. So I'm going to hit U on the keyboard
to collapse everything up. And now if you RAM Preview the scene,
you'll see the first Star come in, and then the other 11 Stars come in
and they are all twinkling. Pseudo Effects combine multiple sliders
and value controls. The benefits of using Pseudo Effects are their
clean and professional look, extra features that normal controls don't have,
and the ability to set default values.

These aren't expressions themselves, but they
make life easy when it comes to cleaning up a complex template and linking expressions
to a large number of controls. Keep in mind, Pseudo Effects have limited
compatibility in older versions of After Effects. Now, there are a couple of ways to create
Pseudo Effects for your project, let's take a look at the first way
to create them using an XML file.

To get started, locate the PresetEffects.xml
file inside of your After Effects directory. On Windows, this is going to be your C drive,
Program Files, Adobe, your version of After Effects, Support Files, and then scroll down the page
until you find the PresetEffects.xml. For Mac, this is going to require you to go to
Applications, your current After Effects version, and then right-click the After Effects app file,
select Show Package Contents, and then navigate to Contents, Resources,
and PresetEffects.xml. It's a pretty good idea to create a backup file of
this PresetEffects before you start modifying it. So I'm going to copy it
and then save it to another directory. Now that I've created a backup of this file,
I'm going to open it with a text editor. So I'm going to double click and it's going
to open in Sublime Text. Now this is a pretty big file that stores
lots of Pseudo Effect content for After Effects.

And I'm going to scroll down
to the very bottom of the page. If you're watching this tutorial online,
you'll find a link to copy and paste the example XML in the video description. If you've downloaded the project files, you
can find an example XML file in the Resources folder next to the project files. Once you've found the XML file, open it up
in the text editor of your choice. So this is the example file
and this is the Pseudo Effect. It starts with an Effect tag and includes
nested sliders, checkboxes, and other controllers that you might be familiar with.

And it includes a new feature, Pop Up,
that's only available in the Pseudo Effect. So first, you want to select the entire code
block including the indentation. And you want to copy this code. So I'm going to hit Ctrl + C (or Cmd + C on a Mac)
and then come over to the PresetEffects.xml file. So come to the end of the tag
and hit Enter to create a new line.

And I'm going to backspace to the beginning,
and then Paste the Pseudo Effect. Now inside of this, this is just an example block
with all of the possibilities that you can use. Feel free to duplicate things, you can have
more than one slider, more than one checkbox. You can rename them here,
and you can rename your controller here. You'll notice that each line represents a
control of a different type. So this is a Slider and then it's given a
name with some After Effects specific syntax. And then the actual Slider's name
is Custom Slider Name. So you can change this,
and then you can set a default value here.

Valid values are the absolute min or max
that a value can go. Nothing can exceed these values,
not even an expression. The Slider Min and Slider Max values
are the maximum amount of value that the Slider can manually slide. The precision property specifies how many
decimal places to show after the value. Now you'll also have properties like Checked,
false or true, you have default RGB values. A group can be named, and then inside of that group there can be other properties. Or you can create a 3D Point
with a default X, Y, and Z value.

Now there are some issues with compatibility
for the Point 3D so be careful when using that. You also have an Angle Control which is the same
as After Effects and can set a default Rotation. And finally, the new feature that XML allows,
is the Pop Up control. So this is very similar to a Layer Control
where you have a drop down menu, but the only difference with this
is you can set the custom options. So, it defaults to the first option, which is
going to be Choose An Option as the text. And then inside of the popup string, you can specify
the options separated with a pipe symbol. So, for example, Choose An Option is option 1,
Selection A will be Option 2, B option 3, C option 4, and so on.

Now the cool part about this is that if you
reference this with an expression, whenever a user chooses an option. So for example, if they choose Selection A,
that's going to output a number 2. So you can set conditional statements to say
if the Pop Up value is 2 do this action, if it's 3, do this action. So you'll notice I haven't modified anything
with this Pseudo Effect. But as-is, it's ready to go,
I don't have to change anything. I can change the names if I want to
but I'm just going to leave them for now. And now we'll look at
applying it in After Effects. So the next step is going to be
saving this document. So I'm going to close this out and I'm going
to leave this document open because we need the last line
of text for the next step.

Now, you'll have to close After Effects so
I'm going to do that now. And now we're back open with
a fresh copy of After Effects. So you've saved the XML file
and you have the controller ready to go, how do we actually get it into After Effects? Well the easiest way to do this is to run
a custom script from the editor in After Effects. So to access this, you want to go
to the top level File menu, and come all the way down
to Scripts, and Open Script Editor. Now clicking this launches the Script Editor,
and then it gives you a blank window. Now this is where that last line
comes into play. So I'm going to select this line and Ctrl + C
(or Cmd + C on a Mac) to copy, and then I'm going to open the Script Editor
and I'm going to paste into the window here.

Now mine is good to go because
I didn't rename my controller. But if you've renamed this in the XML, which
you'll see right here, YourCustomControl_v1. Make sure this matches this inside of
your PresetEffects.xml file. So mine is the same,
I'm going to leave it. And now, all you have to do is hit this little
green button to start running the script. Now I see here that the execution has finished,
and now I can go back to After Effects. So here's the custom Pseudo Effect,
and here's the group with more options. Now this Pseudo Effect is the
visual representation of this block of code. So if I come back over to After Effects,
this is a closer look at the popup. They can select any of these options. And whichever one they select, will output
that number. So this will output 1, 2, 3, 4, etc. There's one more thing I should note.

If you look closely at this script at the very end here
that actually applied our Pseudo Effect, it's grabbing the first layer in the
composition and then adding the property. Now if you were to run this exact same script
with this current composition, you would get an error because
the Camera cannot have an effect. So you would either need to move the Control
above the Camera, or change this to layer 2. That's how you create a custom control,
insert it into the PresetEffects.xml file, and import it into After Effects
using the script editor. The simpler and easier technique of creating a
Pseudo Effect is to use the Pseudo Effect Maker plugin, created by Batchframe Software
on AEScripts.com.

Once you install the plugin,
you can begin creating your Pseudo Effect without typing a single line of code. So, first things first, you want to
open the plugin by going to Window, Extensions, Pseudo Effect Maker. Once you click this, it's going to open in
a new window, you can dock it if you'd like. So this is your default Pseudo Effect. You have these clean controls here where you
can apply each of them to your Pseudo Effect, and you'll see them pop up right here.

Now we can create something like this
over here, so I could create a slider, and then put a checkbox underneath it,
and then I could create a color, and then a popup and a group. And then inside of this group,
it's currently empty. But I could drag something into it. So I could grab this checkmark,
drop it into the group. You can click into each of
these names and rename them.

So I could rename this Custom Group,
I could name this checkbox My Checkbox, and I could set a value over here
to something like 1. And this is a new feature that a normal checkbox
doesn't allow you to do. You can also select something like the popup here,
and right now there's a couple default options. But you can come over here and change them
just by creating new lines. So I could start with Option 1, enter,
Option 2, enter, Option 3. One last thing, I'm just going to rename this
My New Effect. So I'm happy with this effect, now I just
need to make sure the layer I want to apply it to is selected in the Timeline. So Control already has one, but it can accept
another. So I'm just going to highlight Control on
the Timeline and hit Apply. So it's translated this Pseudo Effect
and it gives us all of our options. And this is a completely useable Pseudo Effect. Now if you want to save this Pseudo Effect for
quick application, or if you want to edit it later, you can save it as an ffx file in
the same Presets folder.

So if I save this as
Pseudo Effect and hit Save. And so now, if you have a blank window here,
you can go to Open and you can select it right here. And it brings all of your options right where
they were. Another cool feature, you can come over here
and hit Copy XML and it's going to take this Pseudo Effect and translate it into XML code
like the code we had before. So if I navigate back to Sublime, and select
the existing Pseudo Effect and paste, it's now given us the new Pseudo Effect. It's also including a warning message here
telling you about incompatible effects. So this block of code has a checkbox label,
which is right here. And this label will not show up if you're
applying this through the PresetEffects.xml file, it only works with Pseudo Effect maker. So I'm going to undo this paste, and I'm going
to select our existing Pseudo Effect.

Now I'm going to copy it to the clipboard
and I'm going to go back to After Effects. And just like we copied a Pseudo Effect, we
can also paste in a Pseudo Effect from XML. So if I select this option, now we have our
original control from earlier. Now once a Pseudo Effect is created,
you can copy it to other layers. So I can select this Pseudo Effect, copy,
come down to Planet, and paste. And it will work fine. You can also move this to other project files,
other computers, and there's no need for the Pseudo Effect Maker plugin
to be installed on that machine.

This is a great tool for template makers and
give syour files a much more professional look. There's also a great video tutorial on the
product download page on AEScripts.com that walks you through the steps
to create these Pseudo Effects. The process of linking an expression to a
Pseudo Effect is identical to linking to an expression control. It just replaces Slider Control, Slider, with
Pseudo Effect, Pseudo Property in your expression.

So if you wanted to link the Planet's Scale
to the Pseudo Effect we created earlier, you can just add an expression to Scale
and then highlight Control so we can see the Pseudo Effect in the Effect Controls panel. And then grab the expression Pick Whip,
come up and drag it to Custom Slider Name. Now when you let go, it's going to create
a three dimensional array, and it's going to reference Your Custom Control name,
which is the effect up here, and then Custom Slider Name
which is the slider here. Now it's currently set to 0,
which is why the Scale is at 0. But I can bring this up to 100 and hit enter,
and now the Planet follows suit. So this slider is the same as a regular Slider Control,
it just has a little bit more customization. We've arrived at the end of Lesson 404: Creating Presets & Pseudo Effects
to Control Expressions.

If you enjoy this expressions course,
consider purchasing the paid content. It includes in-depth documentation,
extra tutorial content, high definition videos, and all the project files used in the training. Your purchase will help to create more
free courses like this in the future..

As found on YouTube

Posted in After EffectsTagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Post a Comment