Graphics Reference
In-Depth Information
QTMovieLayer and contentsRect
In Chapter 2, “What Can and Should I Animate?,” you saw all the different animatable
parameters that are available to you. One of the more interesting parameters of a layer we
covered there is the contentsRect as it specifies what portion of the layer contents you
actually want to display. This is particularly interesting as it relates to the QTMovieLayer
because you can duplicate the contents of the QTMovieLayer into another standard
CALayer, and while doing so, you can specify which part or rectangle of the
QTMovieLayer to display in that layer's contents.
So you might wonder how that is useful. Say you created a movie that contained a grid of
individual videos. You could use this one reference video and duplicate its contents into
numerous other CALayer s and specify which portion of the layer should display in each
CALayer . Or you could take a single movie and slice it up into a grid. Figure 7-6 shows a
screenshot of the sample application from the companion website called
CopyMovieContents that demonstrates this feature.
FIGURE 7-6
Copy Movie Contents into Individual CALayers
Each of the rectangles you see in the grid are individual CALayers all getting their
contents from the same QTMovieLayer . For this application, we create a QTMovieLayer
with the roller coaster movie located in /System/Library/Compositions/Rollercoaster.mov .
Search WWH ::




Custom Search