Graphics Reference
In-Depth Information
The ripple transition seems complex. However, when you create it, you can just call
-setDefaults
on the filter. The only field you
must
specify when using this filter on a
layer is
inputShadingImage
. You will probably also want to specify the
inputCenter
field
so that you can specify the location of the transition's origin point.
In this example, we use the ripple transition filter for the key “bounds.” This means that
whenever the
bounds
field of the layer is changed, the ripple effect will be used instead of
the default transition. In Figure 6-7, you can see what the effect looks like in its various
stages.
FIGURE 6-7
Ripple Transition Filter on a Core Animation Layer
To implement the ripple transition using encapsulation, simply create a derivative layer
named
RippleLayer
. The implementation of this layer code is in Listing 6-13.