After Effects│コンポの長さに対してレイヤーを均等に配置するスクリプト

レイヤーをコンポの長さに合わせて均等に配置したい

コンポの長さに対してレイヤーを均等に配置したかったのでやってみました。

目次

選択したレイヤーをコンポの長さに対して均等に配置するスクリプト

function DurationDivide(){
    app.beginUndoGroup("DurationDivide");
    var thisComp = app.project.activeItem;
    var selectedLayers = app.project.activeItem.selectedLayers;
    var layerDuration = thisComp.workAreaDuration / selectedLayers.length;
for(var i = 0; i < selectedLayers.length; i++){
    currentLayer = selectedLayers[i];
    currentLayerDuration = Math.abs(currentLayer.outPoint - currentLayer.inPoint);
    inPoint = i*layerDuration+thisComp.workAreaStart;
    outPoint = inPoint+layerDuration;
    currentLayer.startTime = inPoint;
    currentLayer.outPoint = outPoint;
 }
app.endUndoGroup();
}
DurationDivide();

並びを逆にしたい場合

下記のように変更します。

currentLayer.startTime = outPoint;
currentLayer.outPoint = inPoint;

おまけ

Twitterで知ったのですが、こちらのスクリプトも便利そうです。

“OneTwoTrim”というスクリプトで、レイヤーを複数選択して実行すると、最初に選んだレイヤーの長さに揃えてくれます。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次