Posterous
Patrick is using Posterous to post everything online. Shouldn't you?
Gondry_head-2_thumb
 

I have a blog.

Pictures, links and other stuff that you put on blogs.

Stupid Vector Shapes and Stupid Anchor Points

Warning: major After Effects nerd-talk ahead.

When you need to be pixel-precise in your After Effects animations, being able to give a shape exact dimensions is a huge plus. You could create a solid with specific dimensions, but what if you need to animate width and height over time? You could mask it, but masks are imprecise.

After Effects' shape layers allow you to animate specific heights and widths over time. The downside: doing it is a huge pain in the ass. Go create a shape layer and play with the object's size. It always scales from the center, no matter where you put the anchor point. What if you're making a site demo video where a menu drops town from the top? You'd have to keyframe the position and size to keep it from moving all over the place. Add any sort of easing to it and those two might not match up. Pain. In. The. Ass.

By adding a few expressions to your shapes, you can make After Effects recognize your anchor point, allowing you to scale up, down, left or right. And you'll be able to control it with just one keyframe.

Here's what it'll do:

If you want to skip all the explanations, click the link at the bottom of this post to download the project files.

To get started, create a new shape layer in your composition. If you dig into the shape's transform properties, they may already have position values, and they also might be on half pixels. Take them both down to zero, close the shape transform properties, and never open it again.

The first expression you need to add will be used for all four anchor points, so don't screw it up ya' dummy! Go into your shape's path properties, alt-click on "Position" and pick-whip it to the shape's "Size" value. Then just type '/2' to divide that number in half. Basically you're telling After Effects to position the shape one-half the width and height you specified in the "Size" attribute. This will move that stupid anchor point to the top left corner.

Moving it to the other corners is a little harder. In addition to the last step, you'll have to put an expression in the layer's transform properties. (Not the shape's transform properties. You closed that, remember?) To move the anchor point to the top right, alt-click the stopwatch next to "Anchor Point." We need to adjust only the width this time. After Effects reads multiple values in an expression when they're placed inside [brackets]. So type left bracket, then pick-whip the width value on your shape size attribute (it'll be the first one), then type 0 for no difference in height, then close it off with a right bracket.

To move it to the bottom-left, do the opposite. In the anchor point expression, type right bracket, 0 for no change in width, then pick-whip the height value in the shape size attribute, then a right bracket. And finally for the bottom right, simply pick-whip the anchor point to the size attribute. This will add both the height and width to the anchor point.

Your expressions should look something like this now:

Hope that was helpful. If you have a better way of doing it please let me know.

Download the project files here.

Filed under  //   tutorial  
Posted January 6, 2010
// 0 Comments