Skip to content

Instantly share code, notes, and snippets.

@madebyjeffrey
Created December 25, 2010 17:56
Show Gist options
  • Save madebyjeffrey/754971 to your computer and use it in GitHub Desktop.
Save madebyjeffrey/754971 to your computer and use it in GitHub Desktop.
Animated ZoomBlur
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