-
scripting question
Hello,
Please forgive my ignorance. What I am trying to do is: having two layers selected, upon the running of this script, both layers to move their anchor points to the edge of the layer on x and the middle of the layer on y while the lowest in the timeline changes position. I don’t care where it repositions to yet, just that it moves so I threw “width” and “height” in just for a test.
From my understanding the following line of code should move the lowest of the selected layers to a new position.
var myPosition = myComp.selectedLayers[1].property(“position”);
myPosition.setValue([myWidth, myHeight]);and it does. but If I change the [1] to a [0] it makes no difference. It still moves the lowest layer. Can someone please explain to me why and how to fix this?
My second concern is that when it does move, it moves to [0.0,0.0] rather than what I would expect which is [500,10] the layers height and width. The anchor point moves to [0,0] as well and I want it to move to [0,5]. Can anyone explain this to me?
I started learning scripting yesterday so the answers may be really simple. Below is my whole script as it is right now. Thanks a lot, Ryan
{
app.beginUndoGroup(“snap”);
var myComp = app.project.activeItem;for (i=0; i