使用Free Transform
工具将图层旋转90度后......
如何使用jsx脚本找到此值?
答案 0 :(得分:11)
哦,我的好,我花了4个小时才找到它:(
function angleFromMatrix(yy, xy)
{
var toDegs = 180/Math.PI;
return Math.atan2(yy, xy) * toDegs - 90;
}
function getActiveLayerRotation()
{
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('textKey'))
if (desc.hasKey(stringIDToTypeID('transform')))
{
desc = desc.getObjectValue(stringIDToTypeID('transform'))
var yy = desc.getDouble(stringIDToTypeID('yy'));
var xy = desc.getDouble(stringIDToTypeID('xy'));
return angleFromMatrix(yy, xy);
}
return 0;
}