Currently I give away all my motion scripts for free. If you've found them useful and would like to support future development, you can do so here → To get updates on future ones, follow me on LinkedIn →
How to use the script
Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.
Option 1: Install to your AE Folder
Download this and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.
Option 2: Adapt the script yourself
Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.
Crosshair.jsx2.8KB
{
// Access current composition
var comp = app.project.activeItem;
if (comp && (comp instanceof CompItem)) {
app.beginUndoGroup("Create Guide Layer");
// Create a new shape layer
var shapeLayer = comp.layers.addShape();
shapeLayer.name = "Center Guide";
// Set layer as guide layer
shapeLayer.guideLayer = true;
// Vertical Line
var verticalLineGroup = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
verticalLineGroup.name = "Vertical Line";
var verticalPath = verticalLineGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Group");
var verticalPathData = verticalPath.property("ADBE Vector Shape").value;
verticalPathData.vertices = [[comp.width / 2, 0], [comp.width / 2, comp.height]];
verticalPath.property("ADBE Vector Shape").setValue(verticalPathData);
var verticalStroke = verticalLineGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
verticalStroke.property("ADBE Vector Stroke Color").setValue([1, 1, 1]);
verticalStroke.property("ADBE Vector Stroke Width").setValue(2);
// Horizontal Line
var horizontalLineGroup = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Group");
horizontalLineGroup.name = "Horizontal Line";
var horizontalPath = horizontalLineGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Group");
var horizontalPathData = horizontalPath.property("ADBE Vector Shape").value;
horizontalPathData.vertices = [[0, comp.height / 2], [comp.width, comp.height / 2]];
horizontalPath.property("ADBE Vector Shape").setValue(horizontalPathData);
var horizontalStroke = horizontalLineGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
horizontalStroke.property("ADBE Vector Stroke Color").setValue([1, 1, 1]);
horizontalStroke.property("ADBE Vector Stroke Width").setValue(2);
// Slider Control for opacity
var sliderControl = shapeLayer.property("ADBE Effect Parade").addProperty("ADBE Slider Control");
sliderControl.name = "Opacity Control";
sliderControl.property("Slider").setValue(100);
var opacityProperty = shapeLayer.property("ADBE Transform Group").property("ADBE Opacity");
opacityProperty.expression = 'effect("Opacity Control")("Slider")';
// Set anchor point to center of layer
var x_center = comp.width / 2;
var y_center = comp.height / 2;
shapeLayer.property("ADBE Transform Group").property("ADBE Anchor Point").setValue([x_center, y_center]);
// Set layer position to center of composition
shapeLayer.property("ADBE Transform Group").property("ADBE Position").setValue([x_center, y_center]);
app.endUndoGroup();
} else {
alert("No active composition.");
}
}