Copy link to clipboard
Copied
With Duik, you can add 0 to a layer and the outcome has 2 guide layers both parented to the target layer while the target layer has a new position of [0,0].
I've spent a couple of hours trying to make chat GPT give me something useful but to no avail. I know I'm missing something and I just want to understand what I'm getting wrong or what process would allow me to do this manually.
eg. Layer 1 has position [1158, 904] I want to make the position value of this layer [0,0] without moving it.
For a 2D layer, I think this works:
var layer = app.project.activeItem.layer(1);
var pos = layer.property("Position").value;
var ap = layer.property("Anchor Point").value;
layer.property("Anchor Point").setValue([ap[0]-pos[0],ap[1]-pos[1]]);
layer.property("Position").setValue([0,0]);
Copy link to clipboard
Copied
For this, subtract the change to the Position values from the corresponding Anchor Point values.
Copy link to clipboard
Copied
Yes, this makes sense, just wasn't sure how. Thanks for your help much appreciated!
Copy link to clipboard
Copied
For a 2D layer, I think this works:
var layer = app.project.activeItem.layer(1);
var pos = layer.property("Position").value;
var ap = layer.property("Anchor Point").value;
layer.property("Anchor Point").setValue([ap[0]-pos[0],ap[1]-pos[1]]);
layer.property("Position").setValue([0,0]);
Copy link to clipboard
Copied
Hi Dan, thank you for this. Yes, this works for what I was trying to do.
Also apologies for the late reply and, well... thank you for everything you do. A huge portion of what I know and have learned on AE is because of you. You're a legend thanks.