I have two variables in After Effects which get the X and Y position values of a layer named "Desk"…
var posH = app.project.activeItem.layer("Desk ").transform.position[0];
var posV = app.project.activeItem.layer("Desk ").transform.position[1];
I have some code that contains an array that needs to take those variables and add to them, but I'm not sure the syntax is correct… [posH+390.5,posV+218.5]
I know addition alone works, eg if I just do [1000+390.5,1000+218.5]
then it works. I just need it to work with the variables.
EDIT ––––
I've tested it in isolation and it works, so maybe the bug is something to do with it being in a loop? The full code is here…https://pastebin.com/XfeUaqb8 you can see the variables at line 11 and 12 and the array im testing it with at line 24.
This script will position layers based on their name. Originally all my AE comps were 4000x4000 but now some are different sizes, so I need to modify it and use another layer as a constant reference point to refer to no matter the size of the AE comp or how it's cropped.
I have it working fine as an AE expression…
posH = thisComp.layer("Desk ").transform.position[0]+390.5;
posV = thisComp.layer("Desk ").transform.position[1]+218.5;
[posH, posV]
but obviously i need it as a script so that the character position can later be moved if needed without it just jumping back to values determined by the expression.