Graphics Reference
In-Depth Information
LISTING 6-15
Continued
[rippleFilter setDefaults];
[rippleFilter
setValue
:[
self
shadingImage]
forKey
:
@”inputShadingImage”
];
[rippleFilter
setValue
:
[CIVector vectorWithX: 0.5*w Y: 0.5*h]
forKey
:
@”inputCenter”
];
CATransition
*theTransition=[
CATransition animation
];
[theTransition
setFilter
:rippleFilter];
[theTransition
setDuration
:2.0f];
return
theTransition;
}
}
// Cause the layer to use its default transition
return nil
;
}
- (CIImage *)shadingImage
{
if
(!shadingImage)
{
NSURL
*url;
url = [
NSURL fileURLWithPath
:
[[
NSBundle mainBundle
]
pathForResource
:
@”Shading”
ofType
:
@”tiff”
]];
shadingImage = [[CIImage
alloc
]
initWithContentsOfURL
: url];
}
return
shadingImage;
}
-(
IBAction
)doTransition:(
id
)sender;
{
CGRect
contentRect =
NSRectToCGRect([[window
contentView
]
frame
]);
if
(toggle)
{
[transitionLayer
setBounds
:contentRect];