We use Google Analytics to improve the website, this requires setting a few cookies as described in the privacy policy. Is this OK?

No Yes

How to connect objects with lines in After Effects

This latest After Effects quick tip runs through how to connect objects with lines in After Effects, only without using the Beam effect. Instead, After Effects shape layers are used along with a script that comes packaged with After Effects.

Connecting objects with lines in After Effects is incredibly useful, especially if you want one end of a line to be connected to a particular layer, and the other end connected to a different one.

Traditionally, the beam effect has been used to create this line between two points but it's pretty limited in what it can do. Anything beyond a simple straight line and the beam effect reaches its limit.

How to connect layers with lines via shape layers

To create connecting lines with shape layers in After Effects, all you need to do is:

  • Create a new shape layer
  • Draw a path on your shape layer between your two layers using the pen tool
  • Go to the Window menu, scroll down and enable the "Create nulls from paths" script (this comes packaged with AE 2018 and above)
  • Select the path object on your shape layer
  • In the "Create nulls from paths" panel, hit "Points follow nulls"

This will create a null object for every point on your path, and as a result you can now control each points position using a null object. The bonus of this is that you can now parent each null object to the layer you want it to be connected to. No need for expressions, just create the parent link.

The added benefit of using the shape layer method to create connecting lines, is that you can also use all the standard shape layer tools to customise the look and feel of your line. So you could add a dashed line for example, increase the thickness and colour, and you can animate it by using the standard trim paths effect.

Another bonus of using the shape layer method, is that your path can have more than two points, which is incredibly useful when you're creating things like annotations that may need a bend in the line for example.

The video goes into a bit more detail, so give it a watch and lean more about connecting objects in After Effects.

Filed under: