Skip to content

Instantly share code, notes, and snippets.

@sc0rp10n-py
Created January 20, 2023 00:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sc0rp10n-py/beb582876fd39e9ec3f7f952c14d8d48 to your computer and use it in GitHub Desktop.
Loader animation ExtendScript After Effects
app.project.close(CloseOptions.DO_NOT_SAVE_CHANGES);
app.newProject();
app.beginUndoGroup("Create Comp");
/////////////////////////////
// settings
var width = 1920;
var height = 1080;
var duration = 10;
var frameRate = 25;
// colors
var bg = [0.25, 0.58, 0.213];
var arc = [0, 184, 255];
var circle = [0, 184, 255];
// text
var text = "Lejuota"
var fontName = "Times New Roman";
var fontSize = 72;
var textPos = [850, 550];
var fontColor = [0, 0.184, 0.255];
// arc size
var arcSize = [572, 572];
var arcWidth = 25;
var arcPos = [0, 0];
// circle size
var circleSize = [450, 450];
var circleWidth = 10;
var circlePos = [0, 0];
/////////////////////////////
var comp = app.project.items.addComp("Comp", width, height, 1, duration, frameRate);
// set comp color profile to rgb
comp.colorProfile = "RGB";
comp.openInViewer();
// make a solid layer with color
var layer = comp.layers.addSolid(bg, "Background", 1920, 1080, 1);
// add logo text
var textLayer = comp.layers.addText(text);
textLayer.position.setValue(textPos);
var textProp = textLayer.property("Source Text");
var textDocument = textProp.value;
textDocument.font = fontName;
textDocument.fontSize = fontSize;
textDocument.strokeColor = fontColor;
textDocument.strokeWidth = 2;
textDocument.applyStroke = true;
textDocument.text = text;
textProp.setValue(textDocument);
// MAKE OUTER ARC
// Create a new shape layer
var shapeLayer = comp.layers.addShape();
shapeLayer.enabled = true;
// Add an elliptical path to the shape layer
var arcPath = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Shape - Ellipse");
arcPath.property("ADBE Vector Ellipse Size").setValue(arcSize);
arcPath.property("ADBE Vector Ellipse Position").setValue(arcPos);
// Add a trim path to the shape layer
var trimPath = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Filter - Trim");
trimPath.property("ADBE Vector Trim Start").setValueAtTime(0, 0);
trimPath.property("ADBE Vector Trim Start").setValueAtTime(1.12, 0);
trimPath.property("ADBE Vector Trim Start").setValueAtTime(5.05, 100);
trimPath.property("ADBE Vector Trim End").setValueAtTime(0, 0);
trimPath.property("ADBE Vector Trim End").setValueAtTime(2.07, 0);
trimPath.property("ADBE Vector Trim End").setValueAtTime(6.06, 100);
// Add a stroke to the shape layer
var stroke = shapeLayer.property("ADBE Root Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
stroke.property("ADBE Vector Stroke Width").setValue(arcWidth);
stroke.property("ADBE Vector Stroke Color").setValue(arc);
// MAKE INNER CIRCLE
// Create a new shape layer
var shapeLayer2 = comp.layers.addShape();
shapeLayer2.enabled = true;
// Add an elliptical path (Circle A) to the shape layer
var circleA = shapeLayer2.property("ADBE Root Vectors Group").addProperty("ADBE Vector Shape - Ellipse");
circleA.property("ADBE Vector Ellipse Size").setValue(circleSize);
circleA.property("ADBE Vector Ellipse Position").setValue([0, 0]);
// Add a trim path to Circle A
var trimPathA = shapeLayer2.property("ADBE Root Vectors Group").addProperty("ADBE Vector Filter - Trim");
// Set the trim path start value to 0 (12 o'clock position)
trimPathA.property("ADBE Vector Trim Start").setValue(50);
trimPathA.property("ADBE Vector Trim End").setValue(100);
// Apply the expression to the start value
trimPathA.property("ADBE Vector Trim Start").expression = "linear(time,4.11,7.05,50,100)";
// Add a stroke to Circle A
var stroke2 = shapeLayer2.property("ADBE Root Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
stroke2.property("ADBE Vector Stroke Width").setValue(circleWidth);
stroke2.property("ADBE Vector Stroke Color").setValue(circle);
var shapeLayer3 = comp.layers.addShape();
shapeLayer3.enabled = true;
// Add an elliptical path (Circle A) to the shape layer
var circleB = shapeLayer3.property("ADBE Root Vectors Group").addProperty("ADBE Vector Shape - Ellipse");
circleB.property("ADBE Vector Ellipse Size").setValue(circleSize);
circleB.property("ADBE Vector Ellipse Position").setValue(circlePos);
// Add a trim path to Circle A
var trimPathB = shapeLayer3.property("ADBE Root Vectors Group").addProperty("ADBE Vector Filter - Trim");
// Set the trim path start value to 0 (12 o'clock position)
trimPathB.property("ADBE Vector Trim Start").setValue(0);
trimPathB.property("ADBE Vector Trim End").setValue(50);
// Apply the expression to the start value
trimPathB.property("ADBE Vector Trim Start").expression = "linear(time,7.05,10,0,50)";
// Add a stroke to Circle A
var stroke3 = shapeLayer3.property("ADBE Root Vectors Group").addProperty("ADBE Vector Graphic - Stroke");
stroke3.property("ADBE Vector Stroke Width").setValue(circleWidth);
stroke3.property("ADBE Vector Stroke Color").setValue(circle);
// Set the composition duration to 10 seconds
comp.duration = 10;
app.endUndoGroup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment