Categories
After Effects

The Infallible Scale Expression

So, you are doing one of those projects with lots and lots of pictures. Some are 400×300 and some seem to be monstrous. Wouldn’t be nice if we could simply say “scale this stupid picture to the size of my comp, regardless of the size of my picture, comp resolution, picture composition or pixel aspect ratio.” Well, we can do that, but we have to say it differently. We have to say it like this:

w = thisLayer.width;
h = thisLayer.height;

compW = thisComp.width;

compH = thisComp.height;

p = thisComp.pixelAspect;

if ( w > h ){ //test if image is taller than wide

s = (compW / w ) * 100;

[ s * p, s ]

}else{

s = (compH / h ) * 100;

[ s , s ]

}

Let’s break this apart. First we have a simple if/else conditional statement. If w > h.. or if the width is less than the height.. do one computation, else do another. What this does is qualify our image as being vertically or horizontally composed.

Let’s say it is horizontal. From here we need to figure out the scale to get the width of the picture to match the width of the comp. Think way back to Algebra 1… you probably did one of these things:
This is exactly what we are doing here. Let’s say our compostion is 1,024 pixels wide and our picture is 800 pixels wide. If we say that the relationship between these two widths could be simplified to be expressed as a relationship of some number to 100, we’d have our scale factor, X (because AE scale is quantified as a 0 – 100 value) . Granted, in my expression.. I use “s” as the variable. I just used “X” for the High School nostalgia factor.

So, if we creatively flip this around using yet more Algebra, we get:

All we are really doing here is multiplying both sides by 100. In the expression, we see:

s = (compW / w ) * 100;

That’s all that is. And it’s the same for both width and height. Beyond that, for the width we need to multiply the pixel aspect as our Algebra is not aware of pixel aspect ratio. P is using the expression for the current comp pixel aspect.

As a simpler alternative, you could simply use the following section, to fill the screen with the image and not worry about composition.

h = thisLayer.height;
compH = thisComp.height;
s = (compH / h ) * 100;

[ s , s ]

As a part II of this coming soon, we’ll examine how to use this expression, but include a “camera zoom and pan” animation. This is part of a massive Preset I am working on that greatly simplifies doing “slideshow animations”. It will truly rock once I get the code tweaked. Check back!

Categories
After Effects

Animating Radar Screen

When dorks like me start experimenting with effects and expressions… they come up with something like this.

It starts innocent enough. “How can I use the Polar Coordinates effect to make a radar sweep?”. Then, I start drawing in Illustrator to add some elements. Then I add some text elements using expressions. At this point, I am fully qualified as a nerd as I keep tweaking, adding waveforms, even text that uses trig functions.

What we end up with is a looping RADAR screen. I’ve also added some mysterious object approaching with a tracker object attached and some misc. text driven by X position. and its visibility coming and going with the sweep.

DOWNLOAD THE PROJECT FILES HERE

Categories
After Effects Preset

Shapes: No Symbol

The universal symbol for ‘No’ is just a circle with a diagonal line running through it from the upper left to the lower right. You put this over anything that is not permitted… like ‘No Smoking’ or ‘No Entry’.

This shape should be applied to any color of full screen layer. It will automatically fill with red, bevel the alpha and add a drop shadow. Scale as needed.

Download the ‘No’ Symbol’ FFX file (zipped).

To install: Drop it into your Presets folder in your Adobe After Effects application folder. Refresh your Effects and Presets list if needed, by choosing ‘Refresh List’ in the flyout menu on the Effects and Presets palette.

Categories
After Effects

Particular Preset: Fuzzy Flower

Fuzzy FlowerUsing Trapcode Particular and a Beveled stroke created with Write-On, I created this pretty, pretty flower.

Adjust the Aux System Velocity to give it more “fuzz”. Color is also defined in Aux System “Color Over Life”.

Using Trapcode Particular and a Beveled stroke created with Write-On, I created this pretty, pretty flower.

Adjust the Aux System Velocity to give it more “fuzz”. Color is also defined in Aux System “Color Over Life”.

Download the Project Here!

If you don’t have the plug-in, download a demo of it from the Toolfarm Demo page.