我有三个组合(compFinal
、compSlide1
和 compSlide2
)。
我已经使用脚本将 compSlide1
和 compSlide2
添加到 compFinal
组合中。
我使用以下代码添加组合:
compFinal.layers.add(compSlide1);
compFinal.layers.add(compSlide2);
但是当将它们插入 compFinal
时,compSlide1
和 compSlide2
将具有相同的开始时间“0”。
添加合成 compSlide2
时我想要它,以便我可以将合成 2 显示的开始时间设置为等于 compSlide1
的结束时间
最佳答案
这部分取决于图层的复杂性,但您可以使用当前图层的 startTime
属性结合 outPoint
来调整图层以相互跟随.
一个简单的循环可以在这方面提供帮助,在添加所有层后运行(按顺序):
// initial time (in seconds)
var time = 0;
// loop through all layers in comp
for(var i = 1; i <= finalComp.layers.length; i++) {
// set layer startTime based on current time value
finalComp.layers[i].startTime = time;
// update time to hold outPoint time of this layer
// which will next layer's start time
time = finalComp.layers[i].outPoint;
}
如果你只有两层,只需将第二层设置为从上一层的出点开始:
finalComp.layers[2].startTime = finalComp.layers[1].outPoint;
关于javascript - After Effects 脚本 : How to add Composition with start time display to an Composition,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46424789/