2017-01-08 8 views
0

아무도 도와 줄 수 있습니까? Extend 스크립트를 사용하여 After Effects CC 용 스크립트를 작성하려고합니다. 자바 스크립트로 컴포지션의 레이어 지속 시간을 변경하고 싶습니다. 여기에이 코드를 작성했습니다After Effects에서 자바 스크립트로 컴포지션의 레이어 지속 시간을 변경하십시오.

app.project.item (1) .layer (1) .length = 12;

또는

app.project.item (1) .layer (1) .duration = 12;

하지만 작동하지 않습니다. 어떻게 할 수 있습니까? 감사합니다. .

답변

1

테스트에 많은 노력을 기울인 것처럼 보이지 않습니다. 어쨌든. 여기에 해결책이 있습니다. 그 일은 쉽지 않습니다. 솔리드와 같은 레이어에는 설정할 수있는 기간이 없습니다. 하지만 inPointoutPoint을 설정할 수 있습니다. 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(); 
+0

대단히 감사합니다. 예, 방금이 주제를 이해하기 시작했고 자료를 너무 열심히 공부했지만, 이미 스크립트를 작성해야했습니다. 다시 도움 주셔서 감사합니다. –

+0

해결 된 것으로 표시해주세요. – fabianmoronzirfas