在after effects中通过javascript更改合成层的持续时间
有人能帮我吗? 我正在尝试使用Extendscript为after effects CC编写脚本。 我希望通过javascript更改合成层的持续时间。 我在这里写了这段代码 附件项目第(1)项。第(1)层。长度=12 或 app.project.item(1).层(1).持续时间=12 但它不起作用。 我怎么做?在after effects中通过javascript更改合成层的持续时间,javascript,scripting,extendscript,after-effects,Javascript,Scripting,Extendscript,After Effects,有人能帮我吗? 我正在尝试使用Extendscript为after effects CC编写脚本。 我希望通过javascript更改合成层的持续时间。 我在这里写了这段代码 附件项目第(1)项。第(1)层。长度=12 或 app.project.item(1).层(1).持续时间=12 但它不起作用。 我怎么做? 谢谢。事情没那么容易。像实体这样的层没有可以设置的持续时间。但是您可以设置它们的输入点和输出点。其他层(如comp)需要在其源位置进行更改。请参阅下面的代码,了解如何执行此操作 fu
谢谢。事情没那么容易。像实体这样的层没有可以设置的持续时间。但是您可以设置它们的
输入点
和输出点
。其他层(如comp)需要在其源位置进行更改。请参阅下面的代码,了解如何执行此操作
function main(){
// do some checking if we have a comp and a layer selected
var curComp = app.project.activeItem;
if (!curComp || !(curComp instanceof CompItem)) {
// alert and end the script
alert("please select a composition and at least a layer");
return;
}
var durationValue = 1; // the desired value in seconds
var selectedLayer = curComp.selectedLayers[0];
// if the layer has source layers it is a comp
// so we change its source duration
// else
// we have layers like solids or lights. They have no source and no layers in them
// so we change their outPoint
if (selectedLayer.source.numLayers != null){
$.writeln('we have a comp');
selectedLayer.source.duration = durationValue;
} else {
$.writeln('we have a layer');
selectedLayer.outPoint = selectedLayer.inPoint + durationValue;
}
}
main();
非常感谢你。是的,我刚刚开始理解这个主题,我对材料的学习非常差,但我需要已经写好剧本。再次感谢你的帮助。