Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/448.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用ExtendScript在After Effects中创建文本框?_Javascript_Adobe_Extendscript_After Effects - Fatal编程技术网

Javascript 如何使用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)

我正在尝试使用extendscript在after effects中创建一个文本框,就像使用文本工具并单击并拖动一个框时的文本框一样。我能找到的每一个资源都只展示了如何在文本周围创建一个实际的框,但我只想要文本框,这样当使用大字体时,文本就会被包装起来,并且不会超出构图的范围。以下是我目前掌握的情况:

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]