Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active April 12, 2018 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save animoplex/3ab618662331afe664334607a116de1b to your computer and use it in GitHub Desktop.
Save animoplex/3ab618662331afe664334607a116de1b to your computer and use it in GitHub Desktop.
Pixel Length Calculator - After Effects Expression by Animoplex
// Pixel Length Calculator - Created by Animoplex: www.animoplex.com
// Calculates the length (in pixels) of two positions or points in 2D or 3D space.
// USE FOR: Any property that needs a dynamic length calculated.
// Variation A
// Apply to camera's Focus Distance property
length(pointOfInterest, position)
// Variation B
// Link two layers to obj1 and obj2 for their length
obj1 = thisComp.layer("OBJECT 1 LAYER NAME").transform.position;
obj2 = thisComp.layer("OBJECT 2 LAYER NAME").transform.position;
length(obj1, obj2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment