├── .gitignore ├── Fun with Masks.xcodeproj └── project.pbxproj ├── Fun with Masks ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── EWDAnimationExampleVC.h ├── EWDAnimationExampleVC.m ├── EWDAnimationExampleVC.xib ├── EWDAppDelegate.h ├── EWDAppDelegate.m ├── EWDBlurExampleVC.h ├── EWDBlurExampleVC.m ├── EWDBlurExampleVC.xib ├── EWDGradientExampleVC.h ├── EWDGradientExampleVC.m ├── EWDGradientExampleVC.xib ├── Fun with Masks-Info.plist ├── Fun with Masks-Prefix.pch ├── en.lproj │ └── InfoPlist.strings ├── first.png ├── first@2x.png ├── jerusalempano2.jpg ├── main.m ├── pw_maze_white.png ├── pw_maze_white_@2X.png ├── sample_profile_bg.jpg ├── second.png ├── second@2x.png └── telavivpano3.jpg └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | .DS_Store 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | *.xcworkspace 13 | !default.xcworkspace 14 | xcuserdata 15 | profile 16 | *.moved-aside 17 | DerivedData 18 | .idea/ 19 | -------------------------------------------------------------------------------- /Fun with Masks.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3501367C16C70B55006EF083 /* CoreImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3501367B16C70B55006EF083 /* CoreImage.framework */; }; 11 | 3501367E16C70F18006EF083 /* sample_profile_bg.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3501367D16C70F18006EF083 /* sample_profile_bg.jpg */; }; 12 | 357A112416C5E6B50045D888 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 357A112316C5E6B50045D888 /* UIKit.framework */; }; 13 | 357A112616C5E6B50045D888 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 357A112516C5E6B50045D888 /* Foundation.framework */; }; 14 | 357A112816C5E6B50045D888 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 357A112716C5E6B50045D888 /* CoreGraphics.framework */; }; 15 | 357A112E16C5E6B50045D888 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 357A112C16C5E6B50045D888 /* InfoPlist.strings */; }; 16 | 357A113016C5E6B50045D888 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 357A112F16C5E6B50045D888 /* main.m */; }; 17 | 357A113416C5E6B50045D888 /* EWDAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 357A113316C5E6B50045D888 /* EWDAppDelegate.m */; }; 18 | 357A113616C5E6B50045D888 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A113516C5E6B50045D888 /* Default.png */; }; 19 | 357A113816C5E6B50045D888 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A113716C5E6B50045D888 /* Default@2x.png */; }; 20 | 357A113A16C5E6B50045D888 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A113916C5E6B50045D888 /* Default-568h@2x.png */; }; 21 | 357A113D16C5E6B50045D888 /* EWDGradientExampleVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 357A113C16C5E6B50045D888 /* EWDGradientExampleVC.m */; }; 22 | 357A113F16C5E6B50045D888 /* first.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A113E16C5E6B50045D888 /* first.png */; }; 23 | 357A114116C5E6B50045D888 /* first@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A114016C5E6B50045D888 /* first@2x.png */; }; 24 | 357A114416C5E6B50045D888 /* EWDBlurExampleVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 357A114316C5E6B50045D888 /* EWDBlurExampleVC.m */; }; 25 | 357A114616C5E6B50045D888 /* second.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A114516C5E6B50045D888 /* second.png */; }; 26 | 357A114816C5E6B50045D888 /* second@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A114716C5E6B50045D888 /* second@2x.png */; }; 27 | 357A116016C5E7BC0045D888 /* EWDAnimationExampleVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 357A115E16C5E7BC0045D888 /* EWDAnimationExampleVC.m */; }; 28 | 357A116816C5FBAA0045D888 /* jerusalempano2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 357A116716C5FBAA0045D888 /* jerusalempano2.jpg */; }; 29 | 357A116A16C5FE940045D888 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 357A116916C5FE940045D888 /* QuartzCore.framework */; }; 30 | 357A116C16C609020045D888 /* pw_maze_white.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A116B16C609020045D888 /* pw_maze_white.png */; }; 31 | 357A116E16C6090A0045D888 /* pw_maze_white_@2X.png in Resources */ = {isa = PBXBuildFile; fileRef = 357A116D16C6090A0045D888 /* pw_maze_white_@2X.png */; }; 32 | 357A117016C60C8E0045D888 /* telavivpano3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 357A116F16C60C8D0045D888 /* telavivpano3.jpg */; }; 33 | 35B91C0216CA99F200E1A60D /* EWDAnimationExampleVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35B91C0116CA99F200E1A60D /* EWDAnimationExampleVC.xib */; }; 34 | 35B91C0416CA9A0600E1A60D /* EWDBlurExampleVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35B91C0316CA9A0600E1A60D /* EWDBlurExampleVC.xib */; }; 35 | 35B91C0616CA9A1900E1A60D /* EWDGradientExampleVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 35B91C0516CA9A1900E1A60D /* EWDGradientExampleVC.xib */; }; 36 | /* End PBXBuildFile section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 3501367B16C70B55006EF083 /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; }; 40 | 3501367D16C70F18006EF083 /* sample_profile_bg.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = sample_profile_bg.jpg; sourceTree = ""; }; 41 | 357A112016C5E6B50045D888 /* Fun with Masks.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Fun with Masks.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 357A112316C5E6B50045D888 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 357A112516C5E6B50045D888 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 44 | 357A112716C5E6B50045D888 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 45 | 357A112B16C5E6B50045D888 /* Fun with Masks-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Fun with Masks-Info.plist"; sourceTree = ""; }; 46 | 357A112D16C5E6B50045D888 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 47 | 357A112F16C5E6B50045D888 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 48 | 357A113116C5E6B50045D888 /* Fun with Masks-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Fun with Masks-Prefix.pch"; sourceTree = ""; }; 49 | 357A113216C5E6B50045D888 /* EWDAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EWDAppDelegate.h; sourceTree = ""; }; 50 | 357A113316C5E6B50045D888 /* EWDAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EWDAppDelegate.m; sourceTree = ""; }; 51 | 357A113516C5E6B50045D888 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 52 | 357A113716C5E6B50045D888 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 53 | 357A113916C5E6B50045D888 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 54 | 357A113B16C5E6B50045D888 /* EWDGradientExampleVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EWDGradientExampleVC.h; sourceTree = ""; }; 55 | 357A113C16C5E6B50045D888 /* EWDGradientExampleVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EWDGradientExampleVC.m; sourceTree = ""; }; 56 | 357A113E16C5E6B50045D888 /* first.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = first.png; sourceTree = ""; }; 57 | 357A114016C5E6B50045D888 /* first@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "first@2x.png"; sourceTree = ""; }; 58 | 357A114216C5E6B50045D888 /* EWDBlurExampleVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EWDBlurExampleVC.h; sourceTree = ""; }; 59 | 357A114316C5E6B50045D888 /* EWDBlurExampleVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EWDBlurExampleVC.m; sourceTree = ""; }; 60 | 357A114516C5E6B50045D888 /* second.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = second.png; sourceTree = ""; }; 61 | 357A114716C5E6B50045D888 /* second@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "second@2x.png"; sourceTree = ""; }; 62 | 357A115D16C5E7BC0045D888 /* EWDAnimationExampleVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EWDAnimationExampleVC.h; sourceTree = ""; }; 63 | 357A115E16C5E7BC0045D888 /* EWDAnimationExampleVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EWDAnimationExampleVC.m; sourceTree = ""; }; 64 | 357A116716C5FBAA0045D888 /* jerusalempano2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = jerusalempano2.jpg; sourceTree = ""; }; 65 | 357A116916C5FE940045D888 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 66 | 357A116B16C609020045D888 /* pw_maze_white.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pw_maze_white.png; sourceTree = ""; }; 67 | 357A116D16C6090A0045D888 /* pw_maze_white_@2X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pw_maze_white_@2X.png"; sourceTree = ""; }; 68 | 357A116F16C60C8D0045D888 /* telavivpano3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = telavivpano3.jpg; sourceTree = ""; }; 69 | 35B91C0116CA99F200E1A60D /* EWDAnimationExampleVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EWDAnimationExampleVC.xib; sourceTree = ""; }; 70 | 35B91C0316CA9A0600E1A60D /* EWDBlurExampleVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EWDBlurExampleVC.xib; sourceTree = ""; }; 71 | 35B91C0516CA9A1900E1A60D /* EWDGradientExampleVC.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EWDGradientExampleVC.xib; sourceTree = ""; }; 72 | /* End PBXFileReference section */ 73 | 74 | /* Begin PBXFrameworksBuildPhase section */ 75 | 357A111D16C5E6B50045D888 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 3501367C16C70B55006EF083 /* CoreImage.framework in Frameworks */, 80 | 357A116A16C5FE940045D888 /* QuartzCore.framework in Frameworks */, 81 | 357A112416C5E6B50045D888 /* UIKit.framework in Frameworks */, 82 | 357A112616C5E6B50045D888 /* Foundation.framework in Frameworks */, 83 | 357A112816C5E6B50045D888 /* CoreGraphics.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 357A111716C5E6B50045D888 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 357A112916C5E6B50045D888 /* Fun with Masks */, 94 | 357A112216C5E6B50045D888 /* Frameworks */, 95 | 357A112116C5E6B50045D888 /* Products */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | 357A112116C5E6B50045D888 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 357A112016C5E6B50045D888 /* Fun with Masks.app */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 357A112216C5E6B50045D888 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 3501367B16C70B55006EF083 /* CoreImage.framework */, 111 | 357A116916C5FE940045D888 /* QuartzCore.framework */, 112 | 357A112316C5E6B50045D888 /* UIKit.framework */, 113 | 357A112516C5E6B50045D888 /* Foundation.framework */, 114 | 357A112716C5E6B50045D888 /* CoreGraphics.framework */, 115 | ); 116 | name = Frameworks; 117 | sourceTree = ""; 118 | }; 119 | 357A112916C5E6B50045D888 /* Fun with Masks */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 357A113216C5E6B50045D888 /* EWDAppDelegate.h */, 123 | 357A113316C5E6B50045D888 /* EWDAppDelegate.m */, 124 | 357A115A16C5E75E0045D888 /* Gradient */, 125 | 357A115B16C5E7650045D888 /* Blur */, 126 | 357A115C16C5E7710045D888 /* Animation */, 127 | 357A116216C5F84D0045D888 /* Resources */, 128 | 357A112A16C5E6B50045D888 /* Supporting Files */, 129 | ); 130 | path = "Fun with Masks"; 131 | sourceTree = ""; 132 | }; 133 | 357A112A16C5E6B50045D888 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 357A112B16C5E6B50045D888 /* Fun with Masks-Info.plist */, 137 | 357A112C16C5E6B50045D888 /* InfoPlist.strings */, 138 | 357A112F16C5E6B50045D888 /* main.m */, 139 | 357A113116C5E6B50045D888 /* Fun with Masks-Prefix.pch */, 140 | 357A113516C5E6B50045D888 /* Default.png */, 141 | 357A113716C5E6B50045D888 /* Default@2x.png */, 142 | 357A113916C5E6B50045D888 /* Default-568h@2x.png */, 143 | ); 144 | name = "Supporting Files"; 145 | sourceTree = ""; 146 | }; 147 | 357A115A16C5E75E0045D888 /* Gradient */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 357A113B16C5E6B50045D888 /* EWDGradientExampleVC.h */, 151 | 357A113C16C5E6B50045D888 /* EWDGradientExampleVC.m */, 152 | 35B91C0516CA9A1900E1A60D /* EWDGradientExampleVC.xib */, 153 | 357A113E16C5E6B50045D888 /* first.png */, 154 | 357A114016C5E6B50045D888 /* first@2x.png */, 155 | ); 156 | name = Gradient; 157 | sourceTree = ""; 158 | }; 159 | 357A115B16C5E7650045D888 /* Blur */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 357A114216C5E6B50045D888 /* EWDBlurExampleVC.h */, 163 | 357A114316C5E6B50045D888 /* EWDBlurExampleVC.m */, 164 | 35B91C0316CA9A0600E1A60D /* EWDBlurExampleVC.xib */, 165 | 357A114516C5E6B50045D888 /* second.png */, 166 | 357A114716C5E6B50045D888 /* second@2x.png */, 167 | ); 168 | name = Blur; 169 | sourceTree = ""; 170 | }; 171 | 357A115C16C5E7710045D888 /* Animation */ = { 172 | isa = PBXGroup; 173 | children = ( 174 | 357A115D16C5E7BC0045D888 /* EWDAnimationExampleVC.h */, 175 | 357A115E16C5E7BC0045D888 /* EWDAnimationExampleVC.m */, 176 | 35B91C0116CA99F200E1A60D /* EWDAnimationExampleVC.xib */, 177 | ); 178 | name = Animation; 179 | sourceTree = ""; 180 | }; 181 | 357A116216C5F84D0045D888 /* Resources */ = { 182 | isa = PBXGroup; 183 | children = ( 184 | 357A116B16C609020045D888 /* pw_maze_white.png */, 185 | 357A116D16C6090A0045D888 /* pw_maze_white_@2X.png */, 186 | 357A116716C5FBAA0045D888 /* jerusalempano2.jpg */, 187 | 357A116F16C60C8D0045D888 /* telavivpano3.jpg */, 188 | 3501367D16C70F18006EF083 /* sample_profile_bg.jpg */, 189 | ); 190 | name = Resources; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXGroup section */ 194 | 195 | /* Begin PBXNativeTarget section */ 196 | 357A111F16C5E6B50045D888 /* Fun with Masks */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 357A115716C5E6B50045D888 /* Build configuration list for PBXNativeTarget "Fun with Masks" */; 199 | buildPhases = ( 200 | 357A111C16C5E6B50045D888 /* Sources */, 201 | 357A111D16C5E6B50045D888 /* Frameworks */, 202 | 357A111E16C5E6B50045D888 /* Resources */, 203 | ); 204 | buildRules = ( 205 | ); 206 | dependencies = ( 207 | ); 208 | name = "Fun with Masks"; 209 | productName = "Fun with Masks"; 210 | productReference = 357A112016C5E6B50045D888 /* Fun with Masks.app */; 211 | productType = "com.apple.product-type.application"; 212 | }; 213 | /* End PBXNativeTarget section */ 214 | 215 | /* Begin PBXProject section */ 216 | 357A111816C5E6B50045D888 /* Project object */ = { 217 | isa = PBXProject; 218 | attributes = { 219 | CLASSPREFIX = EWD; 220 | LastUpgradeCheck = 0460; 221 | ORGANIZATIONNAME = "Evan Davis"; 222 | }; 223 | buildConfigurationList = 357A111B16C5E6B50045D888 /* Build configuration list for PBXProject "Fun with Masks" */; 224 | compatibilityVersion = "Xcode 3.2"; 225 | developmentRegion = English; 226 | hasScannedForEncodings = 0; 227 | knownRegions = ( 228 | en, 229 | ); 230 | mainGroup = 357A111716C5E6B50045D888; 231 | productRefGroup = 357A112116C5E6B50045D888 /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 357A111F16C5E6B50045D888 /* Fun with Masks */, 236 | ); 237 | }; 238 | /* End PBXProject section */ 239 | 240 | /* Begin PBXResourcesBuildPhase section */ 241 | 357A111E16C5E6B50045D888 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | 357A112E16C5E6B50045D888 /* InfoPlist.strings in Resources */, 246 | 357A113616C5E6B50045D888 /* Default.png in Resources */, 247 | 357A113816C5E6B50045D888 /* Default@2x.png in Resources */, 248 | 357A113A16C5E6B50045D888 /* Default-568h@2x.png in Resources */, 249 | 357A113F16C5E6B50045D888 /* first.png in Resources */, 250 | 357A114116C5E6B50045D888 /* first@2x.png in Resources */, 251 | 357A114616C5E6B50045D888 /* second.png in Resources */, 252 | 357A114816C5E6B50045D888 /* second@2x.png in Resources */, 253 | 357A116816C5FBAA0045D888 /* jerusalempano2.jpg in Resources */, 254 | 357A116C16C609020045D888 /* pw_maze_white.png in Resources */, 255 | 357A116E16C6090A0045D888 /* pw_maze_white_@2X.png in Resources */, 256 | 357A117016C60C8E0045D888 /* telavivpano3.jpg in Resources */, 257 | 3501367E16C70F18006EF083 /* sample_profile_bg.jpg in Resources */, 258 | 35B91C0216CA99F200E1A60D /* EWDAnimationExampleVC.xib in Resources */, 259 | 35B91C0416CA9A0600E1A60D /* EWDBlurExampleVC.xib in Resources */, 260 | 35B91C0616CA9A1900E1A60D /* EWDGradientExampleVC.xib in Resources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | /* End PBXResourcesBuildPhase section */ 265 | 266 | /* Begin PBXSourcesBuildPhase section */ 267 | 357A111C16C5E6B50045D888 /* Sources */ = { 268 | isa = PBXSourcesBuildPhase; 269 | buildActionMask = 2147483647; 270 | files = ( 271 | 357A113016C5E6B50045D888 /* main.m in Sources */, 272 | 357A113416C5E6B50045D888 /* EWDAppDelegate.m in Sources */, 273 | 357A113D16C5E6B50045D888 /* EWDGradientExampleVC.m in Sources */, 274 | 357A114416C5E6B50045D888 /* EWDBlurExampleVC.m in Sources */, 275 | 357A116016C5E7BC0045D888 /* EWDAnimationExampleVC.m in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | /* End PBXSourcesBuildPhase section */ 280 | 281 | /* Begin PBXVariantGroup section */ 282 | 357A112C16C5E6B50045D888 /* InfoPlist.strings */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | 357A112D16C5E6B50045D888 /* en */, 286 | ); 287 | name = InfoPlist.strings; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | 357A115516C5E6B50045D888 /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 298 | CLANG_CXX_LIBRARY = "libc++"; 299 | CLANG_ENABLE_OBJC_ARC = YES; 300 | CLANG_WARN_CONSTANT_CONVERSION = YES; 301 | CLANG_WARN_EMPTY_BODY = YES; 302 | CLANG_WARN_ENUM_CONVERSION = YES; 303 | CLANG_WARN_INT_CONVERSION = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 306 | COPY_PHASE_STRIP = NO; 307 | GCC_C_LANGUAGE_STANDARD = gnu99; 308 | GCC_DYNAMIC_NO_PIC = NO; 309 | GCC_OPTIMIZATION_LEVEL = 0; 310 | GCC_PREPROCESSOR_DEFINITIONS = ( 311 | "DEBUG=1", 312 | "$(inherited)", 313 | ); 314 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 315 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 317 | GCC_WARN_UNUSED_VARIABLE = YES; 318 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 319 | ONLY_ACTIVE_ARCH = YES; 320 | SDKROOT = iphoneos; 321 | TARGETED_DEVICE_FAMILY = "1,2"; 322 | }; 323 | name = Debug; 324 | }; 325 | 357A115616C5E6B50045D888 /* Release */ = { 326 | isa = XCBuildConfiguration; 327 | buildSettings = { 328 | ALWAYS_SEARCH_USER_PATHS = NO; 329 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 330 | CLANG_CXX_LIBRARY = "libc++"; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INT_CONVERSION = YES; 336 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 337 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 338 | COPY_PHASE_STRIP = YES; 339 | GCC_C_LANGUAGE_STANDARD = gnu99; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 344 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 345 | SDKROOT = iphoneos; 346 | TARGETED_DEVICE_FAMILY = "1,2"; 347 | VALIDATE_PRODUCT = YES; 348 | }; 349 | name = Release; 350 | }; 351 | 357A115816C5E6B50045D888 /* Debug */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 355 | GCC_PREFIX_HEADER = "Fun with Masks/Fun with Masks-Prefix.pch"; 356 | INFOPLIST_FILE = "Fun with Masks/Fun with Masks-Info.plist"; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | TARGETED_DEVICE_FAMILY = 1; 359 | WRAPPER_EXTENSION = app; 360 | }; 361 | name = Debug; 362 | }; 363 | 357A115916C5E6B50045D888 /* Release */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 367 | GCC_PREFIX_HEADER = "Fun with Masks/Fun with Masks-Prefix.pch"; 368 | INFOPLIST_FILE = "Fun with Masks/Fun with Masks-Info.plist"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | TARGETED_DEVICE_FAMILY = 1; 371 | WRAPPER_EXTENSION = app; 372 | }; 373 | name = Release; 374 | }; 375 | /* End XCBuildConfiguration section */ 376 | 377 | /* Begin XCConfigurationList section */ 378 | 357A111B16C5E6B50045D888 /* Build configuration list for PBXProject "Fun with Masks" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | 357A115516C5E6B50045D888 /* Debug */, 382 | 357A115616C5E6B50045D888 /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | 357A115716C5E6B50045D888 /* Build configuration list for PBXNativeTarget "Fun with Masks" */ = { 388 | isa = XCConfigurationList; 389 | buildConfigurations = ( 390 | 357A115816C5E6B50045D888 /* Debug */, 391 | 357A115916C5E6B50045D888 /* Release */, 392 | ); 393 | defaultConfigurationIsVisible = 0; 394 | defaultConfigurationName = Release; 395 | }; 396 | /* End XCConfigurationList section */ 397 | }; 398 | rootObject = 357A111816C5E6B50045D888 /* Project object */; 399 | } 400 | -------------------------------------------------------------------------------- /Fun with Masks/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/Default-568h@2x.png -------------------------------------------------------------------------------- /Fun with Masks/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/Default.png -------------------------------------------------------------------------------- /Fun with Masks/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/Default@2x.png -------------------------------------------------------------------------------- /Fun with Masks/EWDAnimationExampleVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // EWDAnimationExampleVC.h 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EWDAnimationExampleVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Fun with Masks/EWDAnimationExampleVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // EWDAnimationExampleVC.m 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import "EWDAnimationExampleVC.h" 10 | #import 11 | 12 | @interface EWDAnimationExampleVC () 13 | 14 | @property (nonatomic, weak) IBOutlet UIView *maskView; 15 | @property (nonatomic, weak) IBOutlet UIScrollView *scrollView; 16 | @property (weak, nonatomic) IBOutlet UIImageView *imageView; 17 | @property (nonatomic, strong) CAShapeLayer *maskLayer; 18 | @property (nonatomic, assign) BOOL isMaskMoved; 19 | 20 | - (IBAction)toggleMask:(id)sender; 21 | 22 | @end 23 | 24 | @implementation EWDAnimationExampleVC 25 | 26 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 27 | { 28 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 29 | if (self) { 30 | self.title = @"Animation"; 31 | } 32 | return self; 33 | } 34 | - (void)viewDidLoad 35 | { 36 | [super viewDidLoad]; 37 | // Do any additional setup after loading the view from its nib. 38 | self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pw_maze_white"]]; 39 | 40 | } 41 | 42 | - (void)didReceiveMemoryWarning 43 | { 44 | [super didReceiveMemoryWarning]; 45 | // Dispose of any resources that can be recreated. 46 | } 47 | 48 | - (void)viewDidAppear:(BOOL)animated 49 | { 50 | [super viewDidAppear:animated]; 51 | self.scrollView.contentSize = self.imageView.bounds.size; 52 | [self toggleMask:nil]; 53 | } 54 | 55 | - (IBAction)toggleMask:(id)sender 56 | { 57 | self.isMaskMoved = !self.isMaskMoved; 58 | CGFloat width = self.maskView.layer.frame.size.width; 59 | CGFloat height = self.maskView.layer.frame.size.height; 60 | 61 | //Create path that defines the edges of our masking layer 62 | CGMutablePathRef path = CGPathCreateMutable(); 63 | 64 | CGPathMoveToPoint(path, NULL, 0, 0); 65 | CGPathAddLineToPoint(path, NULL, width, 0); 66 | CGPathAddLineToPoint(path, NULL, width, height); 67 | CGPathAddLineToPoint(path, NULL, (width / 2) + 30, height); 68 | if (self.isMaskMoved) 69 | CGPathAddLineToPoint(path, NULL, (width / 2), height - 30); 70 | else 71 | CGPathAddLineToPoint(path, NULL, (width / 2), height); 72 | CGPathAddLineToPoint(path, NULL, (width / 2) - 30, height); 73 | CGPathAddLineToPoint(path, NULL, 0, height); 74 | CGPathCloseSubpath(path); 75 | 76 | //if no mask, create it 77 | if (!self.maskLayer) 78 | { 79 | self.maskLayer = [[CAShapeLayer alloc] init]; 80 | self.maskLayer.frame = self.maskView.layer.bounds; 81 | self.maskLayer.fillColor = [[UIColor blackColor] CGColor]; 82 | self.maskLayer.path = path; 83 | self.maskView.layer.mask = self.maskLayer; 84 | } 85 | //animate our mask to the new path 86 | else 87 | { 88 | CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:@"path"]; 89 | [anim setFromValue:(id)self.maskLayer.path]; 90 | [anim setToValue:(__bridge id)(path)]; 91 | [anim setDelegate:self]; 92 | [anim setDuration:0.25]; 93 | [anim setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; 94 | self.maskLayer.path = path; 95 | [self.maskLayer addAnimation:anim forKey:@"path"]; 96 | } 97 | 98 | CGPathRelease(path); 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /Fun with Masks/EWDAnimationExampleVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12C3012 6 | 3084 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBNSLayoutConstraint 15 | IBProxyObject 16 | IBUIButton 17 | IBUIImageView 18 | IBUIScrollView 19 | IBUIView 20 | 21 | 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | PluginDependencyRecalculationVersion 26 | 27 | 28 | 29 | 30 | IBFilesOwner 31 | IBCocoaTouchFramework 32 | 33 | 34 | IBFirstResponder 35 | IBCocoaTouchFramework 36 | 37 | 38 | 39 | 274 40 | 41 | 42 | 43 | 274 44 | 45 | 46 | 47 | 274 48 | {502, 645} 49 | 50 | 51 | 52 | _NS:9 53 | NO 54 | IBCocoaTouchFramework 55 | 56 | NSImage 57 | sample_profile_bg.jpg 58 | 59 | 60 | 61 | {320, 548} 62 | 63 | 64 | 65 | _NS:9 66 | YES 67 | YES 68 | IBCocoaTouchFramework 69 | 70 | 71 | 72 | 292 73 | 74 | {320, 161} 75 | 76 | 77 | 78 | _NS:9 79 | 80 | 3 81 | MC42NjY2NjY2NjY3AA 82 | 83 | IBCocoaTouchFramework 84 | 85 | 86 | 87 | 292 88 | {{107, 252}, {105, 44}} 89 | 90 | 91 | 92 | _NS:9 93 | NO 94 | IBCocoaTouchFramework 95 | 0 96 | 0 97 | 1 98 | Move Mask 99 | 100 | 3 101 | MQA 102 | 103 | 104 | 1 105 | MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA 106 | 107 | 108 | 3 109 | MC41AA 110 | 111 | 112 | 2 113 | 15 114 | 115 | 116 | Helvetica-Bold 117 | 15 118 | 16 119 | 120 | 121 | 122 | {{0, 20}, {320, 548}} 123 | 124 | 125 | 126 | 127 | 3 128 | MQA 129 | 130 | 2 131 | 132 | 133 | 134 | 135 | IBUIScreenMetrics 136 | 137 | YES 138 | 139 | 140 | 141 | 142 | 143 | {320, 568} 144 | {568, 320} 145 | 146 | 147 | IBCocoaTouchFramework 148 | Retina 4 Full Screen 149 | 2 150 | 151 | IBCocoaTouchFramework 152 | 153 | 154 | 155 | 156 | 157 | 158 | view 159 | 160 | 161 | 162 | 70 163 | 164 | 165 | 166 | scrollView 167 | 168 | 169 | 170 | 71 171 | 172 | 173 | 174 | maskView 175 | 176 | 177 | 178 | 72 179 | 180 | 181 | 182 | imageView 183 | 184 | 185 | 186 | 73 187 | 188 | 189 | 190 | toggleMask: 191 | 192 | 193 | 7 194 | 195 | 75 196 | 197 | 198 | 199 | 200 | 201 | 0 202 | 203 | 204 | 205 | 206 | 207 | 1 208 | 209 | 210 | 211 | 212 | 213 | 3 214 | 0 215 | 216 | 3 217 | 1 218 | 219 | 252 220 | 221 | 1000 222 | 223 | 3 224 | 9 225 | 3 226 | 227 | 228 | 229 | 5 230 | 0 231 | 232 | 5 233 | 1 234 | 235 | 107 236 | 237 | 1000 238 | 239 | 3 240 | 9 241 | 3 242 | 243 | 244 | 245 | 4 246 | 0 247 | 248 | 4 249 | 1 250 | 251 | 387 252 | 253 | 1000 254 | 255 | 3 256 | 9 257 | 3 258 | 259 | 260 | 261 | 3 262 | 0 263 | 264 | 3 265 | 1 266 | 267 | 0.0 268 | 269 | 1000 270 | 271 | 8 272 | 29 273 | 3 274 | 275 | 276 | 277 | 6 278 | 0 279 | 280 | 6 281 | 1 282 | 283 | 0.0 284 | 285 | 1000 286 | 287 | 8 288 | 29 289 | 3 290 | 291 | 292 | 293 | 5 294 | 0 295 | 296 | 5 297 | 1 298 | 299 | 0.0 300 | 301 | 1000 302 | 303 | 8 304 | 29 305 | 3 306 | 307 | 308 | 309 | 4 310 | 0 311 | 312 | 4 313 | 1 314 | 315 | 0.0 316 | 317 | 1000 318 | 319 | 8 320 | 29 321 | 3 322 | 323 | 324 | 325 | 6 326 | 0 327 | 328 | 6 329 | 1 330 | 331 | 0.0 332 | 333 | 1000 334 | 335 | 8 336 | 29 337 | 3 338 | 339 | 340 | 341 | 3 342 | 0 343 | 344 | 3 345 | 1 346 | 347 | 0.0 348 | 349 | 1000 350 | 351 | 8 352 | 29 353 | 3 354 | 355 | 356 | 357 | 5 358 | 0 359 | 360 | 5 361 | 1 362 | 363 | 0.0 364 | 365 | 1000 366 | 367 | 8 368 | 29 369 | 3 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | -1 378 | 379 | 380 | File's Owner 381 | 382 | 383 | -2 384 | 385 | 386 | 387 | 388 | 40 389 | 390 | 391 | 392 | 393 | 394 | 54 395 | 396 | 397 | 398 | 399 | 55 400 | 401 | 402 | 403 | 404 | 62 405 | 406 | 407 | 408 | 409 | 4 410 | 411 | 412 | 413 | 414 | 6 415 | 0 416 | 417 | 6 418 | 1 419 | 420 | -182 421 | 422 | 1000 423 | 424 | 3 425 | 9 426 | 3 427 | 428 | 429 | 430 | 5 431 | 0 432 | 433 | 5 434 | 1 435 | 436 | 0.0 437 | 438 | 1000 439 | 440 | 8 441 | 29 442 | 3 443 | 444 | 445 | 446 | 4 447 | 0 448 | 449 | 4 450 | 1 451 | 452 | -97 453 | 454 | 1000 455 | 456 | 3 457 | 9 458 | 3 459 | 460 | 461 | 462 | 3 463 | 0 464 | 465 | 3 466 | 1 467 | 468 | 0.0 469 | 470 | 1000 471 | 472 | 8 473 | 29 474 | 3 475 | 476 | 477 | 478 | 479 | 480 | 481 | 8 482 | 483 | 484 | 485 | 486 | 7 487 | 488 | 489 | 490 | 491 | 6 492 | 493 | 494 | 495 | 496 | 5 497 | 498 | 499 | 500 | 501 | 26 502 | 503 | 504 | 505 | 506 | 60 507 | 508 | 509 | 510 | 511 | 59 512 | 513 | 514 | 515 | 516 | 9 517 | 518 | 519 | 520 | 521 | 8 522 | 0 523 | 524 | 0 525 | 1 526 | 527 | 645 528 | 529 | 1000 530 | 531 | 3 532 | 9 533 | 1 534 | 535 | 536 | 537 | 7 538 | 0 539 | 540 | 0 541 | 1 542 | 543 | 502 544 | 545 | 1000 546 | 547 | 3 548 | 9 549 | 1 550 | 551 | 552 | 553 | 554 | 555 | 25 556 | 557 | 558 | 559 | 560 | 11 561 | 562 | 563 | 564 | 565 | 19 566 | 567 | 568 | 569 | 570 | 24 571 | 572 | 573 | 574 | 575 | 74 576 | 577 | 578 | 579 | 580 | 76 581 | 582 | 583 | 584 | 585 | 77 586 | 587 | 588 | 589 | 590 | 591 | 592 | EWDAnimationExampleVC 593 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 594 | UIResponder 595 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 596 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 610 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 611 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 612 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 613 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 614 | 615 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 624 | 625 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 626 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 627 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 628 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 629 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 630 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 631 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 632 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 633 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 634 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 635 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 636 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 637 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 77 649 | 650 | 651 | 652 | 653 | EWDAnimationExampleVC 654 | UIViewController 655 | 656 | toggleMask: 657 | id 658 | 659 | 660 | toggleMask: 661 | 662 | toggleMask: 663 | id 664 | 665 | 666 | 667 | UIImageView 668 | UIView 669 | UIScrollView 670 | 671 | 672 | 673 | imageView 674 | UIImageView 675 | 676 | 677 | maskView 678 | UIView 679 | 680 | 681 | scrollView 682 | UIScrollView 683 | 684 | 685 | 686 | IBProjectSource 687 | ./Classes/EWDAnimationExampleVC.h 688 | 689 | 690 | 691 | NSLayoutConstraint 692 | NSObject 693 | 694 | IBProjectSource 695 | ./Classes/NSLayoutConstraint.h 696 | 697 | 698 | 699 | 700 | 0 701 | IBCocoaTouchFramework 702 | YES 703 | 3 704 | 705 | sample_profile_bg.jpg 706 | {600, 600} 707 | 708 | YES 709 | 2083 710 | 711 | 712 | -------------------------------------------------------------------------------- /Fun with Masks/EWDAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // EWDAppDelegate.h 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EWDAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @property (strong, nonatomic) UITabBarController *tabBarController; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Fun with Masks/EWDAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // EWDAppDelegate.m 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import "EWDAppDelegate.h" 10 | 11 | #import "EWDGradientExampleVC.h" 12 | #import "EWDBlurExampleVC.h" 13 | #import "EWDAnimationExampleVC.h" 14 | 15 | @implementation EWDAppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 20 | self.window.backgroundColor = [UIColor blackColor]; 21 | // Override point for customization after application launch. 22 | UIViewController *viewController1, *viewController2, *viewController3; 23 | viewController1 = [[EWDGradientExampleVC alloc] initWithNibName:@"EWDGradientExampleVC" bundle:nil]; 24 | viewController2 = [[EWDBlurExampleVC alloc] initWithNibName:@"EWDBlurExampleVC" bundle:nil]; 25 | viewController3 = [[EWDAnimationExampleVC alloc] initWithNibName:@"EWDAnimationExampleVC" bundle:nil]; 26 | self.tabBarController = [[UITabBarController alloc] init]; 27 | self.tabBarController.viewControllers = @[viewController1, viewController2, viewController3]; 28 | self.window.rootViewController = self.tabBarController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application 34 | { 35 | // 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. 36 | // 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. 37 | } 38 | 39 | - (void)applicationDidEnterBackground:(UIApplication *)application 40 | { 41 | // 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. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application 46 | { 47 | // 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. 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | // 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. 53 | } 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application 56 | { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | /* 61 | // Optional UITabBarControllerDelegate method. 62 | - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController 63 | { 64 | } 65 | */ 66 | 67 | /* 68 | // Optional UITabBarControllerDelegate method. 69 | - (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed 70 | { 71 | } 72 | */ 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Fun with Masks/EWDBlurExampleVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // EWDSecondViewController.h 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EWDBlurExampleVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Fun with Masks/EWDBlurExampleVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // EWDSecondViewController.m 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import "EWDBlurExampleVC.h" 10 | #import 11 | @interface EWDBlurExampleVC () 12 | 13 | @property (nonatomic, strong) CALayer *maskLayer; 14 | @property (nonatomic, assign) CGRect buttonFrame; 15 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 16 | @property (weak, nonatomic) IBOutlet UIImageView *originalImageView; 17 | @property (weak, nonatomic) IBOutlet UIButton *testButton; 18 | @property (weak, nonatomic) IBOutlet UIImageView *blurView; 19 | 20 | - (IBAction)toggleMask:(id)sender; 21 | 22 | @end 23 | 24 | @implementation EWDBlurExampleVC 25 | 26 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 27 | { 28 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 29 | if (self) { 30 | self.title = @"Blur"; 31 | } 32 | return self; 33 | } 34 | 35 | - (void)viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pw_maze_white"]]; 39 | [self setupBlurredImage]; 40 | 41 | 42 | 43 | //this is the frame we offset in scrollViewDidScroll 44 | self.buttonFrame = [self.view convertRect:self.testButton.frame toView:self.blurView]; 45 | 46 | //setting up button 47 | self.testButton.layer.borderWidth = 2.0f; 48 | self.testButton.layer.borderColor = [UIColor blackColor].CGColor; 49 | self.testButton.layer.cornerRadius = CGRectGetHeight(self.testButton.bounds) / 2; 50 | 51 | //setting up corresponding mask for the button. 52 | self.maskLayer = [CALayer layer]; 53 | self.maskLayer.frame = self.buttonFrame; 54 | self.maskLayer.cornerRadius = self.testButton.layer.cornerRadius; 55 | self.maskLayer.backgroundColor = [UIColor blackColor].CGColor; 56 | self.blurView.layer.mask = self.maskLayer; 57 | } 58 | 59 | - (void)viewDidAppear:(BOOL)animated 60 | { 61 | [super viewDidAppear:animated]; 62 | self.scrollView.contentSize = self.originalImageView.bounds.size; 63 | } 64 | 65 | - (void)didReceiveMemoryWarning 66 | { 67 | [super didReceiveMemoryWarning]; 68 | // Dispose of any resources that can be recreated. 69 | } 70 | 71 | #pragma mark - mask manipulation 72 | 73 | - (IBAction)toggleMask:(id)sender 74 | { 75 | if (self.blurView.layer.mask) 76 | self.blurView.layer.mask = nil; 77 | else 78 | self.blurView.layer.mask = self.maskLayer; 79 | } 80 | 81 | #pragma mark - Image Blurring 82 | 83 | - (void)setupBlurredImage 84 | { 85 | UIImage *theImage = [UIImage imageNamed:@"sample_profile_bg.jpg"]; 86 | 87 | //create our blurred image 88 | CIContext *context = [CIContext contextWithOptions:nil]; 89 | CIImage *inputImage = [CIImage imageWithCGImage:theImage.CGImage]; 90 | 91 | //setting up Gaussian Blur (we could use one of many filters offered by Core Image) 92 | CIFilter *filter = [CIFilter filterWithName:@"CIGaussianBlur"]; 93 | [filter setValue:inputImage forKey:kCIInputImageKey]; 94 | [filter setValue:[NSNumber numberWithFloat:15.0f] forKey:@"inputRadius"]; 95 | CIImage *result = [filter valueForKey:kCIOutputImageKey]; 96 | //CIGaussianBlur has a tendency to shrink the image a little, this ensures it matches up exactly to the bounds of our original image 97 | CGImageRef cgImage = [context createCGImage:result fromRect:[inputImage extent]]; 98 | 99 | //add our blurred image to the scrollview 100 | self.blurView.image = [UIImage imageWithCGImage:cgImage]; 101 | } 102 | 103 | #pragma mark - UIScrollViewDelegate 104 | 105 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView 106 | { 107 | CGPoint offset = scrollView.contentOffset; 108 | 109 | CGRect buttonFrame = self.buttonFrame; 110 | buttonFrame.origin.x += offset.x; 111 | buttonFrame.origin.y += offset.y; 112 | NSLog(@"button's frame: %f, %f, %f, %f", buttonFrame.origin.x, buttonFrame.origin.y, buttonFrame.size.width, buttonFrame.size.height); 113 | //without the CATransaction the mask's frame setting is actually slighty animated, appearing to give it a delay as we scroll around 114 | [CATransaction begin]; 115 | [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions]; 116 | self.maskLayer.frame = buttonFrame; 117 | [CATransaction commit]; 118 | } 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /Fun with Masks/EWDBlurExampleVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12C3012 6 | 3084 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBNSLayoutConstraint 15 | IBProxyObject 16 | IBUIButton 17 | IBUIImageView 18 | IBUIScrollView 19 | IBUIView 20 | 21 | 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | PluginDependencyRecalculationVersion 26 | 27 | 28 | 29 | 30 | IBFilesOwner 31 | IBCocoaTouchFramework 32 | 33 | 34 | IBFirstResponder 35 | IBCocoaTouchFramework 36 | 37 | 38 | 39 | 274 40 | 41 | 42 | 43 | 274 44 | 45 | 46 | 47 | 292 48 | {577, 726} 49 | 50 | 51 | 52 | _NS:9 53 | YES 54 | NO 55 | IBCocoaTouchFramework 56 | 57 | NSImage 58 | sample_profile_bg.jpg 59 | 60 | 61 | 62 | 63 | 292 64 | {577, 726} 65 | 66 | 67 | 68 | _NS:9 69 | YES 70 | NO 71 | IBCocoaTouchFramework 72 | 73 | 74 | {320, 548} 75 | 76 | 77 | 78 | _NS:9 79 | YES 80 | YES 81 | IBCocoaTouchFramework 82 | 83 | 84 | 85 | 292 86 | {{20, 88}, {280, 44}} 87 | 88 | 89 | _NS:9 90 | NO 91 | IBCocoaTouchFramework 92 | 0 93 | 0 94 | Toggle Mask 95 | 96 | 3 97 | MQA 98 | 99 | 100 | 1 101 | MCAwIDAAA 102 | 103 | 104 | 1 105 | MSAwLjk5NTYzNTE0MzMgMC45ODI1NDA1NzMzAA 106 | 107 | 108 | 2 109 | 15 110 | 111 | 112 | Helvetica-Bold 113 | 15 114 | 16 115 | 116 | 117 | 118 | {{0, 20}, {320, 548}} 119 | 120 | 121 | 122 | 123 | 3 124 | MQA 125 | 126 | 2 127 | 128 | 129 | 130 | 131 | IBUIScreenMetrics 132 | 133 | YES 134 | 135 | 136 | 137 | 138 | 139 | {320, 568} 140 | {568, 320} 141 | 142 | 143 | IBCocoaTouchFramework 144 | Retina 4 Full Screen 145 | 2 146 | 147 | IBCocoaTouchFramework 148 | 149 | 150 | 151 | 152 | 153 | 154 | view 155 | 156 | 157 | 158 | 3 159 | 160 | 161 | 162 | scrollView 163 | 164 | 165 | 166 | 40 167 | 168 | 169 | 170 | blurView 171 | 172 | 173 | 174 | 49 175 | 176 | 177 | 178 | originalImageView 179 | 180 | 181 | 182 | 50 183 | 184 | 185 | 186 | testButton 187 | 188 | 189 | 190 | 41 191 | 192 | 193 | 194 | delegate 195 | 196 | 197 | 198 | 56 199 | 200 | 201 | 202 | toggleMask: 203 | 204 | 205 | 7 206 | 207 | 68 208 | 209 | 210 | 211 | 212 | 213 | 0 214 | 215 | 216 | 217 | 218 | 219 | 1 220 | 221 | 222 | 223 | 224 | 225 | 3 226 | 0 227 | 228 | 3 229 | 1 230 | 231 | 88 232 | 233 | 1000 234 | 235 | 3 236 | 9 237 | 3 238 | 239 | 240 | 241 | 6 242 | 0 243 | 244 | 6 245 | 1 246 | 247 | 20 248 | 249 | 1000 250 | 251 | 8 252 | 29 253 | 3 254 | 255 | 256 | 257 | 5 258 | 0 259 | 260 | 5 261 | 1 262 | 263 | 20 264 | 265 | 1000 266 | 267 | 8 268 | 29 269 | 3 270 | 271 | 272 | 273 | 5 274 | 0 275 | 276 | 5 277 | 1 278 | 279 | 0.0 280 | 281 | 1000 282 | 283 | 8 284 | 29 285 | 3 286 | 287 | 288 | 289 | 4 290 | 0 291 | 292 | 4 293 | 1 294 | 295 | 0.0 296 | 297 | 1000 298 | 299 | 8 300 | 29 301 | 3 302 | 303 | 304 | 305 | 6 306 | 0 307 | 308 | 6 309 | 1 310 | 311 | 0.0 312 | 313 | 1000 314 | 315 | 8 316 | 29 317 | 3 318 | 319 | 320 | 321 | 3 322 | 0 323 | 324 | 3 325 | 1 326 | 327 | 0.0 328 | 329 | 1000 330 | 331 | 8 332 | 29 333 | 3 334 | 335 | 336 | 337 | 338 | 339 | 340 | -1 341 | 342 | 343 | File's Owner 344 | 345 | 346 | -2 347 | 348 | 349 | 350 | 351 | 5 352 | 353 | 354 | 355 | 356 | 357 | 3 358 | 0 359 | 360 | 3 361 | 1 362 | 363 | 0.0 364 | 365 | 1000 366 | 367 | 8 368 | 29 369 | 3 370 | 371 | 372 | 373 | 4 374 | 0 375 | 376 | 4 377 | 1 378 | 379 | 0.0 380 | 381 | 1000 382 | 383 | 6 384 | 24 385 | 2 386 | 387 | 388 | 389 | 4 390 | 0 391 | 392 | 4 393 | 1 394 | 395 | -178 396 | 397 | 1000 398 | 399 | 3 400 | 9 401 | 3 402 | 403 | 404 | 405 | 5 406 | 0 407 | 408 | 5 409 | 1 410 | 411 | 0.0 412 | 413 | 1000 414 | 415 | 8 416 | 29 417 | 3 418 | 419 | 420 | 421 | 6 422 | 0 423 | 424 | 6 425 | 1 426 | 427 | 0.0 428 | 429 | 1000 430 | 431 | 6 432 | 24 433 | 2 434 | 435 | 436 | 437 | 6 438 | 0 439 | 440 | 6 441 | 1 442 | 443 | -257 444 | 445 | 1000 446 | 447 | 3 448 | 9 449 | 3 450 | 451 | 452 | 453 | 5 454 | 0 455 | 456 | 5 457 | 1 458 | 459 | 0.0 460 | 461 | 1000 462 | 463 | 8 464 | 29 465 | 3 466 | 467 | 468 | 469 | 3 470 | 0 471 | 472 | 3 473 | 1 474 | 475 | 0.0 476 | 477 | 1000 478 | 479 | 8 480 | 29 481 | 3 482 | 483 | 484 | 485 | 486 | 487 | 488 | 6 489 | 490 | 491 | 492 | 493 | 7 494 | 495 | 496 | 497 | 498 | 8 499 | 500 | 501 | 502 | 503 | 9 504 | 505 | 506 | 507 | 508 | 4 509 | 510 | 511 | 512 | 513 | 7 514 | 0 515 | 516 | 0 517 | 1 518 | 519 | 577 520 | 521 | 1000 522 | 523 | 3 524 | 9 525 | 1 526 | 527 | 528 | 529 | 8 530 | 0 531 | 532 | 0 533 | 1 534 | 535 | 726 536 | 537 | 1000 538 | 539 | 3 540 | 9 541 | 1 542 | 543 | 544 | 545 | 546 | 547 | 20 548 | 549 | 550 | 551 | 552 | 21 553 | 554 | 555 | 556 | 557 | 42 558 | 559 | 560 | 561 | 562 | 563 | 62 564 | 565 | 566 | 567 | 568 | 63 569 | 570 | 571 | 572 | 573 | 65 574 | 575 | 576 | 577 | 578 | 66 579 | 580 | 581 | 582 | 583 | 67 584 | 585 | 586 | 587 | 588 | 26 589 | 590 | 591 | 592 | 593 | 8 594 | 0 595 | 596 | 0 597 | 1 598 | 599 | 44 600 | 601 | 1000 602 | 603 | 3 604 | 9 605 | 1 606 | 607 | 608 | 609 | 610 | 611 | 73 612 | 613 | 614 | 615 | 616 | 74 617 | 618 | 619 | 620 | 621 | 76 622 | 623 | 624 | 625 | 626 | 77 627 | 628 | 629 | 630 | 631 | 78 632 | 633 | 634 | 635 | 636 | 82 637 | 638 | 639 | 640 | 641 | 83 642 | 643 | 644 | 645 | 646 | 647 | 648 | EWDBlurExampleVC 649 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 650 | UIResponder 651 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 652 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 663 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 664 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 665 | 666 | 667 | 668 | 669 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 670 | 671 | 672 | 673 | 674 | 675 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 676 | 677 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 690 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 691 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 692 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 693 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 694 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 695 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 696 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 697 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 698 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 699 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 700 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 701 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 702 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 703 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 704 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 705 | 706 | 707 | 708 | 709 | 710 | 83 711 | 712 | 713 | 714 | 715 | EWDAnimationExampleVC 716 | UIViewController 717 | 718 | toggleMask: 719 | id 720 | 721 | 722 | toggleMask: 723 | 724 | toggleMask: 725 | id 726 | 727 | 728 | 729 | UIImageView 730 | UIView 731 | UIScrollView 732 | 733 | 734 | 735 | imageView 736 | UIImageView 737 | 738 | 739 | maskView 740 | UIView 741 | 742 | 743 | scrollView 744 | UIScrollView 745 | 746 | 747 | 748 | IBProjectSource 749 | ./Classes/EWDAnimationExampleVC.h 750 | 751 | 752 | 753 | EWDBlurExampleVC 754 | UIViewController 755 | 756 | toggleMask: 757 | id 758 | 759 | 760 | toggleMask: 761 | 762 | toggleMask: 763 | id 764 | 765 | 766 | 767 | UIImageView 768 | UIImageView 769 | UIScrollView 770 | UIButton 771 | 772 | 773 | 774 | blurView 775 | UIImageView 776 | 777 | 778 | originalImageView 779 | UIImageView 780 | 781 | 782 | scrollView 783 | UIScrollView 784 | 785 | 786 | testButton 787 | UIButton 788 | 789 | 790 | 791 | IBProjectSource 792 | ./Classes/EWDBlurExampleVC.h 793 | 794 | 795 | 796 | NSLayoutConstraint 797 | NSObject 798 | 799 | IBProjectSource 800 | ./Classes/NSLayoutConstraint.h 801 | 802 | 803 | 804 | 805 | 0 806 | IBCocoaTouchFramework 807 | YES 808 | 3 809 | 810 | sample_profile_bg.jpg 811 | {600, 600} 812 | 813 | YES 814 | 2083 815 | 816 | 817 | -------------------------------------------------------------------------------- /Fun with Masks/EWDGradientExampleVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // EWDFirstViewController.h 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface EWDGradientExampleVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Fun with Masks/EWDGradientExampleVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // EWDFirstViewController.m 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import "EWDGradientExampleVC.h" 10 | #import 11 | 12 | @interface EWDGradientExampleVC () 13 | @property (weak, nonatomic) IBOutlet UIView *containerView; 14 | @property (weak, nonatomic) IBOutlet UIScrollView *scrollView; 15 | @property (weak, nonatomic) IBOutlet UIImageView *bigImageView; 16 | 17 | @end 18 | 19 | @implementation EWDGradientExampleVC 20 | 21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 22 | { 23 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 24 | if (self) { 25 | self.title = @"Gradient"; 26 | } 27 | return self; 28 | } 29 | 30 | - (void)viewDidLoad 31 | { 32 | [super viewDidLoad]; 33 | 34 | self.scrollView.scrollEnabled = YES; 35 | self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pw_maze_white"]]; 36 | 37 | [self createGradientMask]; 38 | } 39 | 40 | - (void)viewWillAppear:(BOOL)animated 41 | { 42 | [super viewWillAppear:animated]; 43 | 44 | } 45 | 46 | - (void)viewDidAppear:(BOOL)animated 47 | { 48 | [super viewDidAppear:animated]; 49 | self.scrollView.contentSize = self.bigImageView.bounds.size; 50 | } 51 | 52 | - (void)didReceiveMemoryWarning 53 | { 54 | [super didReceiveMemoryWarning]; 55 | // Dispose of any resources that can be recreated. 56 | } 57 | 58 | #pragma mark - Mask Creation 59 | - (void)createGradientMask 60 | { 61 | //creating our gradient mask 62 | CAGradientLayer *maskLayer = [CAGradientLayer layer]; 63 | 64 | //this is the anchor point for our gradient, in our case top left. setting it in the middle (.5, .5) will produce a radial gradient. our startPoint and endPoints are based off the anchorPoint 65 | maskLayer.anchorPoint = CGPointZero; 66 | 67 | //The line between these two points is the line our gradient uses as a guide 68 | //starts in bottom left 69 | maskLayer.startPoint = CGPointMake(0.0f, 1.0f); 70 | //ends in top right 71 | maskLayer.endPoint = CGPointMake(1.f, 0.0f); 72 | 73 | 74 | //setting our colors - since this is a mask the color itself is irrelevant - all that matters is the alpha. A clear color will completely hide the layer we're masking, an alpha of 1.0 will completely show the masked view. 75 | UIColor *outerColor = [UIColor colorWithWhite:1.0 alpha:0.0]; 76 | UIColor *innerColor = [UIColor colorWithWhite:1.0 alpha:1.0]; 77 | 78 | //an array of colors that dictatates the gradient(s) 79 | maskLayer.colors = @[(id)outerColor.CGColor, (id)outerColor.CGColor, (id)innerColor.CGColor, (id)innerColor.CGColor]; 80 | //these are percentage points along the line defined by our startPoint and endPoint and correspond to our colors array. The gradient will shift between the colors between these percentage points. 81 | maskLayer.locations = @[@0.0, @0.15, @0.5, @1.0f]; 82 | 83 | maskLayer.bounds = CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds)); 84 | self.containerView.layer.mask = maskLayer; 85 | } 86 | 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Fun with Masks/EWDGradientExampleVC.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12C3012 6 | 3084 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBNSLayoutConstraint 15 | IBProxyObject 16 | IBUIImageView 17 | IBUILabel 18 | IBUIScrollView 19 | IBUIView 20 | 21 | 22 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 23 | 24 | 25 | PluginDependencyRecalculationVersion 26 | 27 | 28 | 29 | 30 | IBFilesOwner 31 | IBCocoaTouchFramework 32 | 33 | 34 | IBFirstResponder 35 | IBCocoaTouchFramework 36 | 37 | 38 | 39 | 274 40 | 41 | 42 | 43 | 274 44 | 45 | 46 | 47 | 268 48 | 49 | 50 | 51 | 274 52 | {1000, 508} 53 | 54 | 55 | _NS:9 56 | 2 57 | NO 58 | IBCocoaTouchFramework 59 | 60 | NSImage 61 | jerusalempano2.jpg 62 | 63 | 64 | 65 | {{20, 20}, {280, 508}} 66 | 67 | 68 | _NS:9 69 | YES 70 | YES 71 | IBCocoaTouchFramework 72 | 73 | 74 | {320, 548} 75 | 76 | 77 | _NS:9 78 | 79 | 3 80 | MQA 81 | 82 | 2 83 | 84 | 85 | IBCocoaTouchFramework 86 | 87 | 88 | 89 | 292 90 | {{20, 500}, {59, 28}} 91 | 92 | 93 | _NS:9 94 | NO 95 | YES 96 | 7 97 | NO 98 | IBCocoaTouchFramework 99 | Howdy! 100 | 101 | 1 102 | MCAwIDAAA 103 | darkTextColor 104 | 105 | 106 | 0 107 | 108 | 1 109 | 17 110 | 111 | 112 | Helvetica 113 | 17 114 | 16 115 | 116 | NO 117 | 118 | 119 | {{0, 20}, {320, 548}} 120 | 121 | 122 | 123 | 3 124 | MQA 125 | 126 | 127 | 128 | 129 | IBUIScreenMetrics 130 | 131 | YES 132 | 133 | 134 | 135 | 136 | 137 | {320, 568} 138 | {568, 320} 139 | 140 | 141 | IBCocoaTouchFramework 142 | Retina 4 Full Screen 143 | 2 144 | 145 | IBCocoaTouchFramework 146 | 147 | 148 | 149 | 150 | 151 | 152 | containerView 153 | 154 | 155 | 156 | 13 157 | 158 | 159 | 160 | view 161 | 162 | 163 | 164 | 90 165 | 166 | 167 | 168 | scrollView 169 | 170 | 171 | 172 | 118 173 | 174 | 175 | 176 | bigImageView 177 | 178 | 179 | 180 | 188 181 | 182 | 183 | 184 | 185 | 186 | 0 187 | 188 | 189 | 190 | 191 | 192 | 1 193 | 194 | 195 | 196 | 197 | 4 198 | 0 199 | 200 | 4 201 | 1 202 | 203 | 20 204 | 205 | 1000 206 | 207 | 8 208 | 29 209 | 3 210 | 211 | 212 | 213 | 5 214 | 0 215 | 216 | 5 217 | 1 218 | 219 | 20 220 | 221 | 1000 222 | 223 | 8 224 | 29 225 | 3 226 | 227 | 228 | 229 | 6 230 | 0 231 | 232 | 6 233 | 1 234 | 235 | 0.0 236 | 237 | 1000 238 | 239 | 8 240 | 29 241 | 3 242 | 243 | 244 | 245 | 5 246 | 0 247 | 248 | 5 249 | 1 250 | 251 | 0.0 252 | 253 | 1000 254 | 255 | 8 256 | 29 257 | 3 258 | 259 | 260 | 261 | 3 262 | 0 263 | 264 | 3 265 | 1 266 | 267 | 0.0 268 | 269 | 1000 270 | 271 | 8 272 | 29 273 | 3 274 | 275 | 276 | 277 | 4 278 | 0 279 | 280 | 4 281 | 1 282 | 283 | 0.0 284 | 285 | 1000 286 | 287 | 8 288 | 29 289 | 3 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | -1 298 | 299 | 300 | File's Owner 301 | 302 | 303 | -2 304 | 305 | 306 | 307 | 308 | 3 309 | 310 | 311 | 312 | 313 | 314 | 6 315 | 0 316 | 317 | 6 318 | 1 319 | 320 | 20 321 | 322 | 1000 323 | 324 | 8 325 | 29 326 | 3 327 | 328 | 329 | 330 | 5 331 | 0 332 | 333 | 5 334 | 1 335 | 336 | 20 337 | 338 | 1000 339 | 340 | 8 341 | 29 342 | 3 343 | 344 | 345 | 346 | 4 347 | 0 348 | 349 | 4 350 | 1 351 | 352 | 20 353 | 354 | 1000 355 | 356 | 8 357 | 29 358 | 3 359 | 360 | 361 | 362 | 3 363 | 0 364 | 365 | 3 366 | 1 367 | 368 | 20 369 | 370 | 1000 371 | 372 | 8 373 | 29 374 | 3 375 | 376 | 377 | 378 | 379 | 380 | 4 381 | 382 | 383 | 384 | 385 | 5 386 | 387 | 388 | 389 | 390 | 6 391 | 392 | 393 | 394 | 395 | 7 396 | 397 | 398 | 399 | 400 | 31 401 | 402 | 403 | 404 | 405 | 8 406 | 0 407 | 408 | 0 409 | 1 410 | 411 | 28 412 | 413 | 1000 414 | 415 | 3 416 | 9 417 | 1 418 | 419 | 420 | 421 | 7 422 | 0 423 | 424 | 0 425 | 1 426 | 427 | 59 428 | 429 | 1000 430 | 431 | 3 432 | 9 433 | 1 434 | 435 | 436 | 437 | 438 | 439 | 85 440 | 441 | 442 | 443 | 444 | 86 445 | 446 | 447 | 448 | 449 | 87 450 | 451 | 452 | 453 | 454 | 88 455 | 456 | 457 | 458 | 459 | 103 460 | 461 | 462 | 463 | 464 | 465 | 6 466 | 0 467 | 468 | 6 469 | 1 470 | 471 | -720 472 | 473 | 1000 474 | 475 | 3 476 | 9 477 | 3 478 | 479 | 480 | 481 | 5 482 | 0 483 | 484 | 5 485 | 1 486 | 487 | 0.0 488 | 489 | 1000 490 | 491 | 8 492 | 29 493 | 3 494 | 495 | 496 | 497 | 10 498 | 0 499 | 500 | 10 501 | 1 502 | 503 | 0.0 504 | 505 | 1000 506 | 507 | 5 508 | 22 509 | 2 510 | 511 | 512 | 513 | 4 514 | 0 515 | 516 | 4 517 | 1 518 | 519 | 0.0 520 | 521 | 1000 522 | 523 | 8 524 | 29 525 | 3 526 | 527 | 528 | 529 | 3 530 | 0 531 | 532 | 3 533 | 1 534 | 535 | 0.0 536 | 537 | 1000 538 | 539 | 8 540 | 29 541 | 3 542 | 543 | 544 | 545 | 546 | 547 | 112 548 | 549 | 550 | 551 | 552 | 114 553 | 554 | 555 | 556 | 557 | 116 558 | 559 | 560 | 561 | 562 | 117 563 | 564 | 565 | 566 | 567 | 179 568 | 569 | 570 | 571 | 572 | 7 573 | 0 574 | 575 | 0 576 | 1 577 | 578 | 1000 579 | 580 | 1000 581 | 582 | 3 583 | 9 584 | 1 585 | 586 | 587 | 588 | 589 | 590 | 180 591 | 592 | 593 | 594 | 595 | 181 596 | 597 | 598 | 599 | 600 | 183 601 | 602 | 603 | 604 | 605 | 185 606 | 607 | 608 | 609 | 610 | 186 611 | 612 | 613 | 614 | 615 | 187 616 | 617 | 618 | 619 | 620 | 621 | 622 | EWDGradientExampleVC 623 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 624 | UIResponder 625 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 626 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 645 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 646 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 647 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 648 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 649 | 650 | 651 | 652 | 653 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 654 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 655 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 656 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 657 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 658 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 659 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 668 | 669 | 670 | 671 | 672 | 673 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 674 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 675 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 676 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 677 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 678 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 679 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 680 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 681 | 682 | 683 | 684 | 685 | 686 | 188 687 | 688 | 689 | 0 690 | IBCocoaTouchFramework 691 | YES 692 | 3 693 | 694 | jerusalempano2.jpg 695 | {10641, 2873} 696 | 697 | YES 698 | 2083 699 | 700 | 701 | -------------------------------------------------------------------------------- /Fun with Masks/Fun with Masks-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Mask Fun 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.evandavis.${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 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarTintParameters 32 | 33 | UINavigationBar 34 | 35 | Style 36 | UIBarStyleDefault 37 | Translucent 38 | 39 | 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /Fun with Masks/Fun with Masks-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Fun with Masks' target in the 'Fun with Masks' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_4_0 8 | #warning "This project uses features only available in iOS SDK 4.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Fun with Masks/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Fun with Masks/first.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/first.png -------------------------------------------------------------------------------- /Fun with Masks/first@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/first@2x.png -------------------------------------------------------------------------------- /Fun with Masks/jerusalempano2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/jerusalempano2.jpg -------------------------------------------------------------------------------- /Fun with Masks/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Fun with Masks 4 | // 5 | // Created by Evan Davis on 2/8/13. 6 | // Copyright (c) 2013 Evan Davis. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "EWDAppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([EWDAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Fun with Masks/pw_maze_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/pw_maze_white.png -------------------------------------------------------------------------------- /Fun with Masks/pw_maze_white_@2X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/pw_maze_white_@2X.png -------------------------------------------------------------------------------- /Fun with Masks/sample_profile_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/sample_profile_bg.jpg -------------------------------------------------------------------------------- /Fun with Masks/second.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/second.png -------------------------------------------------------------------------------- /Fun with Masks/second@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/second@2x.png -------------------------------------------------------------------------------- /Fun with Masks/telavivpano3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evanwdavis/Fun-with-Masks/3d6d48e3f36c842c16c594e4783f19b576a9fde1/Fun with Masks/telavivpano3.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Fun-with-Masks 2 | ============== 3 | 4 | some examples of using CALayer masks in creative ways. 5 | --------------------------------------------------------------------------------