Created
December 25, 2010 17:56
-
-
Save madebyjeffrey/754971 to your computer and use it in GitHub Desktop.
Animated ZoomBlur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CIFilter *filter = [CIFilter filterWithName: @"CIZoomBlur"]; | |
[filter setDefaults]; | |
[filter setValue: [CIVector vectorWithX: self.title.bounds.size.width / 2 | |
Y: self.title.bounds.size.height / 2] | |
forKey: @"inputCenter"]; | |
[filter setValue: [NSNumber numberWithFloat: 0.0] | |
forKey: @"inputAmount"]; | |
// [filter setValue: [NSNumber numberWithFloat: 90.0] forKey: @"inputAngle"]; | |
[filter setName: @"zoomBlur"]; | |
[self.title setFilters: [NSArray arrayWithObject: filter]]; | |
CABasicAnimation* pulseAnimation = [CABasicAnimation animation]; | |
pulseAnimation.keyPath = @"filters.zoomBlur.inputAmount"; | |
pulseAnimation.fromValue = [NSNumber numberWithFloat: 30.0]; | |
pulseAnimation.toValue = [NSNumber numberWithFloat: 0.0]; | |
pulseAnimation.duration = 1.0; | |
pulseAnimation.repeatCount = 0; | |
pulseAnimation.autoreverses = NO; | |
// pulseAnimation.repeatCount = 1e100f; | |
// pulseAnimation.autoreverses = YES; | |
pulseAnimation.timingFunction = [CAMediaTimingFunction functionWithName: | |
kCAMediaTimingFunctionEaseIn]; | |
// pulseAnimation.delegate = self; | |
[self.title addAnimation:pulseAnimation forKey:@"pulseAnimation"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment