The Problem: Laying out a logo grid

This should be easy, right? Just plop your logos in the arrangement you want, and tidy them up with the Align tools. The problem is that not all logos are the same aspect ratio: some are really short and wide, while others (more rarely) are taller than their width, so if you use Align / Distribute for this, the short wide ones will look nearer to each other than the tall skinny ones. There’s also the inevitable request from a client to shuffle logos around once they’ve been laid out, which – if you’ve spent time manually working out the exact gap you want between each logo and its neighbour – RUINS EVERYTHING. But all those problems can go away if you use some expressions.

Rationale, or: how does this work?

We want to end up with the same (easily-adjustable) horizontal gap between each logo and the one next to it. We also want this to be preserved if we decide to scale any of the logos up or down. Further to that, we need to be able to have an arbitrary number of logos on an arbitrary number of rows: this approach will work with two logos on one line, or 8 rows each with 20 logos in, if you want it to. As a bonus, we’re going to put in an expression on each logo’s Scale property which sizes it to a predetermined amount, so all the logos look the same size when they’re side by side.

Tutorial video: Laying the logo grid out

The Code: Position property

As well as the logos, you’ll need three other layers: a Null layer called “Move” with three slider controls on it called x-gap, y-start and y-gap (see pic below), and two adjustment layers, one called __START__ and one called __END__, between which you put the logos you want to lay out.

Logo grid - Move layer controlsAlt-click (Windows) or Cmd-click (Mac) on the keyframe stopwatch next to Position to paste this in.

This expression needs to go in the Position property for each layer you want to include in the grid.

Tutorial video: Scaling the layers to the same size, visually

The Code: Scale property

Building on that, we can add two extra slider controls to the Move layer, like this:

Logo grid - Scale controls
The first one is a simple checkbox which lets us switch between the two different methods of resizing that we’re using: either sizing each logo so it fits in the bounding box of the Move layer, or making them all the same area (given by the Area slider). If you’re using the bounding box method, I find it’s useful to move the anchor point to the middle of the Null layer (50, 50).

Update: rather than using a separate slider to control areas, it probably makes just as much sense (and is more intuitive) to use the area of the control null as well. So Line 8 has changed to reflect this.

I’m indebted to Dan Ebberts, whose Motionscript site is a brilliant resource for learning pretty much anything you need to know about After Effects expressions.

0118 324 3500