├── .gitignore ├── Classes ├── NGAParallaxMotion.h └── NGAParallaxMotion.m ├── Examples ├── NGAParallaxMotion Demo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── NGAParallaxMotion Demo │ ├── Base.lproj │ │ └── Main_iPhone.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── NGAAppDelegate.h │ ├── NGAAppDelegate.m │ ├── NGAParallaxMotion Demo-Info.plist │ ├── NGAParallaxMotion Demo-Prefix.pch │ ├── NGAViewController.h │ ├── NGAViewController.m │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m └── NGAParallaxMotion DemoTests │ ├── NGAParallaxMotion DemoTests-Info.plist │ ├── NGAParallaxMotion_DemoTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── NGAParallaxMotion.podspec ├── README.md └── img ├── InterfaceBuilderExample.png ├── off.png └── on.png /.gitignore: -------------------------------------------------------------------------------- 1 | **/*.xcuserdatad/ 2 | **/*.xccheckout -------------------------------------------------------------------------------- /Classes/NGAParallaxMotion.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+ParallaxMotion.h 3 | // 4 | // Created by Michael Bishop on 7/4/13. 5 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | 11 | typedef NS_ENUM(NSInteger, NGAParallaxDirectionConstraint) { 12 | NGAParallaxDirectionConstraintAll = 0, 13 | NGAParallaxDirectionConstraintHorizontal, 14 | NGAParallaxDirectionConstraintVertical 15 | }; 16 | 17 | 18 | @interface UIView (NGAParallaxMotion) 19 | 20 | // Positive values make the view appear to be above the surface 21 | // Negative values are below. 22 | // The unit is in points 23 | @property (nonatomic) CGFloat parallaxIntensity; 24 | 25 | // When filled up, will restrict the parallax to a certain direction only 26 | // Default to NGAParallaxDirectionConstraintAll 27 | @property (nonatomic) NGAParallaxDirectionConstraint parallaxDirectionConstraint; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Classes/NGAParallaxMotion.m: -------------------------------------------------------------------------------- 1 | // 2 | // NGAParallaxMotion.m 3 | // 4 | // Created by Michael Bishop on 7/4/13. 5 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 6 | // 7 | 8 | #import "NGAParallaxMotion.h" 9 | #import 10 | 11 | static void * const kNGAParallaxDepthKey = (void*)&kNGAParallaxDepthKey; 12 | static void * const kNGAParallaxDirectionConstraintKey = (void*)&kNGAParallaxDirectionConstraintKey; 13 | static void * const kNGAParallaxMotionEffectGroupKey = (void*)&kNGAParallaxMotionEffectGroupKey; 14 | 15 | @implementation UIView (NGAParallaxMotion) 16 | 17 | #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 18 | #warning DISABLED WITHOUT IOS7 SDK 19 | #endif 20 | 21 | -(void)setParallaxIntensity:(CGFloat)parallaxDepth 22 | { 23 | 24 | if (self.parallaxIntensity == parallaxDepth) 25 | return; 26 | 27 | objc_setAssociatedObject(self, kNGAParallaxDepthKey, @(parallaxDepth), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 28 | 29 | [self updateParallaxIntensityAndDirection]; 30 | } 31 | 32 | 33 | - (void)setParallaxDirectionConstraint:(NGAParallaxDirectionConstraint)parallaxConstraint{ 34 | 35 | objc_setAssociatedObject(self, kNGAParallaxDirectionConstraintKey, @(parallaxConstraint), OBJC_ASSOCIATION_RETAIN_NONATOMIC); 36 | 37 | [self updateParallaxIntensityAndDirection]; 38 | } 39 | 40 | 41 | -(void)updateParallaxIntensityAndDirection{ 42 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 43 | 44 | CGFloat parallaxDepth = self.parallaxIntensity; 45 | NGAParallaxDirectionConstraint direction = self.parallaxDirectionConstraint; 46 | 47 | // skip this part if pre-iOS7 48 | if (![UIInterpolatingMotionEffect class]) 49 | return; 50 | 51 | if (parallaxDepth == 0.0) 52 | { 53 | [self removeMotionEffect:[self nga_parallaxMotionEffectGroup]]; 54 | [self nga_setParallaxMotionEffectGroup:nil]; 55 | return; 56 | } 57 | 58 | UIMotionEffectGroup * parallaxGroup = [self nga_parallaxMotionEffectGroup]; 59 | if (!parallaxGroup) 60 | { 61 | parallaxGroup = [[UIMotionEffectGroup alloc] init]; 62 | [self nga_setParallaxMotionEffectGroup:parallaxGroup]; 63 | [self addMotionEffect:parallaxGroup]; 64 | } 65 | 66 | UIInterpolatingMotionEffect *xAxis = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis]; 67 | UIInterpolatingMotionEffect *yAxis = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis]; 68 | 69 | NSArray * motionEffects; 70 | if (direction == NGAParallaxDirectionConstraintVertical){ 71 | motionEffects = @[yAxis]; 72 | } else if (direction == NGAParallaxDirectionConstraintHorizontal){ 73 | motionEffects = @[xAxis]; 74 | } else{ 75 | motionEffects = @[xAxis, yAxis]; 76 | } 77 | 78 | for (UIInterpolatingMotionEffect * motionEffect in motionEffects ) 79 | { 80 | motionEffect.maximumRelativeValue = @(parallaxDepth); 81 | motionEffect.minimumRelativeValue = @(-parallaxDepth); 82 | } 83 | parallaxGroup.motionEffects = motionEffects; 84 | #endif 85 | } 86 | 87 | -(CGFloat)parallaxIntensity 88 | { 89 | NSNumber * val = objc_getAssociatedObject(self, kNGAParallaxDepthKey); 90 | if (!val) 91 | return 0.0; 92 | return val.doubleValue; 93 | } 94 | 95 | - (NGAParallaxDirectionConstraint)parallaxDirectionConstraint{ 96 | NSNumber *val = objc_getAssociatedObject(self, kNGAParallaxDirectionConstraintKey); 97 | if (!val) 98 | return NGAParallaxDirectionConstraintAll; 99 | return val.integerValue; 100 | } 101 | 102 | #pragma mark - 103 | 104 | #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 105 | 106 | -(UIMotionEffectGroup*)nga_parallaxMotionEffectGroup 107 | { 108 | return objc_getAssociatedObject(self, kNGAParallaxMotionEffectGroupKey); 109 | } 110 | 111 | -(void)nga_setParallaxMotionEffectGroup:(UIMotionEffectGroup*)group 112 | { 113 | objc_setAssociatedObject(self, kNGAParallaxMotionEffectGroupKey, group, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 114 | NSAssert( group == objc_getAssociatedObject(self, kNGAParallaxMotionEffectGroupKey), @"set didn't work" ); 115 | } 116 | #endif 117 | 118 | @end 119 | 120 | 121 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AA33B3BD17864DAB0009E5C3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3BC17864DAB0009E5C3 /* Foundation.framework */; }; 11 | AA33B3BF17864DAB0009E5C3 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3BE17864DAB0009E5C3 /* CoreGraphics.framework */; }; 12 | AA33B3C117864DAB0009E5C3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3C017864DAB0009E5C3 /* UIKit.framework */; }; 13 | AA33B3C717864DAB0009E5C3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AA33B3C517864DAB0009E5C3 /* InfoPlist.strings */; }; 14 | AA33B3C917864DAB0009E5C3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AA33B3C817864DAB0009E5C3 /* main.m */; }; 15 | AA33B3CD17864DAB0009E5C3 /* NGAAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AA33B3CC17864DAB0009E5C3 /* NGAAppDelegate.m */; }; 16 | AA33B3D017864DAB0009E5C3 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA33B3CE17864DAB0009E5C3 /* Main_iPhone.storyboard */; }; 17 | AA33B3D617864DAB0009E5C3 /* NGAViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AA33B3D517864DAB0009E5C3 /* NGAViewController.m */; }; 18 | AA33B3D817864DAB0009E5C3 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA33B3D717864DAB0009E5C3 /* Images.xcassets */; }; 19 | AA33B3DF17864DAB0009E5C3 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3DE17864DAB0009E5C3 /* XCTest.framework */; }; 20 | AA33B3E017864DAB0009E5C3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3BC17864DAB0009E5C3 /* Foundation.framework */; }; 21 | AA33B3E117864DAB0009E5C3 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AA33B3C017864DAB0009E5C3 /* UIKit.framework */; }; 22 | AA33B3E917864DAB0009E5C3 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = AA33B3E717864DAB0009E5C3 /* InfoPlist.strings */; }; 23 | AA33B3EB17864DAB0009E5C3 /* NGAParallaxMotion_DemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA33B3EA17864DAB0009E5C3 /* NGAParallaxMotion_DemoTests.m */; }; 24 | AA5B402417EFDA9C00FAEACF /* NGAParallaxMotion.m in Sources */ = {isa = PBXBuildFile; fileRef = AA5B402317EFDA9C00FAEACF /* NGAParallaxMotion.m */; }; 25 | AA5B402517EFDA9C00FAEACF /* NGAParallaxMotion.m in Sources */ = {isa = PBXBuildFile; fileRef = AA5B402317EFDA9C00FAEACF /* NGAParallaxMotion.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | AA33B3E217864DAB0009E5C3 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = AA33B3B117864DAB0009E5C3 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = AA33B3B817864DAB0009E5C3; 34 | remoteInfo = "NGAParallaxMotion Demo"; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | AA33B3B917864DAB0009E5C3 /* NGAParallaxMotion Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "NGAParallaxMotion Demo.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | AA33B3BC17864DAB0009E5C3 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | AA33B3BE17864DAB0009E5C3 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | AA33B3C017864DAB0009E5C3 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | AA33B3C417864DAB0009E5C3 /* NGAParallaxMotion Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "NGAParallaxMotion Demo-Info.plist"; sourceTree = ""; }; 44 | AA33B3C617864DAB0009E5C3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | AA33B3C817864DAB0009E5C3 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | AA33B3CA17864DAB0009E5C3 /* NGAParallaxMotion Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NGAParallaxMotion Demo-Prefix.pch"; sourceTree = ""; }; 47 | AA33B3CB17864DAB0009E5C3 /* NGAAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NGAAppDelegate.h; sourceTree = ""; }; 48 | AA33B3CC17864DAB0009E5C3 /* NGAAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NGAAppDelegate.m; sourceTree = ""; }; 49 | AA33B3CF17864DAB0009E5C3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; 50 | AA33B3D417864DAB0009E5C3 /* NGAViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NGAViewController.h; sourceTree = ""; }; 51 | AA33B3D517864DAB0009E5C3 /* NGAViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NGAViewController.m; sourceTree = ""; }; 52 | AA33B3D717864DAB0009E5C3 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | AA33B3DD17864DAB0009E5C3 /* NGAParallaxMotion DemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "NGAParallaxMotion DemoTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | AA33B3DE17864DAB0009E5C3 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 55 | AA33B3E617864DAB0009E5C3 /* NGAParallaxMotion DemoTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "NGAParallaxMotion DemoTests-Info.plist"; sourceTree = ""; }; 56 | AA33B3E817864DAB0009E5C3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 57 | AA33B3EA17864DAB0009E5C3 /* NGAParallaxMotion_DemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NGAParallaxMotion_DemoTests.m; sourceTree = ""; }; 58 | AA5B402217EFDA9C00FAEACF /* NGAParallaxMotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NGAParallaxMotion.h; sourceTree = ""; }; 59 | AA5B402317EFDA9C00FAEACF /* NGAParallaxMotion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NGAParallaxMotion.m; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | AA33B3B617864DAB0009E5C3 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | AA33B3BF17864DAB0009E5C3 /* CoreGraphics.framework in Frameworks */, 68 | AA33B3C117864DAB0009E5C3 /* UIKit.framework in Frameworks */, 69 | AA33B3BD17864DAB0009E5C3 /* Foundation.framework in Frameworks */, 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | AA33B3DA17864DAB0009E5C3 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | AA33B3DF17864DAB0009E5C3 /* XCTest.framework in Frameworks */, 78 | AA33B3E117864DAB0009E5C3 /* UIKit.framework in Frameworks */, 79 | AA33B3E017864DAB0009E5C3 /* Foundation.framework in Frameworks */, 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | AA33B3B017864DAB0009E5C3 = { 87 | isa = PBXGroup; 88 | children = ( 89 | AA5B402117EFDA9C00FAEACF /* Classes */, 90 | AA33B3C217864DAB0009E5C3 /* App */, 91 | AA33B3E417864DAB0009E5C3 /* NGAParallaxMotion DemoTests */, 92 | AA33B3BB17864DAB0009E5C3 /* Frameworks */, 93 | AA33B3BA17864DAB0009E5C3 /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | AA33B3BA17864DAB0009E5C3 /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | AA33B3B917864DAB0009E5C3 /* NGAParallaxMotion Demo.app */, 101 | AA33B3DD17864DAB0009E5C3 /* NGAParallaxMotion DemoTests.xctest */, 102 | ); 103 | name = Products; 104 | sourceTree = ""; 105 | }; 106 | AA33B3BB17864DAB0009E5C3 /* Frameworks */ = { 107 | isa = PBXGroup; 108 | children = ( 109 | AA33B3BC17864DAB0009E5C3 /* Foundation.framework */, 110 | AA33B3BE17864DAB0009E5C3 /* CoreGraphics.framework */, 111 | AA33B3C017864DAB0009E5C3 /* UIKit.framework */, 112 | AA33B3DE17864DAB0009E5C3 /* XCTest.framework */, 113 | ); 114 | name = Frameworks; 115 | sourceTree = ""; 116 | }; 117 | AA33B3C217864DAB0009E5C3 /* App */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | AA33B3CB17864DAB0009E5C3 /* NGAAppDelegate.h */, 121 | AA33B3CC17864DAB0009E5C3 /* NGAAppDelegate.m */, 122 | AA33B3CE17864DAB0009E5C3 /* Main_iPhone.storyboard */, 123 | AA33B3D417864DAB0009E5C3 /* NGAViewController.h */, 124 | AA33B3D517864DAB0009E5C3 /* NGAViewController.m */, 125 | AA33B3D717864DAB0009E5C3 /* Images.xcassets */, 126 | AA33B3C317864DAB0009E5C3 /* Supporting Files */, 127 | ); 128 | name = App; 129 | path = "NGAParallaxMotion Demo"; 130 | sourceTree = ""; 131 | }; 132 | AA33B3C317864DAB0009E5C3 /* Supporting Files */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | AA33B3C417864DAB0009E5C3 /* NGAParallaxMotion Demo-Info.plist */, 136 | AA33B3C517864DAB0009E5C3 /* InfoPlist.strings */, 137 | AA33B3C817864DAB0009E5C3 /* main.m */, 138 | AA33B3CA17864DAB0009E5C3 /* NGAParallaxMotion Demo-Prefix.pch */, 139 | ); 140 | name = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | AA33B3E417864DAB0009E5C3 /* NGAParallaxMotion DemoTests */ = { 144 | isa = PBXGroup; 145 | children = ( 146 | AA33B3EA17864DAB0009E5C3 /* NGAParallaxMotion_DemoTests.m */, 147 | AA33B3E517864DAB0009E5C3 /* Supporting Files */, 148 | ); 149 | path = "NGAParallaxMotion DemoTests"; 150 | sourceTree = ""; 151 | }; 152 | AA33B3E517864DAB0009E5C3 /* Supporting Files */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | AA33B3E617864DAB0009E5C3 /* NGAParallaxMotion DemoTests-Info.plist */, 156 | AA33B3E717864DAB0009E5C3 /* InfoPlist.strings */, 157 | ); 158 | name = "Supporting Files"; 159 | sourceTree = ""; 160 | }; 161 | AA5B402117EFDA9C00FAEACF /* Classes */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | AA5B402217EFDA9C00FAEACF /* NGAParallaxMotion.h */, 165 | AA5B402317EFDA9C00FAEACF /* NGAParallaxMotion.m */, 166 | ); 167 | name = Classes; 168 | path = ../Classes; 169 | sourceTree = ""; 170 | }; 171 | /* End PBXGroup section */ 172 | 173 | /* Begin PBXNativeTarget section */ 174 | AA33B3B817864DAB0009E5C3 /* NGAParallaxMotion Demo */ = { 175 | isa = PBXNativeTarget; 176 | buildConfigurationList = AA33B3EE17864DAB0009E5C3 /* Build configuration list for PBXNativeTarget "NGAParallaxMotion Demo" */; 177 | buildPhases = ( 178 | AA33B3B517864DAB0009E5C3 /* Sources */, 179 | AA33B3B617864DAB0009E5C3 /* Frameworks */, 180 | AA33B3B717864DAB0009E5C3 /* Resources */, 181 | ); 182 | buildRules = ( 183 | ); 184 | dependencies = ( 185 | ); 186 | name = "NGAParallaxMotion Demo"; 187 | productName = "NGAParallaxMotion Demo"; 188 | productReference = AA33B3B917864DAB0009E5C3 /* NGAParallaxMotion Demo.app */; 189 | productType = "com.apple.product-type.application"; 190 | }; 191 | AA33B3DC17864DAB0009E5C3 /* NGAParallaxMotion DemoTests */ = { 192 | isa = PBXNativeTarget; 193 | buildConfigurationList = AA33B3F117864DAB0009E5C3 /* Build configuration list for PBXNativeTarget "NGAParallaxMotion DemoTests" */; 194 | buildPhases = ( 195 | AA33B3D917864DAB0009E5C3 /* Sources */, 196 | AA33B3DA17864DAB0009E5C3 /* Frameworks */, 197 | AA33B3DB17864DAB0009E5C3 /* Resources */, 198 | ); 199 | buildRules = ( 200 | ); 201 | dependencies = ( 202 | AA33B3E317864DAB0009E5C3 /* PBXTargetDependency */, 203 | ); 204 | name = "NGAParallaxMotion DemoTests"; 205 | productName = "NGAParallaxMotion DemoTests"; 206 | productReference = AA33B3DD17864DAB0009E5C3 /* NGAParallaxMotion DemoTests.xctest */; 207 | productType = "com.apple.product-type.bundle.unit-test"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | AA33B3B117864DAB0009E5C3 /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | CLASSPREFIX = NGA; 216 | LastUpgradeCheck = 0500; 217 | ORGANIZATIONNAME = "Numerical Garden"; 218 | TargetAttributes = { 219 | AA33B3DC17864DAB0009E5C3 = { 220 | TestTargetID = AA33B3B817864DAB0009E5C3; 221 | }; 222 | }; 223 | }; 224 | buildConfigurationList = AA33B3B417864DAB0009E5C3 /* Build configuration list for PBXProject "NGAParallaxMotion Demo" */; 225 | compatibilityVersion = "Xcode 3.2"; 226 | developmentRegion = English; 227 | hasScannedForEncodings = 0; 228 | knownRegions = ( 229 | en, 230 | Base, 231 | ); 232 | mainGroup = AA33B3B017864DAB0009E5C3; 233 | productRefGroup = AA33B3BA17864DAB0009E5C3 /* Products */; 234 | projectDirPath = ""; 235 | projectRoot = ""; 236 | targets = ( 237 | AA33B3B817864DAB0009E5C3 /* NGAParallaxMotion Demo */, 238 | AA33B3DC17864DAB0009E5C3 /* NGAParallaxMotion DemoTests */, 239 | ); 240 | }; 241 | /* End PBXProject section */ 242 | 243 | /* Begin PBXResourcesBuildPhase section */ 244 | AA33B3B717864DAB0009E5C3 /* Resources */ = { 245 | isa = PBXResourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | AA33B3D817864DAB0009E5C3 /* Images.xcassets in Resources */, 249 | AA33B3D017864DAB0009E5C3 /* Main_iPhone.storyboard in Resources */, 250 | AA33B3C717864DAB0009E5C3 /* InfoPlist.strings in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | AA33B3DB17864DAB0009E5C3 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | AA33B3E917864DAB0009E5C3 /* InfoPlist.strings in Resources */, 259 | ); 260 | runOnlyForDeploymentPostprocessing = 0; 261 | }; 262 | /* End PBXResourcesBuildPhase section */ 263 | 264 | /* Begin PBXSourcesBuildPhase section */ 265 | AA33B3B517864DAB0009E5C3 /* Sources */ = { 266 | isa = PBXSourcesBuildPhase; 267 | buildActionMask = 2147483647; 268 | files = ( 269 | AA33B3C917864DAB0009E5C3 /* main.m in Sources */, 270 | AA33B3D617864DAB0009E5C3 /* NGAViewController.m in Sources */, 271 | AA33B3CD17864DAB0009E5C3 /* NGAAppDelegate.m in Sources */, 272 | AA5B402417EFDA9C00FAEACF /* NGAParallaxMotion.m in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | AA33B3D917864DAB0009E5C3 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | AA33B3EB17864DAB0009E5C3 /* NGAParallaxMotion_DemoTests.m in Sources */, 281 | AA5B402517EFDA9C00FAEACF /* NGAParallaxMotion.m in Sources */, 282 | ); 283 | runOnlyForDeploymentPostprocessing = 0; 284 | }; 285 | /* End PBXSourcesBuildPhase section */ 286 | 287 | /* Begin PBXTargetDependency section */ 288 | AA33B3E317864DAB0009E5C3 /* PBXTargetDependency */ = { 289 | isa = PBXTargetDependency; 290 | target = AA33B3B817864DAB0009E5C3 /* NGAParallaxMotion Demo */; 291 | targetProxy = AA33B3E217864DAB0009E5C3 /* PBXContainerItemProxy */; 292 | }; 293 | /* End PBXTargetDependency section */ 294 | 295 | /* Begin PBXVariantGroup section */ 296 | AA33B3C517864DAB0009E5C3 /* InfoPlist.strings */ = { 297 | isa = PBXVariantGroup; 298 | children = ( 299 | AA33B3C617864DAB0009E5C3 /* en */, 300 | ); 301 | name = InfoPlist.strings; 302 | sourceTree = ""; 303 | }; 304 | AA33B3CE17864DAB0009E5C3 /* Main_iPhone.storyboard */ = { 305 | isa = PBXVariantGroup; 306 | children = ( 307 | AA33B3CF17864DAB0009E5C3 /* Base */, 308 | ); 309 | name = Main_iPhone.storyboard; 310 | sourceTree = ""; 311 | }; 312 | AA33B3E717864DAB0009E5C3 /* InfoPlist.strings */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | AA33B3E817864DAB0009E5C3 /* en */, 316 | ); 317 | name = InfoPlist.strings; 318 | sourceTree = ""; 319 | }; 320 | /* End PBXVariantGroup section */ 321 | 322 | /* Begin XCBuildConfiguration section */ 323 | AA33B3EC17864DAB0009E5C3 /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = YES; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_EMPTY_BODY = YES; 335 | CLANG_WARN_ENUM_CONVERSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | GCC_C_LANGUAGE_STANDARD = gnu99; 342 | GCC_DYNAMIC_NO_PIC = NO; 343 | GCC_OPTIMIZATION_LEVEL = 0; 344 | GCC_PREPROCESSOR_DEFINITIONS = ( 345 | "DEBUG=1", 346 | "$(inherited)", 347 | ); 348 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 349 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 350 | GCC_WARN_UNDECLARED_SELECTOR = YES; 351 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 352 | GCC_WARN_UNUSED_FUNCTION = YES; 353 | GCC_WARN_UNUSED_VARIABLE = YES; 354 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 355 | ONLY_ACTIVE_ARCH = YES; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Debug; 360 | }; 361 | AA33B3ED17864DAB0009E5C3 /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ALWAYS_SEARCH_USER_PATHS = NO; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BOOL_CONVERSION = YES; 370 | CLANG_WARN_CONSTANT_CONVERSION = YES; 371 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 372 | CLANG_WARN_EMPTY_BODY = YES; 373 | CLANG_WARN_ENUM_CONVERSION = YES; 374 | CLANG_WARN_INT_CONVERSION = YES; 375 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 376 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 377 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 378 | COPY_PHASE_STRIP = YES; 379 | ENABLE_NS_ASSERTIONS = NO; 380 | GCC_C_LANGUAGE_STANDARD = gnu99; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 6.0; 387 | SDKROOT = iphoneos; 388 | TARGETED_DEVICE_FAMILY = "1,2"; 389 | VALIDATE_PRODUCT = YES; 390 | }; 391 | name = Release; 392 | }; 393 | AA33B3EF17864DAB0009E5C3 /* Debug */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 397 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 398 | CODE_SIGN_IDENTITY = "iPhone Developer"; 399 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 400 | GCC_PREFIX_HEADER = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Prefix.pch"; 401 | INFOPLIST_FILE = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Info.plist"; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | TARGETED_DEVICE_FAMILY = 1; 404 | WRAPPER_EXTENSION = app; 405 | }; 406 | name = Debug; 407 | }; 408 | AA33B3F017864DAB0009E5C3 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 412 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 413 | CODE_SIGN_IDENTITY = "iPhone Developer"; 414 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 415 | GCC_PREFIX_HEADER = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Prefix.pch"; 416 | INFOPLIST_FILE = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Info.plist"; 417 | PRODUCT_NAME = "$(TARGET_NAME)"; 418 | TARGETED_DEVICE_FAMILY = 1; 419 | WRAPPER_EXTENSION = app; 420 | }; 421 | name = Release; 422 | }; 423 | AA33B3F217864DAB0009E5C3 /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/NGAParallaxMotion Demo.app/NGAParallaxMotion Demo"; 427 | FRAMEWORK_SEARCH_PATHS = ( 428 | "$(SDKROOT)/Developer/Library/Frameworks", 429 | "$(inherited)", 430 | "$(SYSTEM_APPS_DIR)/Xcode5-DP2.app/Contents/Developer/Library/Frameworks", 431 | ); 432 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 433 | GCC_PREFIX_HEADER = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Prefix.pch"; 434 | GCC_PREPROCESSOR_DEFINITIONS = ( 435 | "DEBUG=1", 436 | "$(inherited)", 437 | ); 438 | INFOPLIST_FILE = "NGAParallaxMotion DemoTests/NGAParallaxMotion DemoTests-Info.plist"; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | TEST_HOST = "$(BUNDLE_LOADER)"; 441 | WRAPPER_EXTENSION = xctest; 442 | }; 443 | name = Debug; 444 | }; 445 | AA33B3F317864DAB0009E5C3 /* Release */ = { 446 | isa = XCBuildConfiguration; 447 | buildSettings = { 448 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/NGAParallaxMotion Demo.app/NGAParallaxMotion Demo"; 449 | FRAMEWORK_SEARCH_PATHS = ( 450 | "$(SDKROOT)/Developer/Library/Frameworks", 451 | "$(inherited)", 452 | "$(SYSTEM_APPS_DIR)/Xcode5-DP2.app/Contents/Developer/Library/Frameworks", 453 | ); 454 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 455 | GCC_PREFIX_HEADER = "NGAParallaxMotion Demo/NGAParallaxMotion Demo-Prefix.pch"; 456 | INFOPLIST_FILE = "NGAParallaxMotion DemoTests/NGAParallaxMotion DemoTests-Info.plist"; 457 | PRODUCT_NAME = "$(TARGET_NAME)"; 458 | TEST_HOST = "$(BUNDLE_LOADER)"; 459 | WRAPPER_EXTENSION = xctest; 460 | }; 461 | name = Release; 462 | }; 463 | /* End XCBuildConfiguration section */ 464 | 465 | /* Begin XCConfigurationList section */ 466 | AA33B3B417864DAB0009E5C3 /* Build configuration list for PBXProject "NGAParallaxMotion Demo" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | AA33B3EC17864DAB0009E5C3 /* Debug */, 470 | AA33B3ED17864DAB0009E5C3 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | AA33B3EE17864DAB0009E5C3 /* Build configuration list for PBXNativeTarget "NGAParallaxMotion Demo" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | AA33B3EF17864DAB0009E5C3 /* Debug */, 479 | AA33B3F017864DAB0009E5C3 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | AA33B3F117864DAB0009E5C3 /* Build configuration list for PBXNativeTarget "NGAParallaxMotion DemoTests" */ = { 485 | isa = XCConfigurationList; 486 | buildConfigurations = ( 487 | AA33B3F217864DAB0009E5C3 /* Debug */, 488 | AA33B3F317864DAB0009E5C3 /* Release */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | /* End XCConfigurationList section */ 494 | }; 495 | rootObject = AA33B3B117864DAB0009E5C3 /* Project object */; 496 | } 497 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 27 | 32 | 37 | 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "60x60", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "ipad", 15 | "size" : "29x29", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "50x50", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "50x50", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "72x72", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "72x72", 41 | "scale" : "2x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // NGAAppDelegate.h 3 | // NGAParallaxMotion Demo 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NGAAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NGAAppDelegate.m 3 | // NGAParallaxMotion Demo 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import "NGAAppDelegate.h" 10 | 11 | @implementation NGAAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAParallaxMotion Demo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.numerical-garden.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAParallaxMotion Demo-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // NGAViewController.h 3 | // NGAParallaxMotion Demo 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NGAViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/NGAViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // NGAViewController.m 3 | // NGAParallaxMotion Demo 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import "NGAViewController.h" 10 | #import "NGAParallaxMotion.h" 11 | 12 | @interface NGAViewController () 13 | 14 | @property (strong, nonatomic) IBOutlet UISwitch *parallaxSwitch; 15 | @property (strong, nonatomic) IBOutlet UISegmentedControl *parallaxConstraintControl; 16 | @property (strong, nonatomic) IBOutlet UILabel *midLabel; 17 | @property (strong, nonatomic) NSArray * labels; 18 | @end 19 | 20 | @implementation NGAViewController 21 | 22 | - (void)viewDidLoad 23 | { 24 | [super viewDidLoad]; 25 | 26 | // Do any additional setup after loading the view, typically from a nib. 27 | 28 | NSMutableArray * labels = [NSMutableArray new]; 29 | for (UIView * view in self.view.subviews) 30 | { 31 | if ([view isKindOfClass:[UILabel class]]) 32 | [labels addObject:view]; 33 | } 34 | self.labels = labels; 35 | self.parallaxConstraintControl.enabled = self.parallaxSwitch.isOn; 36 | } 37 | 38 | - (void)didReceiveMemoryWarning 39 | { 40 | [super didReceiveMemoryWarning]; 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | -(IBAction)toggleParallax:(id)sender 45 | { 46 | UISwitch * uisswitch = (UISwitch*)sender; 47 | if (uisswitch.isOn) 48 | { 49 | self.parallaxConstraintControl.enabled = YES; 50 | CGFloat baseFontSize = self.midLabel.font.pointSize; 51 | for (UILabel * label in self.labels) 52 | { 53 | label.parallaxIntensity = label.font.pointSize - baseFontSize; 54 | label.parallaxDirectionConstraint = self.parallaxConstraintControl.selectedSegmentIndex; 55 | } 56 | } 57 | else 58 | { 59 | self.parallaxConstraintControl.enabled = NO; 60 | for (UILabel * label in self.labels) 61 | { 62 | label.parallaxIntensity = 0.0; 63 | } 64 | } 65 | } 66 | 67 | -(IBAction)setConstraintFromSender:(id)sender 68 | { 69 | UISegmentedControl * control = (UISegmentedControl*)sender; 70 | for (UILabel * label in self.labels) 71 | { 72 | label.parallaxDirectionConstraint = control.selectedSegmentIndex; 73 | } 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NGAParallaxMotion Demo 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "NGAAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([NGAAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion DemoTests/NGAParallaxMotion DemoTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.numerical-garden.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion DemoTests/NGAParallaxMotion_DemoTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // NGAParallaxMotion_DemoTests.m 3 | // NGAParallaxMotion DemoTests 4 | // 5 | // Created by Michael Bishop on 7/4/13. 6 | // Copyright (c) 2013 Numerical Garden. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NGAParallaxMotion_DemoTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation NGAParallaxMotion_DemoTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | 21 | // Set-up code here. 22 | } 23 | 24 | - (void)tearDown 25 | { 26 | // Tear-down code here. 27 | 28 | [super tearDown]; 29 | } 30 | 31 | - (void)testExample 32 | { 33 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 34 | } 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Examples/NGAParallaxMotion DemoTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Michael Bishop 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /NGAParallaxMotion.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'NGAParallaxMotion' 3 | s.version = '1.1.0' 4 | s.license = { :type => 'MIT', :file => 'LICENSE' } 5 | s.summary = 'UIView category that makes it trivial to add a parallax effect.' 6 | s.author = { 'Michael Bishop' => 'http://numerical-garden.com/' } 7 | s.source = { :git => 'https://github.com/michaeljbishop/NGAParallaxMotion.git', :tag => '1.1.0' } 8 | s.homepage = 'http://github.com/michaeljbishop/NGAParallaxMotion' 9 | s.platform = :ios 10 | s.framework = 'UIKit' 11 | s.source_files = 'Classes' 12 | s.requires_arc = true 13 | end 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | NGAParallaxMotion 2 | ================= 3 | 4 | A tiny category on UIView that allows you to set one property: `parallaxIntensity` to achieve 5 | a parallax effect with `UIMotionEffect`. 6 | 7 | Show the parallax effect in one line 8 | ------------- 9 | ```Objective-C 10 | theView.parallaxIntensity = 10; 11 | ``` 12 | Positive values make the view appear to extend from the screen. Negative values 13 | make the view appear to recess behind the screen. 14 | 15 | Interface Builder 16 | ----------------- 17 | 18 | Additionally, you can set this property within Interface Builder by editing the "User 19 | Defined Runtime Attributes" and adding: 20 | 21 | KeyPath | Type | Value 22 | ---------------------------------------------- 23 | parallaxIntensity | Number | your depth value 24 | 25 | 26 | 27 | ![Interface Builder](img/InterfaceBuilderExample.png "Interface Builder Example") 28 | 29 | 30 | Examples 31 | -------- 32 | 33 | ### On 34 | 35 | ![](img/on.png) 36 | 37 | ### Off 38 | 39 | ![](img/off.png) 40 | 41 | 42 | License 43 | ------- 44 | This code is under the MIT license. 45 | 46 | 47 | Release Notes 48 | ------------- 49 | 50 | ### 1.1 51 | - Added new direction constraints (Thanks @arunaharsa!) 52 | 53 | ### 1.0 54 | - Initial Release 55 | -------------------------------------------------------------------------------- /img/InterfaceBuilderExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeljbishop/NGAParallaxMotion/bac140af35b37275c54b0cd548e25b6282581bd1/img/InterfaceBuilderExample.png -------------------------------------------------------------------------------- /img/off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeljbishop/NGAParallaxMotion/bac140af35b37275c54b0cd548e25b6282581bd1/img/off.png -------------------------------------------------------------------------------- /img/on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeljbishop/NGAParallaxMotion/bac140af35b37275c54b0cd548e25b6282581bd1/img/on.png --------------------------------------------------------------------------------