Ukramedia

Login

Project File

After Effects Tip: Learn toCompVec() Expression

After Effects Expressions can be handy, they will save you a lot of time. In this post, I will show you a very helpful After Effects Expression called toCompVec().

It is an Expression that converts vectors from the layer space to the camera view space.

So let’s dive right in!

After Effects Set-Up:

For this example, I have a simple set-up in Adobe After Effects. I have a Ukramedia logo and a logo background in my timeline.

After Effects Set up

The logo background is just the shape of the Logo but without the UM in it. It is just an orange circle.

After Effects Canvas

By the way, I do have a project file for this Tip. You can download this project file by filling out the form at the very bottom of this post. Feel free to download it and follow along with me in After Effects.

Step 1: Make the Logo 3D

First, we need a few of our files converted to 3D. To do that, we need to select the vector logo file [UM Logo 2017.ai] and the “Logo BG.” Then LEFT-CLICK on the 3D icons next to the file name in our After Effects timeline.

After Effects 3D Icon

Step 2: Turn Off the Logo Background

I am going to turn off the Logo BG layer just for a moment.

After Effects Eye Icon

Step 3: Reveal Rotation Property

Select [UM Logo 2017.ai] file in your timeline and press R on the keyboard to reveal the Rotation Property
After Effects Rotation Keyboard Shortcut

Here is what I am trying to do. I want to rotate the Y Rotation of our [UM Logo 2017.ai] past the middle point and then have it disappear.

After Effects Rotation

Then reverse that. So If we were to go back to where it was, it would reappear again. In other words, I only want to see the front face of the Logo, not the back.

I also want to do the same with the X Rotation.

So how do I make this happen just using a simple Expression? Good question!

This is where toCompVec() After Effects Expression comes in handy.

Step 4: toCompVec() Expression Application.

Select the [UM Logo 2017.ai] file then hit SHIFT-T on your keyboard to reveal the opacity.

After Effects Opacity Keyboard Shortcut

Activating toCompVec() Expression in After Effects

Activating toCompVec() or any other Expression in Adobe After Effects is very simple.

All you have to do is ALT-LEFT CLICK on the stopwatch icon next to the opacity on a PC or OPTION – LEFT CLICK on a MAC. You will see a white box appear in your timeline.

That’s where we need to enter our toCompVec([0, 0, 1]) Expression.

Activating After Effects Expressions with stopwatch icon

Breaking Down the toCompVec() Expression

As mentioned before, the toCompVec() Expression is a simple Expression that converts the vector from the layer space to the camera view space.

The first number in our toCompVec() Expression controls the X Rotation, the second number controls the Y Rotation, and the third number controls the Z Rotation. In other words, these numbers will determine direction.

Applying toCompVec() to Rotations in After Effects

The Z Rotation in our coCompVec() is currently set to 0, so it will make the Logo face towards us.

If it were -1, then it would do the opposite by making the Logo facing away from us.

Learning Index in After Effects Expressions

Now I want to grab the Z Rotation number from our toCompVec(0, 0, 1) Expression.

To do that, I have to use square brackets at the end like so: toCompVec(0, 0, 1)[].

I have to specify which index number I want to grab from our toCompVec(0, 0, 1) Expression inside those square brackets.

I want to grab the Z Rotation number, which is 1. It is the third number from the left; however, the Index considers it as the second number from the left. It can be confusing to understand at first because the Index orders things starting from 0, not from 1.

For example: 

right now, we have three numbers inside our toCompVec() Expression. Those numbers are 0, 0, 1.

The first number in our toCompVec(0, 0, 1) Expression is 0.

Naturally, we will probably say that this 0 number is the first number of our Expression. Therefore it must be number 1 since most of us start counting from 1 to whatever. However, the Index doesn’t look at the order the same way we do.

Index orders things starting from 0. If we have three numbers inside of our toCompVec(0, 0, 1) Expression, the Index will list those numbers from 0 to 3 like so: 0, 1, 2. Let’s keep going.

The second number is also 0, but the Index looks at it as the first number from the left.

Lastly, the third and final number in our Expression is 1, but the Index lists it as the second number. I hope this makes sense.

