2017-01-08 3 views
0

誰でも助けてくれますか? 私はExtendscriptを使ってアフター・エフェクトCC用のスクリプトを書こうとしています。 javascriptを使って合成のレイヤーの継続時間を変更したい。 私はここにアフター・エフェクトのjavascriptによる合成のレイヤーの長さの変更

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

関連する問題