Apple's free developer tool collection contains many overlooked gems. These aren't limited to programming-specific utilities. Mac enthusiasts of all stripes and all experience levels can regularly find tools to help them enhance their day-to-day use of OS X applications. It's just a matter of knowing where to look.
Take Quartz Composer, for example. It's a free utility that can bring new life and interest to your iMovie projects. In this article, you'll learn how to use your own pictures to create a simple but flashy animation.
After installing Apple's developer distribution, you'll find Quartz Composer in the Developer/Applications/Graphic Tools folder. Double-click its application icon to launch the program.
If you're running the latest version of Quartz Composer, an Assistant window opens at launch. Click Cancel and then choose File -> New (
N). Older versions of Quartz Composer don't have the Assistant. They just open a new editor.
The Quartz Composer interface consists of editor windows, where you lay out components and viewers where you preview the animation. These windows are labeled in their title bars ("Untitled - Editor," "Untitled - Viewer," etc.). Notice the Inspector button at the top right of each editor. Pressing this opens an inspector window where you can adjust settings for any selected object.
In the following steps, you'll create a basic animation: flying a picture across a screen. To do this, you'll use an image from your personal library and the Billboard renderer, a simple component whose job it is to display pictures.
Add a picture. Drag an image from your Pictures folder onto the new Editor window. A small green-labeled component appears. It's named after the image you dropped; in this case, "OS05002."
Add a billboard. Locate the Patch Library list on the left side of the editor. Click Name to sort the patch list by name (I find this makes it easier to find specific patches) and then drag a copy of Billboard onto the editor. The pink label indicates that this patch renders a result to your viewer. The yellow number "1" shows that this is the first rendering layer. Rendering layers display in order from back to front. Layers with larger numbers appear on top of layers with smaller numbers.
Connect the image to the billboard. Move your cursor to the dot to the right of the word Image on your green, original image component. This is the output produced from the image. Drag from this dot to the image input, the dot to the left of the word Image, on the Billboard. When the connection turns yellow, release the mouse.
Check out the Viewer. Making this connection allows the Viewer to display your image, courtesy of the billboard renderer that does all the heavy lifting.
Add a timing element. Meet the interpolation controller patch. This patch creates intermediate numbers between two values you specify as a function of time. With this patch, you can animate an item's position, size, rotation, or other attribute.
Locate the Interpolation patch and drag it onto the workspace. Then, select this new patch and open the Inspector.
To make your adjustments, first choose Input Parameters from the pop-up menu at the top of the Inspector. This displays the various input settings you can adjust. Set the start value to 1.5, the end value to -1.5, and the duration to 10. You'll use these values to move your picture from just off of the right side of the viewer (1.5) across the viewer to just off the left side of your viewer (-1.5) in about ten seconds.
Connect the interpolation patch to the billboard. Drag from the interpolation patch's Result output to the billboard's X Position input. Release the mouse when the connection turns yellow.
Watch the animation. Turn your attention to the viewer. Your image should now animate, moving in from the right side of the viewer and out to the left.
Add a background. The moving image is all well and good, but you'll want to add something to the background of your viewer, so it's not just flying over nothingness.
Locate the Gradient patch (in the Renderer category) and drag it onto your editor. Immediately, your animation disappears and is replaced by a simple gradient image. Notice the yellow "2" on the gradient patch? The gradient is rendering in front of your billboard.
Adjust the rendering layer. Right-click (
Control-click) the Gradient patch and choose Rendering Layer -> Layer 1. This reorders your layer, moving it behind the billboard.
Examine the results. Your animated image now appears over the background, while still moving from the right to the left.
Save to disk. Choose File -> Save, and save your new animation to the desktop as MyFirst.qtz. (You do not have to add the extension; Quartz Composer does that for you.)
Launch iMovie. Create a new project to use with the animation you just created.
Add your clip. Drag the MyFirst file onto the Clips pane in iMovie. Wait as the file imports. It may take several minutes for file to load and render. Once rendered, the clip should be 30 seconds long.
Add the clip to the Clip viewer. Drag the newly imported clip from the Clips pane down into the Clip viewer at the bottom of the iMovie window and then play your new movie. The animation should repeat three times, corresponding to the ten-second length you specified for your Interpolation patch.
Sure, flying a picture across a screen is pretty neat, but there's a lot more you can do with Quartz Composer than creating what is essentially a two-dimensional effect. In the following steps, you'll dial it up a notch to create an animated three-dimensional cube.
Return to Quartz Composer. Open your MyFirst.qtz project file. Select the Billboard renderer and delete it. You're about to use a more animated element.
Open the Clip Library. It's on the left side of your screen, in the same location as the patch library. Drag a copy of Rotating Cube onto the editor.
Make your connections. As you did with the Billboard, connect your image to the Rotating Cube's image input, and the Interpolation result output to the Rotating Cube's X position.
Examine the Viewer. Viola! Instant spiffy animation. Your cube rotates in from the right and out to the left. It should look pretty good, other than being a bit dark.
Adjust the ambient lighting. The reason the cube is so dark is that the default ambient light is so low. To fix this, double-click the Rotating Cube renderer. The Editor clears, replaced by a single Lighting renderer. This patch is actually part of the Rotating Cube, but hidden inside it.
Update the Lighting properties. Select the Lighting renderer and open the inspector. Choose Input Parameters from the Inspector pop-up menu. Click on the Ambient Light color well and use the Color palette to adjust that color to a much lighter shade of gray. Close the Inspector and Color Palette after making your adjustments.
Return to the top-level editor. Click Edit Parent to go back to your normal editing view.
Again, check out the Viewer. The cube and the images on it appear brighter this time.
Save to disk. Save your new, updated Quartz animation to disk as MySecond.qtz.
Flying, rotating picture cube? No sweat. How about adding a sweet two-image animation? It's no trouble at all with Quartz Composer. Here's how.
Add a second image. Drag a new, second image onto your editor.
Make room for the new effect. Disconnect the original image from the Rotating Cube renderer. Move the existing Interpolation patch out of the way, without disconnecting it.
Add the Dissolve transition. Locate the Dissolve transition in your patch library and drag it onto the editor. Dissolve creates a transition from one image to another.
Add a second Interpolation patch. Drag it in from the Patch library.
Connect! Make the following connections: 1) Connect your original image to the Dissolve patch's Image input. 2) Connect your new image to the Dissolve patch's Target Image input. 3) Connect the new Interpolation to the Dissolve patch's Time input. 4) Finally, connect the Dissolve patch's image output to the Rotating Cube's Image input. These connections tell the Dissolve patch which images to dissolve from and to, using the Interpolation patch as a timer.
Examine the Viewer. The cube faces should now transition between your two pictures, although the change will look a little sharp to begin with.
Adjust the Interpolation settings. Select the new Interpolation (the one connected to Dissolve) and open the Inspector. Choose Input Parameters from the pop-up menu. Set the Duration to 2.5, the repeat mode to Mirrored Loop, and the Sinusoidal In-Out from the Interpolation pop-up menu. The 2.5 duration divides easily into the overall ten-second core animation. Mirrored creates a transition from one image to the other and then from that image back to the first, rather than jumping at the end. Sinusoidal interpolation creates a smoother-looking progression from one image to the next.
Examine the results. The animation in the viewer should look much smoother and nicer after you've applied these settings.
Add a final touch. Disconnect Dissolve from the Rotating cube and drag a copy of the Bloom stylize patch between the two. Connect Dissolve to Bloom's Image input, and Bloom's Image output to Rotating Cube's Image input.
Again, examine the results. Bloom adds a soft, framed, almost dreamy effect to your cube.
Save to disk. Save your Quartz animation to disk as MyThird.qtz.
Return to iMovie. Load in the two new animations (MySecond and MyThird) and watch them play back at full digital video quality.
As you've seen in this article, Quartz Composer can produce powerful and exciting iMovie-compatible graphic sequences with just a few minutes of work. The animations you've created here are only a taste of Quartz Composer's power. There's much, much more you can do with this incredibly powerful tool. Hopefully this article will act as a starting point and inspire you to explore and discover more of Quartz Composer's phenomenal abilities.
Erica Sadun has written, co-written, and contributed to almost two dozen books about technology, particularly in the areas of programming, digital video, and digital photography.
Return to the Mac DevCenter
Copyright © 2009 O'Reilly Media, Inc.