//为选中形状图层的变化属性添加表达式 v1.0.0 2021-07-09
//Raymond Yan 2021 (RaymondClr@outlook.com / QQ: 1107677019)

function addExpressionToSelectedShapeLayerTransformProperties(shapeLayerObj, expressionString) {
    var contents = shapeLayerObj.property('Contents');
    var shapeNum = contents.numProperties;

    for (var i = 1; i <= shapeNum; i++) {
        var vectorGroup = contents.property(i);
        var transformGroup = vectorGroup.property('ADBE Vector Transform Group');
        var anchorPoint = transformGroup.property('ADBE Vector Anchor');
        var position = transformGroup.property('ADBE Vector Position');
        var scale = transformGroup.property('ADBE Vector Scale');
        var skew = transformGroup.property('ADBE Vector Skew');
        var skewAxis = transformGroup.property('ADBE Vector Skew Axis');
        var rotation = transformGroup.property('ADBE Vector Rotation');
        var opacity = transformGroup.property('ADBE Vector Group Opacity');
        anchorPoint.expression = expressionString.anchorPoint;
        position.expression = expressionString.position;
        scale.expression = expressionString.scale;
        skew.expression = expressionString.skew;
        skewAxis.expression = expressionString.skewAxis;
        rotation.expression = expressionString.rotation;
        opacity.expression = expressionString.opacity;
    }
}

var selectedShapeLayer = (function () {
    var activeItem = app.project.activeItem;
    return activeItem && activeItem.selectedLayers.length > 0 && activeItem.selectedLayers[0];
})();

addExpressionToSelectedShapeLayerTransformProperties(selectedShapeLayer, {
    anchorPoint: '',
    position: 'value',
    scale: '',
    skew: 'value',
    skewAxis: '',
    rotation: 'value',
    opacity: '',
});

Leave a Reply

Your email address will not be published.

请下载到本地观看!因为pdf是用的阿里云盘预览,可能部分字体加载不了。

请安装油猴脚本,并下载月离的万事屋脚本

请在右上角三个点 - 下载管理 - 找到刚才的文件,选择允许下载。 或者换个浏览器
echo