Copy link to clipboard
Copied
I have two shape layers set to the center of the comp, i applied the fromcomp expression to the transform position of the shape group (not the native transform position), to reference the position of the other layer (The Native Transform Position).
I understand what world space and layer space is in After Effects and the expression seems to work fine, but when i move the layer the other layer with the expression goes in the other the direction.
Why does it move that way.
See if this works:
L = thisComp.layer("Layer_1");
fromComp(L.toComp(L.content("Rectangle 1").transform.position))
Copy link to clipboard
Copied
See if this works:
L = thisComp.layer("Layer_1");
fromComp(L.toComp(L.content("Rectangle 1").transform.position))
Copy link to clipboard
Copied
It worked, Thank you.
But can yo please explain why my previous expression didn't work.
Copy link to clipboard
Copied
I have to admit I don't completely understand the relationship between the layer's transforms and and the shape's transforms, but it looks like the shape's position represents where it is relative to the layer's anchor point, which would mean it's in the layer's coordinate system. So to be useful in an expression on another layer, you'd first have to convert it to comp coordinates and then convert that into the expression layer's layer coordinates, which is what my expression does. Yours uses fromComp() on the other layer's shape position value, which is not in comp coordinates, so I wouldn't expect that to work. It's hard to explain, expecially when you don't understand it fully yourself. 🙂
Copy link to clipboard
Copied
I know the shape's transform positon uses layer's space and the layer's position uses comp space, isn't there a way to just straight up convert the layer's position (world's space) to layer's space co-ordinates to use in the shape's transform position, which was what i tried to do it in my own expression which didn't work