| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A simple example that sets the sourceText property of a new layer each frame.
/**
* main function
*/
var main = function () {
var txt = ["Hello - World", "dog - cat", "foo - bah"]; // the text to add
app.beginUndoGroup("add source text"); // open a undo group
var curComp = app.project.activeItem; // get the current comp
// check if the curent active item is a comp
if (!curComp || !(curComp instanceof CompItem)) {
alert("noComp");
return;
// end if no comp is active
}
var txtLayer = curComp.layers.addText("titles"); // add a text layer
var counter = 0; // the time to add a keyframe to (in seconds)
// loop the text
for (var i = 0; i < txt.length; i++) {
var curFrame = counter / curComp.frameRate; // calc time for each frame
$.writeln(curFrame);
// add a keyframe with the text as value every frame
txtLayer.text.sourceText.setValueAtTime(curFrame, txt[i]);
counter++; // increase the time by one
}
app.endUndoGroup();
};
main();This wiki is mostly maintained by:
ff6347
Thanks to:
Thanks to the students from my seminars for asking all those questions and making me start this wiki.
You are awesome.
| Back | FazBrowse Home | New Git URL |