我可以更改文字颜色,但格式也在改变!我的一半文字是Bold,另一半是Italic。但最终所有文字都改为Bold。
var proj = app.project;
var theComposition = app.project.activeItem;
var theTextLayer = theComposition.layers[1];
var textProp1 = theTextLayer.property("Text").property("Source Text");
var textProp2 = theTextLayer.property("Source Text").value;
textProp2.fillColor = [1,1,1];
textProp1.setValue(textProp2);
答案 0 :(得分:1)
当您设置TextDocument
:textProp1.setValue(textProp2);
时,它会设置所有TextDocument
属性。
Adobe不支持通过Extendscript(e.x。:fillColor,fontSize,fontFamily等)在每个文本层中使用多种格式,因此该图层将获得第一个字母的属性,该字母在您的情况下为粗体。
我可以建议您在图层中添加填充效果并更改效果中的值。 这是一个代码:
var fillEffect = theTextLayer.property('ADBE Effect Parade').addProperty('ADBE Fill');
fillEffect.property('Color').setValue([1,1,1]);