beautypg.com

Adobe After Effects CS4 User Manual

Page 680

background image

674

USING AFTER EFFECTS CS4

Expressions

Last updated 12/21/2009

Transforms a point from layer space to view-independent world space. Example:

toWorld.effect("Bulge")("Bulge Center")

Dan Ebberts provides an expression on his

MotionScript website

that uses the

toWorld

method to auto-orient a layer

along only one axis. This is useful, for example, for having characters turn from side to side to follow the camera while
remaining upright.

Carl Larsen provides a pair of video tutorials on the Creative COW website in which he explains the basics of parenting
and then uses an expression involving the

toWorld

method to trace the path of an animated child layer:

part 1

part 2

fromWorld(point, t=time)

Return type: Array [2 or 3].

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)

See “

Expression example: Create a bulge between two layers

” on page 685 for an example of how this method can be

used.

toCompVec(vec, t=time)

Return type: Array [2 or 3].

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])

fromCompVec(vec, t=time)

Return type: Array [2 or 3].

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)

toWorldVec(vec, t=time)

Return type: Array [2 or 3].

Argument type: vec is an Array [2 or 3], and t is a Number.

Transforms a vector from layer space to world space. Example:

p1 = effect("Eye Bulge 1")("Bulge Center");

p2 = effect("Eye Bulge 2")("Bulge Center");

toWorld(sub(p1, p2))

fromWorldVec(vec, t=time)

Return type: Array [2 or 3].

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)

fromCompToSurface(point, t=time)

Return type: Array [2].

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 method is useful for setting effect control points. Use with 3D
layers only.

This manual is related to the following products: