よろよろ帳

InDesign JavaScript 勉強中

立体ぽく

長方形をなんとなく立体にします。選択元はスウォッチ濃度50%で押し出し分は80%と100%です。
丸とか他の形も何かに使えるかもしれません。

app.doScript (main, ScriptLanguage.JAVASCRIPT, [], UndoModes.FAST_ENTIRE_SCRIPT);
function main (){
    var sel=app.activeDocument.selection;
    var D=5;//深さサイズ
for(i=0;i<sel.length;i++){
    var GB=sel[i].geometricBounds;
    var Rsel=sel[i].duplicate();
    Rsel.fillTint=80;
    Rsel.geometricBounds=[GB[0],GB[3],GB[2],GB[3]+D];
    var myMatrix =app.transformationMatrices.add({counterclockwiseRotationAngle:90});
    Rsel.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.TOP_LEFT_ANCHOR, myMatrix);
    var myMatrix =app.transformationMatrices.add({clockwiseShearAngle:45});
    Rsel.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.TOP_LEFT_ANCHOR, myMatrix);
    var myMatrix =app.transformationMatrices.add({counterclockwiseRotationAngle:-90});
    Rsel.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.TOP_LEFT_ANCHOR, myMatrix);

    var Bsel=sel[i].duplicate();
    Bsel.fillTint=100;
    Bsel.geometricBounds=[GB[2],GB[1],GB[2]+D,GB[3]];
    var myMatrix =app.transformationMatrices.add({clockwiseShearAngle:-45});
    Bsel.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.TOP_LEFT_ANCHOR, myMatrix);
    
    app.activeDocument.groups.add([sel[i],Rsel,Bsel]);//グループ化
    }
}