After Effects - Join Points with a Line with Expressions



Hey guys!
While working on the Mission Briefing video, I had to make the flexible line that joins the house to the text. This was because later the line had to move but still stay connected to the house. Here's a quick tip on joining objects with a line using a bunch of Nulls and some sneakiness XD

I won't lie, at first I was having trouble pulling the effect. At first I had used Write-on, but when I had to move line I couldn't use it anymore. This is because Write-on uses keyframes. I could've redrawn the line but that wasn't what I was going for!
Part of being a VFX Artist is being able to solve problems, and that's what I did!
To that effect, please make sure you UNDERSTAND what's going on!! It makes it easier to expand and create your own process from it, rather than memorising and only using it in the context of this tutorial.

So, let's look at how to do it.


STEP 1: CREATE THE OBJECTS
For this example, we're going to create something similar to the above. I'm using a 1280 x 720 px Comp. So, create a new solid and add the "Circle" effect (Effect > Generate > Circle) and set the settings like this:


This will be the object we're connecting to the lines. I'm also going to add a text: "LOOK HERE" in the same colour.

I've moved the circle to the bottom right. I've moved the whole layer rather than the effect's centre. This is in case at some point I need to rotate the object, I can keep the anchor point in the center.

STEP 2: CREATE THE PARTS
The joining effect is entirely based off of the Beam effect.
Create a new Solid and apply the Beam effect (Effect > Generate > Beam)
Set the length to 100%, Softness to 0 and both colors to the same yellow.


Okay we have the first line. We'll create the second one later, but for now we can duplicate the Beam effect (Select it and Ctrl+D) then switch it off by clicking the fx next to the name.

Create a new Null object and position it at the far right below the L of "LOOK". Duplicate it and while holding Shift, drag it to the Left towards the last E of "HERE". Duplicate again and move the third one to touch the circle. Select the three and press S, scale them down so they're not so big:



Okay, we can name them "Start", "Middle" and "End" so that the one we created first is called "End" (the one near the L).
Now the fun part!

STEP 3: ADD THE EXPRESSIONS
The expressions are actually pretty simple.
Select the Beam layer and press E, then drop down the first Beam.
Alt+click on Start Point and Pick whip the "START" null, then add .position to the end of the expression. Alternatively, you could select the nulls and press P to show their positions and pick whip that instead.


Alt+click the Ending Point and pickwhip "MIDDLE" position.
Our comp should now look like this:

Cool!
Now we need to connect Beam 2.
Drop down Beam 2 and connect Starting Point to "Middle" then Ending Point to "End". Switch the effect back on and we'll see this::


You'll notice that when we switch the second one on, the first one disappears. This is because Beam clears out everything above it. So all we need to do is go into the settings of the second beam and switch on "Composite on Original" (the last option in the effect). This will bring back the previous line.

STEP 4: ANIMATE AND FINE TUNE

For this part, what we'll do is animate the line in.
At the beginning of the timeline, select the first line effect and set a keyframe for "Time". Set it to 0. Move down the time to 1 second and add another keyframe by typing in 50%. While keeping at the same time, create a keyframe for the second beam's Time set to zero. Move down another second then add a 50% keyframe. This will animate the line in:


As you can see, there's a little dot that stays. This is a problem. The best solution would be to create ANOTHER new solid and cut the second beam effect (Ctrl+X) them paste it in the new solid (Ctrl+V).
This is also good because we can freely control it's time rather than squeezing everything into one layer.
So we'll move the new solid down in time to the 1 second point so that it starts when the first one finishes. We'll also have to switch off "Composite on Original".
The timeline should look like this:
(click to view larger)

Okay cool!

STEP 5: MESS AROUND
So for this part, I'm going to move stuff around. First, I'll select the text and MIDDLE and END and animate their positions by adding keyframes at 2 seconds then moving them elsewhere.
I'll also select START and CIRCLE and move them.

Notice that now it appears as though the line is stuck to the circle and the other line is stuck as an underline. The Null objects have really made our lives easier.

STEP 6: NOTICE SOMETHING....
Okay, but this position work would be much better if we could just parent MIDDLE and END to the text and parent CIRCLE to START. But if we try that....


Wooow!! Things have really gone wrong.
Also, if we try and make any of the layers 3D and displacing them in Z-space, things REALLY go wrong!! In the next tutorial, Part 2, we'll look at how to resolve these problems!

In the mean time, enjoy what you've just learnt, or try and figure out how to resolve the above problem.

What do you think? Drop a comment below, or like and comment on the Facebook page