
Mabe there is another way and I don't know about it yet? Thanks for your time!
Moderator: byronnash
Code: Select all
//TextBackgroundBoxCreator
//©2008 Lloyd Alvarez http://aescripts.com
//
//to run this script, set your text on one text layer, switching the text using keyframes on the Source Text property.
//create a solid that is 1000x1000 with square pixel PAR, position it below the text layer and select both the text
// layer and the solid before running the script.
//
//
var error = "To run this script you must select both a 1000x1000 pixel solid and a text layer above it";
var myComp = app.project.activeItem;
var theLayer = myComp.selectedLayers;
if (theLayer.length != 2) {alert(error)}
else
{
var myWorkAreaInFrames = myComp.workAreaDuration * myComp.frameRate;
var myWorkAreaStartInFrames = myComp.workAreaStart * myComp.frameRate;
for (i=1; i < myWorkAreaInFrames; i++) {
var myTime= ((myWorkAreaStartInFrames-1) + i) / myComp.frameRate;
var boundsObject = theLayer[0].sourceRectAtTime(myTime, true);
//alert(boundsObject.width);
var myWidth = (boundsObject.width/10);
var myHeight = (boundsObject.height/10);
theLayer[1].anchorPoint.setValue([0,0]);
theLayer[1].scale.setValueAtTime(myTime,[myWidth,myHeight]);
writeLn("Processing frame " + i + " out of " + Math.round(myWorkAreaInFrames)); //write the progress to the info window
clearOutput(); //clear the line after it's written
}//close for loop
}