Activity › Forums › Adobe After Effects Expressions › Adobe after effects scripting
-
ayat fatima
November 7, 2020 at 6:56 amIt is still giving error of “undefined is not an object” at second line..☹
-
ayat fatima
November 7, 2020 at 1:16 pmvar currentProject = (app.project) ? app.project: app.newProject();
var compSettings = cs = [1280, 720, 1, 10, 24];
var defaultCompName = “Demo”;
var currentComp = (currentProject.activeItem) ? currentProject.activeItem: currentProject.items.addComp(defaultCompName, cs[0], cs[1], cs[2], cs[3], cs[4]);
currentComp.openInViewer();
var backgroundLayer1 = currentComp.layers.addSolid([93, 5, 2], “Background”, cs[0], cs[1], cs[2]);var mytextLayer = currentComp.layers.addText(“Bubble Sort\nSimple sorting algorithm\nComparison-based algorithm\nComparison of adajacen elements\nSwapped if they are in wrong order\nNo swapping if the order is true”);
var textProperty = mytextLayer.property(“Source Text”);
var textPropertyValue = textProperty.value;textPropertyValue.resetCharStyle();
textPropertyValue.fontSize = 50;
textPropertyValue.fillColor = [1, 0, 0];
textPropertyValue.justification = ParagraphJustification.CENTER_JUSTIFY;
textProperty.setValue(textPropertyValue);app.endUndoGroup();
above code is working… But I’m unable to create more layers working at specified time or writing text letter by letter.
can you please tell me that how is it possible in the above syntax.
-
Brendon Murphy
November 7, 2020 at 7:48 pmThe script I gave you will only work if there is already an active composition with a layer inside.
To answer your other question, you could add this line to your code to add a new text element and set the inPoint to 1 sec:
currentComp.layers.addText("New Text").inPoint = 1;Also, app.endUndoGroup(); should come at the very end, but only if you’ve done this at the beginning:
app.beginUndoGroup("Name of your undo here."); -
ayat fatima
November 10, 2020 at 7:46 amHHow can I set the position of a shape in shape layer… And how is it possible to combine more than one comps in the main comp
-
ayat fatima
November 12, 2020 at 10:42 am// Adding shape layer for the circles
var shapeLayer = currentComp.layers.addShape();
// Adding circle shapes group
var shapeGroup = shapeLayer.property(“Contents”).addProperty(“ADBE Vector Group”);
// Adding circle shapes
createEllipse(shapeGroup, 200);
createEllipse(shapeGroup, 400);
// Adding black stroke to the shapes
var stroke = shapeGroup.property(“Contents”)
.addProperty(“ADBE Vector Graphic – Stroke”)
.property(“Color”).setValue([0, 0, 0]);
function createEllipse(shapeGroup, size) {
var ellipse = shapeGroup.property(“Contents”).addProperty(“ADBE Vector Shape – Ellipse”);
var ellipseSize = ellipse.property(“Size”).setValue([size,size]);
}
Reply to this Discussion! Login or Sign Up