Skip to content

Instantly share code, notes, and snippets.

@ff6347
Forked from seblavoie/demo_movie-countdown.jsx
Created November 28, 2012 09:31
Show Gist options
  • Save ff6347/4160147 to your computer and use it in GitHub Desktop.
Save ff6347/4160147 to your computer and use it in GitHub Desktop.
AeTuts+ movie countdown script
{
app.beginUndoGroup("Demo Script");
// Creating project
var currentProject = (app.project) ? app.project : app.newProject();
// Creating comp
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();
// Creating background layer
var backgroundLayer = currentComp.layers.addSolid([93, 5, 2], "Background", cs[0], cs[1], cs[2]);
// Adding the grid effect
backgroundLayer.Effects.addProperty("ADBE Grid");
backgroundLayer.property("ADBE Effect Parade").property("ADBE Grid").property("ADBE Grid-0001").setValue([0,0]);
backgroundLayer.property("ADBE Effect Parade").property("ADBE Grid").property("ADBE Grid-0003").expression = "[width/2, height/2]";
backgroundLayer.property("ADBE Effect Parade").property("ADBE Grid").property("ADBE Grid-0012").setValue([0,0,0]);
backgroundLayer.property("ADBE Effect Parade").property("ADBE Grid").property("ADBE Grid-0014").setValue(2);
// Creating the wipe layer
var wipeLayer = currentComp.layers.addSolid([0.1, 0.1, 0.1], "Wipe", cs[0], cs[1], cs[2]);
// Adding the wipe property
wipeLayer.Effects.addProperty("ADBE Radial Wipe");
// Setting wipe property to counterclockwise
wipeLayer.property("ADBE Effect Parade").property("ADBE Radial Wipe").property("ADBE Radial Wipe-0004").setValue(2);
// Lowering the opacity
wipeLayer.transform.opacity.setValue(50);
// Setting wipe transition completion animation
wipeLayer.property("ADBE Effect Parade").property("ADBE Radial Wipe").property("ADBE Radial Wipe-0001").setValueAtTime(0, 100);
wipeLayer.property("ADBE Effect Parade").property("ADBE Radial Wipe").property("ADBE Radial Wipe-0001").setValueAtTime(1, 0);
wipeLayer.property("ADBE Effect Parade").property("ADBE Radial Wipe").property("ADBE Radial Wipe-0001").expression = "loopOut(\"Cycle\")";
// Adding text layer
var textLayer = currentComp.layers.addText("Countdown");
var textProperty = textLayer.text.sourceText;
var textPropertyValue = textProperty.value;
// Changing source text settings
textPropertyValue.resetCharStyle();
textPropertyValue.fontSize = 200;
textPropertyValue.fillColor = [0, 0, 0];
textPropertyValue.justification = ParagraphJustification.CENTER_JUSTIFY;
textProperty.setValue(textPropertyValue);
// Adding expression to source text
textProperty.expression = "Math.floor(10-time)";
// Adjusting text layer anchor point
var textLayerHeight = textLayer.sourceRectAtTime(0, false);
textLayer.transform.anchorPoint.setValue([0, textLayerHeight.height / 2 * -1]);
// 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
create_ellipse(shapeGroup, 200);
create_ellipse(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 create_ellipse(shapeGroup, size) {
var ellipse = shapeGroup.property("Contents").addProperty("ADBE Vector Shape - Ellipse");
var ellipseSize = ellipse.property("Size").setValue([size,size]);
}
app.endUndoGroup();
}
@ff6347
Copy link
Author

ff6347 commented Nov 28, 2012

@seblavoie Your script works only in english. Have a look at this https://gist.github.com/4160147 Cheers :F

@seblavoie
Copy link

@fabiantheblind Thanks a lot! I haven’t tested in other languages and I’m a little disappointed by how verbose it gets when supporting all languages, but I’ll have to deal with it in the future I guess ;)

@ff6347
Copy link
Author

ff6347 commented Dec 3, 2012

@seblavoie gists dont send notifications. I took this conversation over to twitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment