Channel Additions

iaian7 » tutorials » aftereffects   John Einselen, 14.06.07 (updated 27.07.09)    

x = thisComp.layer("LAYER").transform.position[0]+300; y = thisComp.layer("LAYER").transform.position[1]-300; [x,y]

Takes position data from the specified layer and modifies by the values entered. This is probably the simplest expression around, but it’s great for using a tracking null to control an effect center point.

For example, a clip may have good camera tracking, but none of the nulls at the correct location for a lens flare. Use this script to attach the flare to a tracking null, but with specified offset. Also great if the effect center needs to be off-screen; you can still use on-screen elements to track.

x = thisComp.layer("LAYER").transform.position[0]+ thisComp.layer("LAYERCHILD").transform.position[0]; y = thisComp.layer("LAYER").transform.position[1]+ thisComp.layer("LAYERCHILD").transform.position[1]; [x,y]

This is the same idea, but uses a second null (parented to the first null) to control the offset. Expressions ignore parenting, so this will let you parent a a layer to, say, your tracking null, and visually control and animate the expression.