Javascript 如何使用ExtendScript在After Effects中创建文本框?
我正在尝试使用extendscript在after effects中创建一个文本框,就像使用文本工具并单击并拖动一个框时的文本框一样。我能找到的每一个资源都只展示了如何在文本周围创建一个实际的框,但我只想要文本框,这样当使用大字体时,文本就会被包装起来,并且不会超出构图的范围。以下是我目前掌握的情况:Javascript 如何使用ExtendScript在After Effects中创建文本框?,javascript,adobe,extendscript,after-effects,Javascript,Adobe,Extendscript,After Effects,我正在尝试使用extendscript在after effects中创建一个文本框,就像使用文本工具并单击并拖动一个框时的文本框一样。我能找到的每一个资源都只展示了如何在文本周围创建一个实际的框,但我只想要文本框,这样当使用大字体时,文本就会被包装起来,并且不会超出构图的范围。以下是我目前掌握的情况: function createText(text, startTime, endTime, font) { var textLayer = newComp.layers.addText(text)
function createText(text, startTime, endTime, font)
{
var textLayer = newComp.layers.addText(text);
var sourceText = textLayer.property("Source Text").value;
sourceText.fontSize = 200;
sourceText.font = font;
textLayer.property("Source Text").setValue(sourceText);
textLayer.startTime = startTime;
textLayer.inPoint = startTime;
textLayer.outPoint = endTime;
var textRect = textLayer.sourceRectAtTime(0,false);
textLayer.property("Position").setValue([newComp.width/2,newComp.height/2]);
textLayer.property("Scale").setValue([100,100]);
}
我正在尝试创建的文本框类型:
要创建段落(框)文本层,请使用addBoxText()
方法,而不是addText()
。这将采用指定文本框大小的参数[width,height]