/*
written for this stackoverflow question
http://stackoverflow.com/questions/24115505/after-effects-composition-start-time-on-timeline/24117772#24117772
*/
function fun() {
app.beginUndoGroup('XXX');
var curComp = app.project.activeItem;
if (!curComp || !(curComp instanceof CompItem)) {
alert('选个合成行不行');
return;
}
selLayers = curComp.selectedLayers
if(selLayers.length < 3) {
alert('多选点图层行不行');
return;
}
for (var i = 1; i < selLayers.length; i++) {
selLayers[i].startTime = selLayers[i-1].outPoint - (selLayers[i].inPoint - selLayers[i].startTime);
}
app.endUndoGroup();
}
fun();