├── InteractiveAnimations.xcodeproj └── project.pbxproj ├── InteractiveAnimations ├── Animator.h ├── Animator.m ├── DraggableView.h ├── DraggableView.m ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── InteractiveAnimations-Info.plist ├── InteractiveAnimations-Prefix.pch ├── UINTAppDelegate.h ├── UINTAppDelegate.m ├── UINTGeometryExtras.h ├── UINTSpringAnimation.h ├── UINTSpringAnimation.m ├── UINTViewController.h ├── UINTViewController.m ├── en.lproj │ └── InfoPlist.strings └── main.m └── InteractiveAnimationsTests ├── InteractiveAnimationsTests-Info.plist ├── InteractiveAnimationsTests.m └── en.lproj └── InfoPlist.strings /InteractiveAnimations.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5A4163FBAFEF7B65B4122A12 /* UINTSpringAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A4163C5F060A17DE044D5AE /* UINTSpringAnimation.m */; }; 11 | 83CEFD951913DD0B00F82FA4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFD941913DD0B00F82FA4 /* Foundation.framework */; }; 12 | 83CEFD971913DD0B00F82FA4 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFD961913DD0B00F82FA4 /* CoreGraphics.framework */; }; 13 | 83CEFD991913DD0B00F82FA4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFD981913DD0B00F82FA4 /* UIKit.framework */; }; 14 | 83CEFD9F1913DD0B00F82FA4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83CEFD9D1913DD0B00F82FA4 /* InfoPlist.strings */; }; 15 | 83CEFDA11913DD0B00F82FA4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDA01913DD0B00F82FA4 /* main.m */; }; 16 | 83CEFDA51913DD0B00F82FA4 /* UINTAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDA41913DD0B00F82FA4 /* UINTAppDelegate.m */; }; 17 | 83CEFDAB1913DD0B00F82FA4 /* UINTViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDAA1913DD0B00F82FA4 /* UINTViewController.m */; }; 18 | 83CEFDAD1913DD0B00F82FA4 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 83CEFDAC1913DD0B00F82FA4 /* Images.xcassets */; }; 19 | 83CEFDB41913DD0B00F82FA4 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFDB31913DD0B00F82FA4 /* XCTest.framework */; }; 20 | 83CEFDB51913DD0B00F82FA4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFD941913DD0B00F82FA4 /* Foundation.framework */; }; 21 | 83CEFDB61913DD0B00F82FA4 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83CEFD981913DD0B00F82FA4 /* UIKit.framework */; }; 22 | 83CEFDBE1913DD0B00F82FA4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83CEFDBC1913DD0B00F82FA4 /* InfoPlist.strings */; }; 23 | 83CEFDC01913DD0B00F82FA4 /* InteractiveAnimationsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDBF1913DD0B00F82FA4 /* InteractiveAnimationsTests.m */; }; 24 | 83CEFDCB1913DEB800F82FA4 /* DraggableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDC91913DEB800F82FA4 /* DraggableView.m */; }; 25 | 83CEFDD11913E00500F82FA4 /* Animator.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CEFDD01913E00500F82FA4 /* Animator.m */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 83CEFDB71913DD0B00F82FA4 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 83CEFD891913DD0B00F82FA4 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 83CEFD901913DD0B00F82FA4; 34 | remoteInfo = InteractiveAnimations; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 5A41610843B2253ACAC1463B /* UINTGeometryExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINTGeometryExtras.h; sourceTree = ""; }; 40 | 5A4163C5F060A17DE044D5AE /* UINTSpringAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UINTSpringAnimation.m; sourceTree = ""; }; 41 | 5A41674EE49361E12346E55A /* UINTSpringAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UINTSpringAnimation.h; sourceTree = ""; }; 42 | 83CEFD911913DD0B00F82FA4 /* InteractiveAnimations.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InteractiveAnimations.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 83CEFD941913DD0B00F82FA4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 44 | 83CEFD961913DD0B00F82FA4 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 45 | 83CEFD981913DD0B00F82FA4 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 46 | 83CEFD9C1913DD0B00F82FA4 /* InteractiveAnimations-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InteractiveAnimations-Info.plist"; sourceTree = ""; }; 47 | 83CEFD9E1913DD0B00F82FA4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 48 | 83CEFDA01913DD0B00F82FA4 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 49 | 83CEFDA21913DD0B00F82FA4 /* InteractiveAnimations-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "InteractiveAnimations-Prefix.pch"; sourceTree = ""; }; 50 | 83CEFDA31913DD0B00F82FA4 /* UINTAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UINTAppDelegate.h; sourceTree = ""; }; 51 | 83CEFDA41913DD0B00F82FA4 /* UINTAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UINTAppDelegate.m; sourceTree = ""; }; 52 | 83CEFDA91913DD0B00F82FA4 /* UINTViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UINTViewController.h; sourceTree = ""; }; 53 | 83CEFDAA1913DD0B00F82FA4 /* UINTViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UINTViewController.m; sourceTree = ""; }; 54 | 83CEFDAC1913DD0B00F82FA4 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 55 | 83CEFDB21913DD0B00F82FA4 /* InteractiveAnimationsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = InteractiveAnimationsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 83CEFDB31913DD0B00F82FA4 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 57 | 83CEFDBB1913DD0B00F82FA4 /* InteractiveAnimationsTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "InteractiveAnimationsTests-Info.plist"; sourceTree = ""; }; 58 | 83CEFDBD1913DD0B00F82FA4 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 59 | 83CEFDBF1913DD0B00F82FA4 /* InteractiveAnimationsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = InteractiveAnimationsTests.m; sourceTree = ""; }; 60 | 83CEFDC91913DEB800F82FA4 /* DraggableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DraggableView.m; sourceTree = ""; }; 61 | 83CEFDCA1913DEB800F82FA4 /* DraggableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DraggableView.h; sourceTree = ""; }; 62 | 83CEFDCF1913E00500F82FA4 /* Animator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Animator.h; sourceTree = ""; }; 63 | 83CEFDD01913E00500F82FA4 /* Animator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Animator.m; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 83CEFD8E1913DD0B00F82FA4 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 83CEFD971913DD0B00F82FA4 /* CoreGraphics.framework in Frameworks */, 72 | 83CEFD991913DD0B00F82FA4 /* UIKit.framework in Frameworks */, 73 | 83CEFD951913DD0B00F82FA4 /* Foundation.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | 83CEFDAF1913DD0B00F82FA4 /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | 83CEFDB41913DD0B00F82FA4 /* XCTest.framework in Frameworks */, 82 | 83CEFDB61913DD0B00F82FA4 /* UIKit.framework in Frameworks */, 83 | 83CEFDB51913DD0B00F82FA4 /* Foundation.framework in Frameworks */, 84 | ); 85 | runOnlyForDeploymentPostprocessing = 0; 86 | }; 87 | /* End PBXFrameworksBuildPhase section */ 88 | 89 | /* Begin PBXGroup section */ 90 | 83CEFD881913DD0B00F82FA4 = { 91 | isa = PBXGroup; 92 | children = ( 93 | 83CEFD9A1913DD0B00F82FA4 /* InteractiveAnimations */, 94 | 83CEFDB91913DD0B00F82FA4 /* InteractiveAnimationsTests */, 95 | 83CEFD931913DD0B00F82FA4 /* Frameworks */, 96 | 83CEFD921913DD0B00F82FA4 /* Products */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 83CEFD921913DD0B00F82FA4 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 83CEFD911913DD0B00F82FA4 /* InteractiveAnimations.app */, 104 | 83CEFDB21913DD0B00F82FA4 /* InteractiveAnimationsTests.xctest */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 83CEFD931913DD0B00F82FA4 /* Frameworks */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 83CEFD941913DD0B00F82FA4 /* Foundation.framework */, 113 | 83CEFD961913DD0B00F82FA4 /* CoreGraphics.framework */, 114 | 83CEFD981913DD0B00F82FA4 /* UIKit.framework */, 115 | 83CEFDB31913DD0B00F82FA4 /* XCTest.framework */, 116 | ); 117 | name = Frameworks; 118 | sourceTree = ""; 119 | }; 120 | 83CEFD9A1913DD0B00F82FA4 /* InteractiveAnimations */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 83CEFDCF1913E00500F82FA4 /* Animator.h */, 124 | 83CEFDD01913E00500F82FA4 /* Animator.m */, 125 | 83CEFDA31913DD0B00F82FA4 /* UINTAppDelegate.h */, 126 | 83CEFDA41913DD0B00F82FA4 /* UINTAppDelegate.m */, 127 | 83CEFDA91913DD0B00F82FA4 /* UINTViewController.h */, 128 | 83CEFDAA1913DD0B00F82FA4 /* UINTViewController.m */, 129 | 83CEFDC91913DEB800F82FA4 /* DraggableView.m */, 130 | 83CEFDCA1913DEB800F82FA4 /* DraggableView.h */, 131 | 83CEFDAC1913DD0B00F82FA4 /* Images.xcassets */, 132 | 83CEFD9B1913DD0B00F82FA4 /* Supporting Files */, 133 | 5A41610843B2253ACAC1463B /* UINTGeometryExtras.h */, 134 | 5A4163C5F060A17DE044D5AE /* UINTSpringAnimation.m */, 135 | 5A41674EE49361E12346E55A /* UINTSpringAnimation.h */, 136 | ); 137 | path = InteractiveAnimations; 138 | sourceTree = ""; 139 | }; 140 | 83CEFD9B1913DD0B00F82FA4 /* Supporting Files */ = { 141 | isa = PBXGroup; 142 | children = ( 143 | 83CEFD9C1913DD0B00F82FA4 /* InteractiveAnimations-Info.plist */, 144 | 83CEFD9D1913DD0B00F82FA4 /* InfoPlist.strings */, 145 | 83CEFDA01913DD0B00F82FA4 /* main.m */, 146 | 83CEFDA21913DD0B00F82FA4 /* InteractiveAnimations-Prefix.pch */, 147 | ); 148 | name = "Supporting Files"; 149 | sourceTree = ""; 150 | }; 151 | 83CEFDB91913DD0B00F82FA4 /* InteractiveAnimationsTests */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 83CEFDBF1913DD0B00F82FA4 /* InteractiveAnimationsTests.m */, 155 | 83CEFDBA1913DD0B00F82FA4 /* Supporting Files */, 156 | ); 157 | path = InteractiveAnimationsTests; 158 | sourceTree = ""; 159 | }; 160 | 83CEFDBA1913DD0B00F82FA4 /* Supporting Files */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | 83CEFDBB1913DD0B00F82FA4 /* InteractiveAnimationsTests-Info.plist */, 164 | 83CEFDBC1913DD0B00F82FA4 /* InfoPlist.strings */, 165 | ); 166 | name = "Supporting Files"; 167 | sourceTree = ""; 168 | }; 169 | /* End PBXGroup section */ 170 | 171 | /* Begin PBXNativeTarget section */ 172 | 83CEFD901913DD0B00F82FA4 /* InteractiveAnimations */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 83CEFDC31913DD0C00F82FA4 /* Build configuration list for PBXNativeTarget "InteractiveAnimations" */; 175 | buildPhases = ( 176 | 83CEFD8D1913DD0B00F82FA4 /* Sources */, 177 | 83CEFD8E1913DD0B00F82FA4 /* Frameworks */, 178 | 83CEFD8F1913DD0B00F82FA4 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | ); 184 | name = InteractiveAnimations; 185 | productName = InteractiveAnimations; 186 | productReference = 83CEFD911913DD0B00F82FA4 /* InteractiveAnimations.app */; 187 | productType = "com.apple.product-type.application"; 188 | }; 189 | 83CEFDB11913DD0B00F82FA4 /* InteractiveAnimationsTests */ = { 190 | isa = PBXNativeTarget; 191 | buildConfigurationList = 83CEFDC61913DD0C00F82FA4 /* Build configuration list for PBXNativeTarget "InteractiveAnimationsTests" */; 192 | buildPhases = ( 193 | 83CEFDAE1913DD0B00F82FA4 /* Sources */, 194 | 83CEFDAF1913DD0B00F82FA4 /* Frameworks */, 195 | 83CEFDB01913DD0B00F82FA4 /* Resources */, 196 | ); 197 | buildRules = ( 198 | ); 199 | dependencies = ( 200 | 83CEFDB81913DD0B00F82FA4 /* PBXTargetDependency */, 201 | ); 202 | name = InteractiveAnimationsTests; 203 | productName = InteractiveAnimationsTests; 204 | productReference = 83CEFDB21913DD0B00F82FA4 /* InteractiveAnimationsTests.xctest */; 205 | productType = "com.apple.product-type.bundle.unit-test"; 206 | }; 207 | /* End PBXNativeTarget section */ 208 | 209 | /* Begin PBXProject section */ 210 | 83CEFD891913DD0B00F82FA4 /* Project object */ = { 211 | isa = PBXProject; 212 | attributes = { 213 | CLASSPREFIX = UINT; 214 | LastUpgradeCheck = 0510; 215 | ORGANIZATIONNAME = "Unsigned Integer"; 216 | TargetAttributes = { 217 | 83CEFDB11913DD0B00F82FA4 = { 218 | TestTargetID = 83CEFD901913DD0B00F82FA4 /* InteractiveAnimations */; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 83CEFD8C1913DD0B00F82FA4 /* Build configuration list for PBXProject "InteractiveAnimations" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 83CEFD881913DD0B00F82FA4; 231 | productRefGroup = 83CEFD921913DD0B00F82FA4 /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 83CEFD901913DD0B00F82FA4 /* InteractiveAnimations */, 236 | 83CEFDB11913DD0B00F82FA4 /* InteractiveAnimationsTests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 83CEFD8F1913DD0B00F82FA4 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 83CEFDAD1913DD0B00F82FA4 /* Images.xcassets in Resources */, 247 | 83CEFD9F1913DD0B00F82FA4 /* InfoPlist.strings in Resources */, 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | }; 251 | 83CEFDB01913DD0B00F82FA4 /* Resources */ = { 252 | isa = PBXResourcesBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | 83CEFDBE1913DD0B00F82FA4 /* InfoPlist.strings in Resources */, 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | /* End PBXResourcesBuildPhase section */ 260 | 261 | /* Begin PBXSourcesBuildPhase section */ 262 | 83CEFD8D1913DD0B00F82FA4 /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 83CEFDA51913DD0B00F82FA4 /* UINTAppDelegate.m in Sources */, 267 | 83CEFDA11913DD0B00F82FA4 /* main.m in Sources */, 268 | 83CEFDCB1913DEB800F82FA4 /* DraggableView.m in Sources */, 269 | 83CEFDD11913E00500F82FA4 /* Animator.m in Sources */, 270 | 83CEFDAB1913DD0B00F82FA4 /* UINTViewController.m in Sources */, 271 | 5A4163FBAFEF7B65B4122A12 /* UINTSpringAnimation.m in Sources */, 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | 83CEFDAE1913DD0B00F82FA4 /* Sources */ = { 276 | isa = PBXSourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | 83CEFDC01913DD0B00F82FA4 /* InteractiveAnimationsTests.m in Sources */, 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXSourcesBuildPhase section */ 284 | 285 | /* Begin PBXTargetDependency section */ 286 | 83CEFDB81913DD0B00F82FA4 /* PBXTargetDependency */ = { 287 | isa = PBXTargetDependency; 288 | target = 83CEFD901913DD0B00F82FA4 /* InteractiveAnimations */; 289 | targetProxy = 83CEFDB71913DD0B00F82FA4 /* PBXContainerItemProxy */; 290 | }; 291 | /* End PBXTargetDependency section */ 292 | 293 | /* Begin PBXVariantGroup section */ 294 | 83CEFD9D1913DD0B00F82FA4 /* InfoPlist.strings */ = { 295 | isa = PBXVariantGroup; 296 | children = ( 297 | 83CEFD9E1913DD0B00F82FA4 /* en */, 298 | ); 299 | name = InfoPlist.strings; 300 | sourceTree = ""; 301 | }; 302 | 83CEFDBC1913DD0B00F82FA4 /* InfoPlist.strings */ = { 303 | isa = PBXVariantGroup; 304 | children = ( 305 | 83CEFDBD1913DD0B00F82FA4 /* en */, 306 | ); 307 | name = InfoPlist.strings; 308 | sourceTree = ""; 309 | }; 310 | /* End PBXVariantGroup section */ 311 | 312 | /* Begin XCBuildConfiguration section */ 313 | 83CEFDC11913DD0C00F82FA4 /* Debug */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ALWAYS_SEARCH_USER_PATHS = NO; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 330 | COPY_PHASE_STRIP = NO; 331 | GCC_C_LANGUAGE_STANDARD = gnu99; 332 | GCC_DYNAMIC_NO_PIC = NO; 333 | GCC_OPTIMIZATION_LEVEL = 0; 334 | GCC_PREPROCESSOR_DEFINITIONS = ( 335 | "DEBUG=1", 336 | "$(inherited)", 337 | ); 338 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 346 | ONLY_ACTIVE_ARCH = YES; 347 | SDKROOT = iphoneos; 348 | }; 349 | name = Debug; 350 | }; 351 | 83CEFDC21913DD0C00F82FA4 /* Release */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ALWAYS_SEARCH_USER_PATHS = NO; 355 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 356 | CLANG_CXX_LIBRARY = "libc++"; 357 | CLANG_ENABLE_MODULES = YES; 358 | CLANG_ENABLE_OBJC_ARC = YES; 359 | CLANG_WARN_BOOL_CONVERSION = YES; 360 | CLANG_WARN_CONSTANT_CONVERSION = YES; 361 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 362 | CLANG_WARN_EMPTY_BODY = YES; 363 | CLANG_WARN_ENUM_CONVERSION = YES; 364 | CLANG_WARN_INT_CONVERSION = YES; 365 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | COPY_PHASE_STRIP = YES; 369 | ENABLE_NS_ASSERTIONS = NO; 370 | GCC_C_LANGUAGE_STANDARD = gnu99; 371 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 372 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 373 | GCC_WARN_UNDECLARED_SELECTOR = YES; 374 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 375 | GCC_WARN_UNUSED_FUNCTION = YES; 376 | GCC_WARN_UNUSED_VARIABLE = YES; 377 | IPHONEOS_DEPLOYMENT_TARGET = 7.1; 378 | SDKROOT = iphoneos; 379 | VALIDATE_PRODUCT = YES; 380 | }; 381 | name = Release; 382 | }; 383 | 83CEFDC41913DD0C00F82FA4 /* Debug */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 387 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 388 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 389 | GCC_PREFIX_HEADER = "InteractiveAnimations/InteractiveAnimations-Prefix.pch"; 390 | INFOPLIST_FILE = "InteractiveAnimations/InteractiveAnimations-Info.plist"; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | WRAPPER_EXTENSION = app; 393 | }; 394 | name = Debug; 395 | }; 396 | 83CEFDC51913DD0C00F82FA4 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 400 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 401 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 402 | GCC_PREFIX_HEADER = "InteractiveAnimations/InteractiveAnimations-Prefix.pch"; 403 | INFOPLIST_FILE = "InteractiveAnimations/InteractiveAnimations-Info.plist"; 404 | PRODUCT_NAME = "$(TARGET_NAME)"; 405 | WRAPPER_EXTENSION = app; 406 | }; 407 | name = Release; 408 | }; 409 | 83CEFDC71913DD0C00F82FA4 /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/InteractiveAnimations.app/InteractiveAnimations"; 413 | FRAMEWORK_SEARCH_PATHS = ( 414 | "$(SDKROOT)/Developer/Library/Frameworks", 415 | "$(inherited)", 416 | "$(DEVELOPER_FRAMEWORKS_DIR)", 417 | ); 418 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 419 | GCC_PREFIX_HEADER = "InteractiveAnimations/InteractiveAnimations-Prefix.pch"; 420 | GCC_PREPROCESSOR_DEFINITIONS = ( 421 | "DEBUG=1", 422 | "$(inherited)", 423 | ); 424 | INFOPLIST_FILE = "InteractiveAnimationsTests/InteractiveAnimationsTests-Info.plist"; 425 | PRODUCT_NAME = "$(TARGET_NAME)"; 426 | TEST_HOST = "$(BUNDLE_LOADER)"; 427 | WRAPPER_EXTENSION = xctest; 428 | }; 429 | name = Debug; 430 | }; 431 | 83CEFDC81913DD0C00F82FA4 /* Release */ = { 432 | isa = XCBuildConfiguration; 433 | buildSettings = { 434 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/InteractiveAnimations.app/InteractiveAnimations"; 435 | FRAMEWORK_SEARCH_PATHS = ( 436 | "$(SDKROOT)/Developer/Library/Frameworks", 437 | "$(inherited)", 438 | "$(DEVELOPER_FRAMEWORKS_DIR)", 439 | ); 440 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 441 | GCC_PREFIX_HEADER = "InteractiveAnimations/InteractiveAnimations-Prefix.pch"; 442 | INFOPLIST_FILE = "InteractiveAnimationsTests/InteractiveAnimationsTests-Info.plist"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | TEST_HOST = "$(BUNDLE_LOADER)"; 445 | WRAPPER_EXTENSION = xctest; 446 | }; 447 | name = Release; 448 | }; 449 | /* End XCBuildConfiguration section */ 450 | 451 | /* Begin XCConfigurationList section */ 452 | 83CEFD8C1913DD0B00F82FA4 /* Build configuration list for PBXProject "InteractiveAnimations" */ = { 453 | isa = XCConfigurationList; 454 | buildConfigurations = ( 455 | 83CEFDC11913DD0C00F82FA4 /* Debug */, 456 | 83CEFDC21913DD0C00F82FA4 /* Release */, 457 | ); 458 | defaultConfigurationIsVisible = 0; 459 | defaultConfigurationName = Release; 460 | }; 461 | 83CEFDC31913DD0C00F82FA4 /* Build configuration list for PBXNativeTarget "InteractiveAnimations" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 83CEFDC41913DD0C00F82FA4 /* Debug */, 465 | 83CEFDC51913DD0C00F82FA4 /* Release */, 466 | ); 467 | defaultConfigurationIsVisible = 0; 468 | defaultConfigurationName = Release; 469 | }; 470 | 83CEFDC61913DD0C00F82FA4 /* Build configuration list for PBXNativeTarget "InteractiveAnimationsTests" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 83CEFDC71913DD0C00F82FA4 /* Debug */, 474 | 83CEFDC81913DD0C00F82FA4 /* Release */, 475 | ); 476 | defaultConfigurationIsVisible = 0; 477 | defaultConfigurationName = Release; 478 | }; 479 | /* End XCConfigurationList section */ 480 | }; 481 | rootObject = 83CEFD891913DD0B00F82FA4 /* Project object */; 482 | } 483 | -------------------------------------------------------------------------------- /InteractiveAnimations/Animator.h: -------------------------------------------------------------------------------- 1 | @protocol Animation 2 | - (void)animationTick:(CFTimeInterval)dt finished:(BOOL *)finished; 3 | @end 4 | 5 | @interface Animator : NSObject 6 | 7 | + (instancetype)animatorWithScreen:(UIScreen *)screen; 8 | 9 | - (void)addAnimation:(id)animatable; 10 | - (void)removeAnimation:(id)animatable; 11 | 12 | @end 13 | 14 | @interface UIView (AnimatorAdditions) 15 | 16 | - (Animator *)animator; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /InteractiveAnimations/Animator.m: -------------------------------------------------------------------------------- 1 | #import "Animator.h" 2 | #import 3 | 4 | static int ScreenAnimationDriverKey; 5 | 6 | @interface Animator () 7 | 8 | @property (nonatomic, strong) CADisplayLink *displayLink; 9 | @property (nonatomic, strong) NSMutableSet *animations; 10 | @end 11 | 12 | @implementation Animator 13 | { 14 | } 15 | 16 | + (instancetype)animatorWithScreen:(UIScreen *)screen 17 | { 18 | if (!screen) { 19 | screen = [UIScreen mainScreen]; 20 | } 21 | Animator *driver = objc_getAssociatedObject(screen, &ScreenAnimationDriverKey); 22 | if (!driver) { 23 | driver = [[self alloc] initWithScreen:screen]; 24 | objc_setAssociatedObject(screen, &ScreenAnimationDriverKey, driver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 25 | } 26 | return driver; 27 | } 28 | 29 | - (instancetype)initWithScreen:(UIScreen *)screen 30 | { 31 | self = [super init]; 32 | if (self) { 33 | self.displayLink = [screen displayLinkWithTarget:self selector:@selector(animationTick:)]; 34 | self.displayLink.paused = YES; 35 | [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; 36 | self.animations = [NSMutableSet new]; 37 | } 38 | return self; 39 | } 40 | 41 | - (void)addAnimation:(id)animation 42 | { 43 | [self.animations addObject:animation]; 44 | if (self.animations.count == 1) { 45 | self.displayLink.paused = NO; 46 | } 47 | } 48 | 49 | - (void)removeAnimation:(id )animatable 50 | { 51 | if (animatable == nil) return; 52 | 53 | [self.animations removeObject:animatable]; 54 | if (self.animations.count == 0) { 55 | self.displayLink.paused = YES; 56 | } 57 | } 58 | 59 | 60 | - (void)animationTick:(CADisplayLink *)displayLink 61 | { 62 | CFTimeInterval dt = displayLink.duration; 63 | for (id a in [self.animations copy]) { 64 | BOOL finished = NO; 65 | [a animationTick:dt finished:&finished]; 66 | if (finished) { 67 | [self.animations removeObject:a]; 68 | } 69 | } 70 | if (self.animations.count == 0) { 71 | self.displayLink.paused = YES; 72 | } 73 | } 74 | 75 | @end 76 | 77 | @implementation UIView (AnimatorAdditions) 78 | 79 | - (Animator *)animator 80 | { 81 | return [Animator animatorWithScreen:self.window.screen]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /InteractiveAnimations/DraggableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Florian on 21/04/14. 3 | // 4 | // To change the template use AppCode | Preferences | File Templates. 5 | // 6 | 7 | 8 | #import 9 | #import "Animator.h" 10 | 11 | 12 | @class DraggableView; 13 | 14 | 15 | @protocol DraggableViewDelegate 16 | 17 | - (void)draggableView:(DraggableView *)view draggingEndedWithVelocity:(CGPoint)velocity; 18 | - (void)draggableViewBeganDragging:(DraggableView *)view; 19 | 20 | @end 21 | 22 | 23 | @interface DraggableView : UIView 24 | 25 | @property (nonatomic, weak) id delegate; 26 | 27 | @end -------------------------------------------------------------------------------- /InteractiveAnimations/DraggableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Florian on 21/04/14. 3 | // 4 | // To change the template use AppCode | Preferences | File Templates. 5 | // 6 | 7 | 8 | #import "DraggableView.h" 9 | 10 | @implementation DraggableView 11 | 12 | - (id)initWithFrame:(CGRect)frame 13 | { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self setup]; 17 | } 18 | return self; 19 | } 20 | 21 | - (void)setup 22 | { 23 | UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didPan:)]; 24 | [self addGestureRecognizer:recognizer]; 25 | self.layer.cornerRadius = 6; 26 | } 27 | 28 | - (void)didPan:(UIPanGestureRecognizer *)recognizer 29 | { 30 | CGPoint point = [recognizer translationInView:self.superview]; 31 | self.center = CGPointMake(self.center.x, self.center.y + point.y); 32 | [recognizer setTranslation:CGPointZero inView:self.superview]; 33 | if (recognizer.state == UIGestureRecognizerStateEnded) { 34 | CGPoint velocity = [recognizer velocityInView:self.superview]; 35 | velocity.x = 0; 36 | [self.delegate draggableView:self draggingEndedWithVelocity:velocity]; 37 | } else if (recognizer.state == UIGestureRecognizerStateBegan) { 38 | [self.delegate draggableViewBeganDragging:self]; 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /InteractiveAnimations/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" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /InteractiveAnimations/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 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /InteractiveAnimations/InteractiveAnimations-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.unsignedinteger.${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 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /InteractiveAnimations/InteractiveAnimations-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 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINTAppDelegate.h 3 | // InteractiveAnimations 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UINTAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINTAppDelegate.m 3 | // InteractiveAnimations 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import "UINTAppDelegate.h" 10 | #import "UINTViewController.h" 11 | 12 | @implementation UINTAppDelegate 13 | 14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 15 | { 16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 17 | UINTViewController *viewController = [[UINTViewController alloc] init]; 18 | self.window.rootViewController = viewController; 19 | [self.window makeKeyAndVisible]; 20 | return YES; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTGeometryExtras.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by chris on 02.05.14. 3 | // 4 | 5 | #import 6 | 7 | static inline CGPoint CGPointSubtract(CGPoint p1, CGPoint p2) 8 | { 9 | return CGPointMake(p1.x - p2.x, p1.y - p2.y); 10 | } 11 | 12 | static inline CGPoint CGPointAdd(CGPoint p1, CGPoint p2) 13 | { 14 | return CGPointMake(p1.x + p2.x, p1.y + p2.y); 15 | } 16 | 17 | static inline CGPoint CGPointMultiply(CGPoint point, CGFloat multiplier) 18 | { 19 | return CGPointMake(point.x * multiplier, point.y * multiplier); 20 | } 21 | 22 | static inline CGFloat CGPointLength(CGPoint point) 23 | { 24 | return (CGFloat)sqrt(point.x * point.x + point.y * point.y); 25 | } -------------------------------------------------------------------------------- /InteractiveAnimations/UINTSpringAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by chris on 02.05.14. 3 | // 4 | 5 | #import 6 | #import "Animator.h" 7 | 8 | 9 | @interface UINTSpringAnimation : NSObject 10 | 11 | @property (nonatomic, readonly) CGPoint velocity; 12 | 13 | + (instancetype)animationWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTSpringAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by chris on 02.05.14. 3 | // 4 | 5 | #import "UINTSpringAnimation.h" 6 | #import "UINTGeometryExtras.h" 7 | 8 | @interface UINTSpringAnimation () 9 | 10 | @property (nonatomic) CGPoint velocity; 11 | @property (nonatomic) CGPoint targetPoint; 12 | @property (nonatomic) UIView *view; 13 | 14 | @end 15 | 16 | 17 | @implementation UINTSpringAnimation 18 | 19 | - (instancetype)initWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity 20 | { 21 | self = [super init]; 22 | if (self) { 23 | self.view = view; 24 | self.targetPoint = target; 25 | self.velocity = velocity; 26 | } 27 | return self; 28 | } 29 | 30 | + (instancetype)animationWithView:(UIView *)view target:(CGPoint)target velocity:(CGPoint)velocity 31 | { 32 | return [[self alloc] initWithView:view target:target velocity:velocity]; 33 | } 34 | 35 | - (void)animationTick:(CFTimeInterval)dt finished:(BOOL *)finished 36 | { 37 | static const float frictionConstant = 20; 38 | static const float springConstant = 300; 39 | CGFloat time = (CGFloat) dt; 40 | 41 | // friction force = velocity * friction constant 42 | CGPoint frictionForce = CGPointMultiply(self.velocity, frictionConstant); 43 | // spring force = (target point - current position) * spring constant 44 | CGPoint springForce = CGPointMultiply(CGPointSubtract(self.targetPoint, self.view.center), springConstant); 45 | // force = spring force - friction force 46 | CGPoint force = CGPointSubtract(springForce, frictionForce); 47 | // velocity = current velocity + force * time / mass 48 | self.velocity = CGPointAdd(self.velocity, CGPointMultiply(force, time)); 49 | // position = current position + velocity * time 50 | self.view.center = CGPointAdd(self.view.center, CGPointMultiply(self.velocity, time)); 51 | 52 | CGFloat speed = CGPointLength(self.velocity); 53 | CGFloat distanceToGoal = CGPointLength(CGPointSubtract(self.targetPoint, self.view.center)); 54 | if (speed < 0.05 && distanceToGoal < 1) { 55 | self.view.center = self.targetPoint; 56 | *finished = YES; 57 | } 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // UINTViewController.h 3 | // InteractiveAnimations 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class UINTAnimator; 12 | @class UINTSpringAnimation; 13 | 14 | @interface UINTViewController : UIViewController 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /InteractiveAnimations/UINTViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // UINTViewController.m 3 | // InteractiveAnimations 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import "UINTViewController.h" 10 | #import "DraggableView.h" 11 | #import "UINTSpringAnimation.h" 12 | 13 | typedef NS_ENUM(NSInteger, PaneState) { 14 | PaneStateOpen, 15 | PaneStateClosed, 16 | }; 17 | 18 | @interface UINTViewController () 19 | 20 | @property (nonatomic) PaneState paneState; 21 | @property (nonatomic, strong) DraggableView *pane; 22 | @property (nonatomic) UINTSpringAnimation *springAnimation; 23 | @end 24 | 25 | @implementation UINTViewController 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | self.view.backgroundColor = [UIColor whiteColor]; 31 | 32 | CGSize size = self.view.bounds.size; 33 | self.paneState = PaneStateClosed; 34 | DraggableView *view = [[DraggableView alloc] initWithFrame:CGRectMake(0, size.height * .75, size.width, size.height)]; 35 | view.backgroundColor = [UIColor grayColor]; 36 | view.delegate = self; 37 | [self.view addSubview:view]; 38 | self.pane = view; 39 | 40 | UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap:)]; 41 | [self.view addGestureRecognizer:tapRecognizer]; 42 | } 43 | 44 | - (CGPoint)targetPoint 45 | { 46 | CGSize size = self.view.bounds.size; 47 | CGPoint targetPoint = self.paneState == PaneStateClosed > 0 ? CGPointMake(size.width/2, size.height * 1.25) : CGPointMake(size.width/2, size.height/2 + 50); 48 | return targetPoint; 49 | } 50 | 51 | - (void)startAnimatingView:(DraggableView *)view initialVelocity:(CGPoint)initialVelocity 52 | { 53 | [self cancelSpringAnimation]; 54 | self.springAnimation = [UINTSpringAnimation animationWithView:view target:self.targetPoint velocity:initialVelocity]; 55 | [view.animator addAnimation:self.springAnimation]; 56 | } 57 | 58 | - (void)cancelSpringAnimation 59 | { 60 | [self.view.animator removeAnimation:self.springAnimation]; 61 | self.springAnimation = nil; 62 | } 63 | 64 | 65 | #pragma mark DraggableViewDelegate 66 | 67 | - (void)draggableView:(DraggableView *)view draggingEndedWithVelocity:(CGPoint)velocity 68 | { 69 | PaneState targetState = velocity.y >= 0 ? PaneStateClosed : PaneStateOpen; 70 | self.paneState = targetState; 71 | [self startAnimatingView:view initialVelocity:velocity]; 72 | } 73 | 74 | - (void)draggableViewBeganDragging:(DraggableView *)view 75 | { 76 | [self cancelSpringAnimation]; 77 | } 78 | 79 | 80 | #pragma mark Actions 81 | 82 | - (void)didTap:(UITapGestureRecognizer *)tapRecognizer 83 | { 84 | PaneState targetState = self.paneState == PaneStateOpen ? PaneStateClosed : PaneStateOpen; 85 | self.paneState = targetState; 86 | [self startAnimatingView:self.pane initialVelocity:self.springAnimation.velocity]; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /InteractiveAnimations/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /InteractiveAnimations/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // InteractiveAnimations 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "UINTAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([UINTAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InteractiveAnimationsTests/InteractiveAnimationsTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.unsignedinteger.${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 | -------------------------------------------------------------------------------- /InteractiveAnimationsTests/InteractiveAnimationsTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // InteractiveAnimationsTests.m 3 | // InteractiveAnimationsTests 4 | // 5 | // Created by Chris Eidhof on 02.05.14. 6 | // Copyright (c) 2014 Unsigned Integer. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface InteractiveAnimationsTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation InteractiveAnimationsTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /InteractiveAnimationsTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | --------------------------------------------------------------------------------