# After Effects Expressions

Currently Being Moderated

## Camera Zoom Expression

### Apr 11, 2012 10:44 AM

Hi All, I've been recently using a workflow I quite like to create hundreds or thousands of instances of a 3D object in AE, and I'd like to take some of the guesswork out of it with an expression for the camera.

Let me give you an example of the kind of shot I'm working on.

Imagine you're pushing in towards the window of an office building when it opens and out of it starts pouring hundreds of paper airplanes.  My workflow is to do the following once I've got the office building and the airplanes built in AE.  Design the camera move, with one airplane which follows a typical path.  Then use the perspective changes on that airplane to create a 2D "card" which can be fed to a particle system which replicates the move hundreds of times with minor variations.

What I'm trying to make:  a set of expressions to use with the camera for the purposes of creating the 2D card.   What it needs to do is point the camera at the object and control zoom.  Ultimately it needs to keep the object's  orientation and apparent size constant through the shot, so that the only change in the object that you see is the change in perspective.

I've been eyeballing this in the past and it works relatively well, but I think if I nailed it down I could have a really useful system for creating apparently 3D particles.   Thanks in advance for any help!

Replies
• Currently Being Moderated
Apr 11, 2012 1:31 PM   in reply to ElwoodDowd

Say your 3D object is called "target". It might be as simple as adding this to the camera's POI:

thisComp.layer("target").transform.position

and this to the Zoom:

p = thisComp.layer("target").transform.position;

length(p,transform.position);

It could get more complicated than that, depending on what you're doing exactly, but that's the basic idea.

Dan

|
Mark as:
• Currently Being Moderated
Apr 11, 2012 2:19 PM   in reply to ElwoodDowd

Try this:

L = thisComp.layer("target");

v = L.toCompVec([1,0,0]);

Dan

|
Mark as:
Actions

#### More Like This

• Retrieving data ...

#### Answers + Points = Status

• 10 points awarded for Correct Answers