Layer space transform methodsThe "from_" methods transform values from the layer's space to the named space (comp or world). The "to_" methods transform values from the named space (comp or world) to the layer space. Use the _vec methods when transforming a direction vector, such as the difference between two positions. Use the plain (non-vec) methods when transforming a point, such as position. Comp and world space are the same for 2D layers. For 3D layers, however, comp space is relative to the active camera, and world space is independent of the camera. Each of these methods takes an optional parameter to determine the time at which the layer's transform is computed; however, you can almost always use the current (default) time. Array [2 or 3] to_comp(point, t = time) {point is an array [2 or 3], and t is a number} Transforms a point from layer space to comp space. For example, "to_comp(anchor_point)". Array [2 or 3] from_comp (point, t=time) {point is an array [2 or 3], and t is a number} Transforms a point from comp space to layer space. The resulting point in a 3D layer may have a nonzero value even though it is in layer space. For example (2D layer), "from_comp(this_comp.layer(2).position)". Array [2 or 3] to_world(point, t=time) {point is an array [2 or 3], and t is a number} Transforms a point from layer space to view-independent world space. For example, "to_world(effect("Bulge").param("Bulge Center")". Array [2 or 3] from_world(point, t=time) {point is an array [2 or 3], and t is a number} Transforms a point from world space to layer space. For example, "from_world(this_comp.layer(2).position)". Array [2 or 3] to_comp_vec(point, t=time) {point is an array[2 or 3], and t is a number} Transforms a vector from layer space to comp space. For example, "to_comp_vec([1, 0])". Array [2 or 3] from_comp_vec(point, t=time) {point is an array[2 or 3], and t is a number} Transforms a vector from comp space to layer space. For example (2D layer), "dir=sub(position, this_comp.layer(2).position); from_comp_vec(dir)". Array [2 or 3] to_world_vec(point, t=time) {point is an array[2 or 3], and t is a number} Transforms a vector from layer space to world space. For example, "p1 = effect("Eye Bulge 1").param("Bulge Center"); p2 = effect("Eye Bulge 2").param("Bulge Center"); to_world(sub(p1, p2))". Array [2 or 3] from_world_vec(point, t=time) {point is an array [2 or 3], and t is a number} Transforms a vector from world space to layer space. For example, "from_world(this_comp.layer(2).position)". Array [2] from_comp_to_surface(point, t=time) {point is an array [2 or 3], and t is a number} Use with 3D layers only. Projects a point located in comp space to a point on the surface of the layer (zero z-value) at the location where it appears when viewed from the active camera. This is useful for setting effect control points. |