Created
January 15, 2014 21:24
-
-
Save mbaranowski/8444983 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
UIMotionEffectGroup* effectGroup = [[UIMotionEffectGroup alloc] init]; | |
UIInterpolatingMotionEffect* horizontalParallax = | |
[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center" | |
type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; | |
UIInterpolatingMotionEffect* verticalParallax = | |
[[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center" | |
type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; | |
CGFloat offset = 50; | |
horizontalParallax.minimumRelativeValue = [NSValue valueWithCGPoint:CGPointMake(-offset, 0)]; | |
horizontalParallax.maximumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( offset, 0)]; | |
verticalParallax.minimumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( 0, -offset)]; | |
verticalParallax.maximumRelativeValue = [NSValue valueWithCGPoint:CGPointMake( 0, offset)]; | |
effectGroup.motionEffects = @[horizontalParallax, verticalParallax]; | |
[self.blurredBackgroundView addMotionEffect:effectGroup]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment