Created
February 23, 2020 15:55
-
-
Save srwild/d6b0da258454411856867327d404ac4d to your computer and use it in GitHub Desktop.
Script for creating guides in After Effects
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
var canvas = app.project.activeItem; | |
var height = canvas.height; | |
var width = canvas.width; | |
var canvasSize = [height, width]; | |
// Guide positions (in pixels) | |
var bleed = 20; // Off canvas | |
var margin = 40; // Inside margin | |
function makeGuides() { | |
// For each axis (horizontal then vertical) | |
for (var axis = 0; axis < canvasSize.length; axis++) { | |
// Guides from top to bottom then left to right | |
var guides = [ | |
-bleed, // top or left off canvas bleed | |
margin, // top or right margin | |
canvasSize[axis] / 2, // horizontal or vertical center | |
canvasSize[axis] + bleed, // bottom or right margin | |
canvasSize[axis] - margin // bottom or right off canvas bleed | |
]; | |
// Make a guide for each position in the list | |
for (var guide = 0; guide < guides.length; guide++) { | |
canvas.addGuide(axis, guides[guide]); | |
} | |
} | |
} | |
// Wrap in an Undo Group to allow undoing and redoing of guides | |
app.beginUndoGroup('Canvas Guides'); // Message to show for Undo and Redo | |
clearOutput(); | |
makeGuides(); // Make the guides | |
write('Enjoy your guides!'); // Confirmation message to show in Info Window | |
app.endUndoGroup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment