The behavior logic of the toWorld() and fromWorld() methods in Expression
Hi all...
Can anyone explain the behavior logic of the toWorld() and fromWorld() methods in the provided scene.
https://drive.google.com/file/d/1VkAHg3bGehuDQlTyQpphz63yhwYpn6-0/view?usp=sharing
When the "Yellow Solid" layer does not have an ancestor, the behavior of the expression written for the Position property of the "Red Solid" layer is clear.
----------------------------------------------------------------
var targetLayer = thisComp.layer(2);
targetLayer.fromWorld(targetLayer.toWorld(targetLayer.position));
--------------------------------------------------------------
The position of the "Red Solid" layer is equal to the position of the "Yellow Solid" layer.
But when the layer "Camera 1" is assigned as the ancestor of the "Yellow Solid" layer, the algorithm for calculating the position of the "Red Solid" layer is not clear. The toWorld() method, as far as I understand, is designed to calculate the position of the child layer, which is the "Yellow Solid" layer???
And what should be the expression for the Position property of the "Red Solid" layer, when the ancestor of the "Yellow Solid" layer is the "Camera 1" layer, so that the position of the "Red Solid" layer matches the position of the "Yellow Solid" layer?