Working with toComVec() After Effects Expression

So let’s go ahead and enter Index 2 inside our square brackets to the end of our toCompVec(0, 0, 1)[2] Expression. Then LEFT-CLICK away from the white box. It will close out our white box and activate the toCompVec(0, 0, 1)[2] Expression

After Effects Index

Now when we look at our timeline, it appears as if nothing has changed. The opacity is still at 100%. That’s because our Logo is facing us.

toComVec() After Effects Expression

However, if we rotate the Y Rotation of the Logo to the left past the halfway mark, you will notice that our Logo is no longer visible. It will disappear because the vectors are pointing away.

toComVec() After Effects Expression

Also, if you look at our opacity, you will notice it is now at 100%. It is now at 0%.

toComVec() After Effects Expression

But if we rotate our Y Rotation back to the right, the Logo will appear again. Everything is done automatically with a simple toCompVec() Expression. We don’t have to do it manually.

The same thing applies to the X Rotation. If we go past the halfway mark, the Logo will disappear.

toComVec() After Effects Expression

And if we go back, it will appear again. That simple! You can see how handy this can be.

Let’s take it a bit further.

Step 5: Parenting layers in Adobe After Effects with toComVec().

I’m going to LEFT-CLICK on our Expression and copy it by pressing CTRL-C on a PC or COMMAND-C on a Mac.

toComVec() After Effects Expression

Then I will select the Logo BG and make it visible again by LEFT-CLICKING on the eye icon.

toComVec() After Effects Expression

You can see that it is just a plain shape. Nothing crazy, but I am going to press T on my keyboard and ALT-LEFT-CLICK on a PC or OPTION – LEFT-CLICK on a Mac.

LEFT-CLICK on the stopwatch to active the Expression.

toComVec() After Effects Expression

Then CTRL-V on a PC or COMMAND-V on a Mac to paste the same Expression we used from the previous example inside the white box.

toComVec() After Effects Expression

Then press SHIFT-R on your keyboard to reveal the rotational properties. Now I can see the same thing happening to the layer here.

toComVec() After Effects Expression

Here is what I want to do this time. I want it to the same thing that we did before but in reverse.

Now I am going to change the direction of our toCompVec(0, 0, 1)[2] Expression. Instead of 1, I am going to set our Z Rotation to -1.

Z Rotation to -1, you will notice that the Logo BG is no longer visible. That is because we reversed the process.

toComVec() After Effects Expression

To make the Logo BG visible again, we have to rotate the Logo BG file past the midway point, just like we did in the previous example.

toComVec() After Effects Expression

This comes in handy if we want to create a fake two face 3D look in After Effects.

To do that, we have to first select the Logo BG file and then parent it with the [UM Logo 2017.ai] file by LEFT-CLICK and HOLD on the pick whip. Then drag it to the [UM Logo 2017.ai] file.

Now when the [UM Logo 2017.ai] file disappears, the Logo BG will still be visible.

The same thing applies for both the X & Y Rotations.

I hope you found this After Effects Tip useful. As you can see, After Effects Expressions are handy. They will speed up your workflow in After Effects.

When I learned Expressions, it changed my life! I began automating everything!

When I was at FOX Sports, I was able to speed up their workflow by converting their graphics into motion graphic templates with Expressions.

I did a presentation about it at NAB 2019. Check it out! 

I fell in love with Expressions. It saved me so much time, and I want you to do the same. That is why I strongly encourage everyone to look into Expressions. I even put together a 12+ hour course on Expressions at ukramedia.com/expressions.

Hundreds of students were able to enroll in my class, and the feedback is overwhelming! Make sure to check in out!

Free Private Facebook Mentoring Group

Lastly, join our FREE Private Facebook Mentoring Group. It is our best FREE online resource. We have thousands of talented motion designers in this group. It is an excellent place to network and grow as a motion designer. See you in the group! 


Recommended Resourses:

June 22, 2020

We're trusted by these great organizations.

FEATURED IN & ON:

Kingsport Times News

Join us and 25,000+ Artists

Subscribe to gain access to exclusive freebies

No spam, promise!
top

© 2020 Ukramedia, LLC