Use layer space transform methods to transform values from one space to another, such as from layer space to world space. The “from” methods transform values from the layer’s space to the named space (composition or world). The “to” methods transform values from the named space (composition or world) to the layer space. Each transform method takes an optional argument to determine the time at which the layer’s transform is computed; however, you can almost always use the current (default) time.
Use “Vec” transform methods when transforming a direction vector, such as the difference between two position values. Use the plain (non-”Vec”) transform methods when transforming a point, such as position. Composition (comp) and world space are the same for 2D layers. For 3D layers, however, composition space is relative to the active camera, and world space is independent of the camera.
Argument type: point is an Array [2 or 3], and t is a Number.
Transforms a point from layer space to composition space.
Argument type: point is an Array [2 or 3], and t is a Number.
Transforms a point from composition space to layer space. The resulting point in a 3D layer may have a nonzero value even though it is in layer space. Example: fromComp(thisComp.layer(2).position)
Argument type: point is an Array [2 or 3], and t is a Number.
Transforms a point from layer space to view-independent world space. Example:
toWorld.effect("Bulge")("Bulge Center")
Argument type: point is an Array [2 or 3], and t is a Number.
Transforms a point from world space to layer space. Example: fromWorld(thisComp.layer(2).position)
Argument type: vec is an Array [2 or 3], and t is a Number.
Transforms a vector from layer space to composition space. Example: toCompVec([1, 0])
Argument type: vec is an Array [2 or 3], and t is a Number.
Transforms a vector from composition space to layer space. Example (2D layer):
dir=sub(position, thisComp.layer(2).position); fromCompVec(dir)
Argument type: vec is an Array [2 or 3], and t is a Number.
p1 = effect("Eye Bulge 1")("Bulge Center");
p2 = effect("Eye Bulge 2")("Bulge Center");
toWorld(sub(p1, p2))
Argument type: vec is an Array [2 or 3], and t is a Number.
Transforms a vector from world space to layer space. Example: fromWorld(thisComp.layer(2).position)
Argument type: point is an Array [2 or 3], and t is a Number.
Projects a point located in composition 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. Use with 3D layers only.
How about complete examples of the syntax for these methods. They are always confusing. I know I am not alone in this, as the web is full of thread about this.No screen name said on Aug 17, 2007 at 8:16 AM :
Thnx
Sorry to only gripe in my last comment. How about some examples along the line of this:Darby Edelen said on Aug 25, 2008 at 12:50 AM :
Add Effect>Expression Controls>Layer Control to layer
Add this Expression to the layers postion:
targ = effect("Layer Control")("Layer");
targ.toComp(transform.anchorPoint)
Layer will now position track which ever target layer is selected in the Layer Control.
I believe the above expression is incorrect. If you want the layer to which the expression is applied to follow the anchor point of the layer selected in the Layer control you would want to write it this way:slipslipslip said on Aug 25, 2008 at 8:34 AM :
targ = effect("Layer Control")("Layer");
targ.toComp(targ.anchorPoint)
The point inside the parentheses of the toComp() method is relative to the object that toComp is referring to (which is, in this case, 'targ'). So you would generally want to specify a point that is in the layer space of 'targ' (such as targ's anchor point).
Also, on an unrelated note, if you don't specify a layer object for the space transform function, it uses thisLayer by default:
toComp(anchorPoint);
is the same as:
thisLayer.toComp(anchorPoint);
Thnx Darby. Sadly, neither of our expressions actualy work :(slipslipslip said on Aug 25, 2008 at 8:38 AM :
oops...just need a toWorld - had 3d layers.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/en_US/AfterEffects/8.0/WS3878526689cb91655866c1103906c6dea-79fd.html
Comments
Comments are no longer accepted for After Effects CS3. After Effects CS4 is the current version. To discuss After Effects CS3, please use the Adobe forum.