Created
April 14, 2019 13:34
-
-
Save u27a4/9d2747396db9436f7086105fb939ab15 to your computer and use it in GitHub Desktop.
aescript; snap selected layers to the corner in composition.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function snap (x, y) | |
{ | |
var item = app.project.activeItem; | |
var layerIndicies = []; | |
for (var i = 0; i < item.selectedLayers.length; i++) | |
{ | |
layerIndicies.push(item.selectedLayers[i].index); | |
} | |
item.layers.precompose(layerIndicies, item.selectedLayers[0].name, true); | |
var precomposed = item.selectedLayers[0]; | |
precomposed.transform.scale.setValue([50, 50]); | |
precomposed.transform.anchorPoint.setValue([ | |
[[item.width, item.height,], [0, item.height,]], | |
[[item.width, 0, ], [0, 0, ]], | |
][y][x]); | |
} | |
app.beginUndoGroup("snap"); | |
snap(0, 0); | |
app.endUndoGroup(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment