As someone who regularly teaches courses in both After Effects and Motion, I am often asked what the differences are, and what application is better. One of the primary differences between the two is the use of Keyframes in After Effects and the use of Behaviors in Motion. This article explores one of my favorite behavior workflows in Motion, its called Parameters.
The effect we are going to create is to build an Audio Spectrum Analyzer, then have it animate to a piece of music so that it responds to various frequency ranges. So lets begin.
In a new project select the Rectangle Tool, press R and draw a rectangle in the Canvas.
We will need four more of these, which we will duplicate. First though, let's make the rectangle look more like a Spectrum Analyzer.
Press F5 to open the Project pane and select the rectangle. Then press Command-3 to open the Inspector pane thus accessing the parameters for the selected rectangle. Four tabs are available: Properties, Behaviors, Filters and a contextual tab that changes depending on what you are working with. In this case it says Shape.
In the Shape tab, under the Style options change the Fill Mode from Color to Gradient. A generic gradient will now fill the rectangle.
Click on the disclosure triangle under the Gradient to reveal the gradient editor. Select the first stop under the gradient editor and using the Color option set the color to R: 236 G: 53 and B: 37. This add a bright Red, that will represent Audio Peaks in the Analyzer.
Then set the Second stop to a color of R: 118 G: 244 and B: 22 which adds a bright green to the main part of the Analyzer. To finish the look, drag the mid point between the two stope to the left so the Green is more prominent, and the Red area is only at the top part of the rectangle.
Now that the Rectangle is set to look the way we want, we need four more. Press Command-D to duplicate the shape, and move the duplicate to the right to start creating a row. Repeat this process until there are 5 rectangles spaced out across the screen in a row.
It's possible to keep the five shapes in line, and spaced equally as they are moved, however accuracy is important. Select all the shapes, either in the Project pane or in the canvas.
Open the Object menu and select Alignment > Distribute Horizontal Centers (you can also use Align Vertical Centers if necessary). The rectangles will be lined up and equally distributed, ready for the next stage.
Select only the first rectangle, then pick up the Rectangle Mask tool. Use the tool to draw a rectangular mask over the first rectangle, ensuring the mask is slightly larger than the shape it will cover.
The shape will still be visible, but that will soon change.
In the Inspector pane (which if it's not already visible press Command-3 to open), the contextual tab will have the Mask options visible.
Click on the Invert Mask option to invert the mask and make the rectangle shape disappear. It is the animation of this mask that will create the effect needed for the Spectrum Analyzer.
Repeat step 7 until each of the rectangles is hidden.
OK so the Animation is about ready to start, but first we need something to animate to. Press Command-1 to open the File Browser and browse for an Audio file. It's important that the Playhead is set to the first frame of the project before you import the audio. Press the Home key to make sure it is. (Fn-Left Arrow on a laptop).
With the Audio file selected press Import at the top of the File Browser. This will add the Audio track to the timeline at the start of the project.
Using the Project pane, click on the disclosure arrow next to the first rectangle and select the Rectangle Mask. Open the Inspector pane and choose Properties or press F1. We are going to animate the Position parameter so that the Mask moves up and down on the Y axis.
Control-Click or Right-Click on the Position Parameter and from the menu that appears choose Add Parameter Behavior > Audio. This will add the Audio parameter, and open the Behaviors tab that contains the Audio options.
In the Audio Behavior settings set the Source Audio to your audio track by selecting it from the To drop-down menu.
Use the handles on the Horizontal axis on the Audio Graph to limit the range of the Audio Parameter applied to the mask to the lower frequencies of the track.
This Audio parameter will now animate the mask, however it's unlikely to animate the mask by any great amount. We need the mask to move much more substantially.
Set the Scale slider up to 195 (TIP: a negative number would make the mask move in the opposite direction) and the mask will start to move the amount we need. Feel free to experiment with this value. Also to ensure the mask only moves on the Y axis set the Apply To option to Properties > Transform > Position > Y.
Select each mask in turn and repeat steps 10 - 12 so that each one animates. Make sure that each mask is set to a different Horizontal range in the Audio Graph, Medium Frequencies, High Frequencies etc. Otherwise all the masks will animate to the same parameters.
Play the animation, pretty cool huh? If any of the masks don't animate enough, or perhaps animate too much, experiment with the Scale setting in the Behaviors tab.
Motion really is a lot of fun to work with. As you may have noticed, we didn't use a single keyframe in this exercise, making this a particularly fast workflow. In future, if you're looking to do this again, try creating and animating just one rectangle. Then duplicate the rectangle along with its animated mask and change the Audio Graph range for each duplicate. This will make the job even quicker next time.