scripted pan & tilt camera movement

Scripting for After Effects

scripted pan & tilt camera movement

Postby derherrkohler on 12/10/2014, 1:24 am

Hey guys,
I am looking for a solution for my problem:

1) Camera pans from left (variable start angle) to right (variable end angle) and repeats.
2) After every complete "row", the Camera tilts (from 'start' to 'end' angles - maybe entered by sliders.
3) A nice addon would be a way to give the angle of each step...

1) I archived this by simple put the camera into the start direction, set a keyframe, move 40 frames forward, set the end-angle of the camera, use expression loopOut()
2) at the moment I use keyframes - set by hand... not so nice... :-(
3) I have no idea....

Maybe someone can help me with this one,
or point me in the right direction.
thank you very much!
Posts: 1
Joined: 10/9/2011, 11:32 am

Re: scripted pan & tilt camera movement

Postby dconklin on 12/10/2014, 11:09 am

Paste this expression onto the X and Y rotation values of your camera (the same expression on both).

There are 4 variables in the script you can use to change the animation (you could hook these up to sliders if you want).

loopTime – the amount of time (in seconds) it takes to go through each row.
startPan - the rotation (in degrees) that each camera pan starts at.
endPan - the rotation (in degrees) that each camera pan ends at.
tiltAmt - the amount to increase the X rotation of the camera by (in degrees) after each loop.

Good luck!

Code: Select all
var loopTime = 2; //seconds

//pan amounts
var startPan = -30; //degrees
var endPan = 30; //degrees

//tilt amount
var tiltAmt = 10; //degrees

//find how many animations we've done.
var loopCount = Math.floor(time / loopTime);


var panAnim = ease(time, loopCount, loopCount + loopTime, startPan, endPan);
var tiltAnim = value + (loopCount * tiltAmt);

if("Y") != -1){
} else if ("X") != -1){
} else {
Posts: 19
Joined: 03/23/2011, 6:24 am

Return to After Effects Expressions