Ok, I have things working but I am now encountering a new challenge. I think that I need to convert comp space to to the layer space of a particular layer. Does any one know how to do that? I’ve searched and am still searching but have not found anything yet.
In the code below, I want the value in the first dimension of the array to be the edge of the layer selectedLayers[0]. The number that I am getting now is correct but I think it is in comp space rather than layer space.
myPositionTwo.setValue([myComp.selectedLayers[0].width, myHeight]);
below is my updated code. Thanks a lot, Ryan
{
app.beginUndoGroup("snap");
var myComp = app.project.activeItem;
for (i = 0; i < 1; + + i ){
if (myComp.selectedLayers.length < = 1 || myComp.selectedLayers.length > = 3){
alert("please select two layers");
}else{
var mySolid = myComp.selectedLayers[i];
var myWidth = mySolid.width;
var myHeight = mySolid.height/2;
var myAnchor = mySolid.property("anchorPoint");
myAnchor.setValue([myWidth,myHeight]);
var myPositionTwo = myComp.selectedLayers[1].property("position");
var myPositionOne = myComp.selectedLayers[0].property("position");
myPositionTwo.setValue([myComp.selectedLayers[0].width, myHeight]);
}
}
app.endUndoGroup();
}