Created
September 21, 2013 01:04
-
-
Save benwurth/6645945 to your computer and use it in GitHub Desktop.
A simple After Effects script that creates a 3D camera, creates a null objects for the dolly, parents the camera to the dolly, and adds a wiggle expression to the null object. I wrote this when I was working on some projects that required me to do this every time I made a new comp. You can tell I was tired when I came up with the name.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
//Begins the undo group. | |
app.beginUndoGroup("Add Camera and Dolly"); | |
//Creates a variable that holds the selected comp | |
var curItem = app.project.activeItem; | |
//Makes sure that there is an active comp | |
if (curItem === null || !(curItem instanceof CompItem)) | |
{ | |
alert ("Please establish a comp as the active item and run the script again."); | |
} | |
else | |
{ | |
//Getting the middle of the comp | |
var compWidthMiddle = curItem.width / 2; | |
var compHeightMiddle = curItem.height / 2; | |
//Creating the camera | |
var newCamera = curItem.layers.addCamera("3d camera 001",[compWidthMiddle,compHeightMiddle]); | |
//Positioning the camera properly | |
newCamera.property("position").setValue([compWidthMiddle,compHeightMiddle,-995.6]); | |
newCamera.property("zoom").setValue(995.6); | |
//Creating new null object | |
var newDolly = curItem.layers.addNull(curItem.duration); | |
//Add wiggle expression to null | |
var wiggleExp = "seedRandom(time*.2); wiggle(1,5); //1=frequency 5=magnitude"; | |
newDolly.property("position").expression = wiggleExp; | |
//Set the Null as the parent of the Camera | |
newCamera.parent = newDolly; | |
} | |
app.endUndoGroup(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment