control the speed (velocity) of a camera (x,y,z)

Scripting for After Effects

control the speed (velocity) of a camera (x,y,z)

Postby Limitless on 04/13/2015, 5:28 am

Hi! I make my own camera rig.

I have with the "expression control" slider seperate x,y and z position. Now i wish control the velocity for each one to make very smooth composition.
Fo example begin 0 px/s to 10 000 px/s in 4 seconds an than, decrease 10 000 px/s to 0 in one second. It's important that it be very smooth. With the curve it's impossible because when i put an high value in velocity (20 000 for example), the curve goes in negative and the camera go back in the other sens.

I'm beginner in expression so one of you could help me?

Thanks :)
Posts: 1
Joined: 04/13/2015, 5:19 am

Re: control the speed (velocity) of a camera (x,y,z)

Postby star+circle on 04/27/2015, 10:06 am

Controlling a camera by velocity is somewhat tricky business, for you need to calculate the sum of the positions in each frame from the beginning of the composition (or the beginning of camera movement) to get the current position. It can be done, but the longer your composition, the longer the calculation takes.

The basic math and expressions can be found at the end of this thread:


In your case the "spd" (speed) variable would be your slider value for camera speed instead of audio amplitude. This also means that you need sliders for x, y and z camera speed (instead of position) to make this work. Then you can calculate the position of your camera with these expressions.
Posts: 729
Joined: 12/6/2014, 3:07 pm
Location: Finland

Return to After Effects Expressions