1. 3D & Motion Graphics
  2. Motion Graphics

Quick Effect: Magnifying Track Matte

Read Time:6 minsLanguages:

This tutorial will teach you how to generate a magnifying effect with the use of an animated track matte. The final effect can be used for many purposes, particularly to create a sophisticated background for other elements, such as logos and text.

This tutorial is ideal for beginners or experienced After Effects users who want to quickly learn an attractive and simple technique.

Step 1

Open After Effects, and create a new composition (up top click "Composition -> New Composition"). Use the settings in the image when prompted. This will create a new composition that is 1280x720 that is 10 seconds long. After you learn, you can set your composition to whatever resolution suits your needs.

Step 2

Next you will need to draw a rectangle shape in this new comp. First you will need to zoom out quite a bit to see beyond the visible comp. You'll see why in the next step. Zoom out by scrolling your mouse wheel down, or use the zoom drop down on the bottom left of your comp. Next use the rectangle tool, and draw a thin white rectangle that overlaps the top and bottom of your composition as shown in the below image. The color white for the bars on a black background is important.

Step 3

Now we will add an expression to the rectangle called Wiggle. What it will do is "wiggle" the layer randomly over time. We are trying to generate a smooth side to side movement. This can be keyframed but let's allow the expression to do the work for us.

Navigate to the layers and drop down the arrow for the rectangle exposing its properties. Then drop down "Transform". Hold Alt/Option and click the stopwatch next to the "Position" property. This will allow you to add an expression. Paste this code in that area (without the quotations, of course) "wiggle(1,65)".

The first value in the wiggle expression is the "frequency" which defines how many wiggles occur every second. The second value in the expression determines how many pixels the object is allowed to move. This movement is why we made the shape larger vertically than the composition to prevent the shape's top or bottom from moving into view. It also helps simulate a side to side movement only. Try to preview the animation at this point and watch your little rectangle move!

Step 4

Once this is done you will need to duplicate your rectangle 25 times (select the layer and hit CTRL+D). I know this seems excessive but it will pay off.

Each instance/copy you make, you need to move and randomly resize each one. Refer to the below image for an example, then create your own version.

Note: Feel free to play this step by ear. You don't have to copy my example: add a few more copies, and play with sizing. Also, from trials I have found that a lot of smaller copies tend to add to the end effect. It's also OK to position some off stage... if close enough, they will move on stage at some point.

Step 5

Your track matte is complete. You will now need to create a new composition within the same project. Once again, go to the top and select "Composition -> New Composition". Use the same settings shown in Step 1. This new comp is where we will pair our footage with our moving bars track matte.

Step 6

Go to "File -> Import -> File" and select your footage. Since we are working in an HD format composition, I suggest using footage that is at least as large as the comp. By importing smaller footage you will need to scale the footage up, and could risk loosing quality. Once the import is complete you
should now have 3 files in your "Project" panel (Comp 1, Comp 2, and your footage). I'm going to use a stock image to demonstrate the effect. Stock image can be
found here: Link.

Step 7

Place your footage on the timeline of Comp 2. Ensure it is centered on the stage. Select that layer and again use Ctrl+D to duplicate your footage layer.

Now you have two copies of the same footage on your timeline. Lastly, you need to pull "Comp 1" from the project panel to the top of your layer stack. Turn off the visibility of your "Comp 1" layer. Do this by clicking the small eye icon to the left of the layer. If the matte is visible it will only look like a black and white animation, whereas the footage is the meat and potatoes of the project and that's what we want to be able to see!

Step 8

Essentially, the matte we created in Comp 1 is a looking glass through to the two footage layers. The setup we are preparing will display the bottom footage layer in all of the black areas of the track matte, and will display the top footage layers in all of the white areas of the track matte. This is why it was so important to work with a black background and white rectangle shapes.

To be able to see the effect we need some difference between the two footage layers. To create this, we are going to scale the top-most footage layer up 5%. Drop down your top-most footage layer (the middle layer of the three) and then drop down "Transform". Click the value in the scale property and change it to 105% and finally drop down the "TrkMat" for that layer and select "Luma Matte - Comp 1".

By increasing the scale on the top footage layer, it gives off a magnified/displaced effect.

Step 9

Render your "Comp 2" and you will end up with your video!

Additional Suggestions

This end result is just one of the many paths that could have been taken from the beginning of the tutorial. To achieve different results, you can tweak a number of different things.

  • Change how many shapes you place on the stage.
  • Vary the size of the shapes.
  • Change the values of the wiggle setting to make it faster/slower or to make it move more/less.
  • Give each shape a different wiggle setting... have them all moving at different speeds.
  • Blur the top or bottom footage layer.
  • Make one footage layer greyscale and the other footage layer color.
  • If at any time you feel you need to make a change to your track matte you can go back into
    your "Comp 1", make the change, and when you change back to "Comp 2" your change with automatically be reflected in the project.

The wiggle expression used here is bare-bones basic. After getting acquainted with things, you may want to check out AutoExpress.
It's a script for After Effects that will allow you to apply the wiggle as though it was an effect rather than having to type the script manually. You can also add smoothing and looping to the equation to further the possibilities of this project!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.