Last active
January 19, 2022 05:59
-
-
Save zlovatt/7c74c7d7ecd5496ce2192236fdd0ec66 to your computer and use it in GitHub Desktop.
Extendscript: Get After Effects Camera Data
This file contains hidden or 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
// Figuring out some math to determine aov, filmSize and focalLength in an AE camera, as these values aren't script-accessible. | |
// Assuming units are pixels, film size measuring horizontally | |
var comp = app.project.activeItem; | |
var camera = your camera layer; | |
var compSize = comp.width; | |
var cameraZoom = camera.zoom; | |
var depthOfField = camera.depthOfField; | |
var focusDistance = camera.focusDistance; | |
var aov = 2 * Math.atan(compSize / (2 * cameraZoom)); | |
// given focalLength, get filmSize: | |
var filmSize = 2 * focalLength * Math.tan(aov / 2); | |
// OR: given filmSize, get focalLength: | |
var focalLength = cameraZoom * filmSize / compSize; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment