askvity

How Do I Link a Mask in After Effects?

Published in After Effects 4 mins read

The method for linking a mask in After Effects depends on what you mean by "linking." Here are a few interpretations and how to achieve them:

1. Linking a Mask Path to Another Layer's Property (e.g., Position, Scale)

This allows you to drive the shape of a mask using the value of another layer's property. This is achieved using expressions.

  • How to do it:

    1. Create your mask on the layer you want to affect.
    2. Select the layer with the mask.
    3. Press M to reveal the Mask properties.
    4. Expand the Mask properties until you see "Mask Path."
    5. Alt-click (Option-click on Mac) on the stopwatch icon next to "Mask Path." This opens the expression editor.
    6. In the expression editor, use the "pick whip" tool (the little spiral icon) to drag a line to the property you want to link the mask path to (e.g., the "Position" property of another layer).
    7. After Effects will automatically insert an expression. The default expression will only copy the value from that property. You will likely need to modify this expression further to achieve the desired behavior (e.g., multiplying the position value to scale the mask).
  • Example: If you linked the mask path to the "Position" of a null object, the mask path's point data would match the null object's [x, y] coordinates. This will probably not give you the result you want, so you'll have to adjust the expression to appropriately control the mask path. You'll need a good understanding of expressions to effectively customize this.

2. Linking Two Masks Together So That Changes to One Affects the Other

You might want two masks to always have the same shape and position.

  • How to do it:

    1. Create your first mask.
    2. Create the second mask on the same layer or a different layer.
    3. Apply an expression to the Mask Path of the second mask, using the pick whip to link it to the Mask Path of the first mask.
    4. Now, any changes you make to the first mask will be mirrored in the second mask.
  • Important Considerations:

    • Both masks must reside on the same layer for direct path duplication to work easily. If on different layers, you'll need to specify the exact layer and mask number in the expression (e.g., comp("Composition Name").layer("Layer Name").mask("Mask 1").Mask Path).
    • Consider parenting the layer containing the dependent mask to the layer with the controlling mask to maintain relative positioning.

3. Connecting Masks to Create a Single Shape

This involves combining the shapes of multiple masks to create a single, complex mask. After Effects provides options for combining masks using different modes (Add, Subtract, Intersect, etc.). This does not "link" them in the sense that changing one automatically changes the others, but it creates a final result based on their interaction.

  • How to do it:

    1. Create your masks on the same layer.
    2. In the Timeline panel, expand the layer properties.
    3. For each mask, you can choose a "Mask Mode" from the dropdown menu. Options include "Add," "Subtract," "Intersect," "Lighten," "Darken," "Difference," and "None."
    4. Experiment with the different modes to achieve the desired combined shape. "Add" combines the shapes; "Subtract" cuts one shape out of another; "Intersect" only shows the area where the shapes overlap.

4. Linking Masks for Motion Tracking

If you need to have a mask follow a moving object, you'll use the Motion Tracker in After Effects. This is the most complex linking method and does require planning.

  • How to do it (simplified):

    1. Create a mask around the object you want to track.
    2. In the Tracker panel, choose the appropriate tracking method (Position, Scale & Rotation, or Perspective).
    3. Set a tracking point on a distinct feature of the object inside the mask.
    4. Analyze the footage forward or backward.
    5. Apply the tracking data to the Mask Path or a null object which in turn will be linked to the mask path through expressions as described in point 1.

In summary, "linking" masks in After Effects covers several distinct techniques. Expressions provide dynamic linking, while Mask Modes offer ways to combine shapes. The best method depends on the specific goal.

Related Articles