├── .gitignore ├── LICENSE ├── PScaleLoading.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── xp_mac.xcuserdatad │ └── xcschemes │ ├── PScaleLoading.xcscheme │ └── xcschememanagement.plist ├── PScaleLoading ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── CustomShapeLayer.h ├── CustomShapeLayer.m ├── DurModel.h ├── DurModel.m ├── Info.plist ├── MainViewController.h ├── MainViewController.m ├── PScaleLoadingView.h ├── PScaleLoadingView.m └── main.m ├── PScaleLoadingTests ├── Info.plist └── PScaleLoadingTests.m ├── PScaleLoadingUITests ├── Info.plist └── PScaleLoadingUITests.m ├── README.md ├── loading.gif └── myloading.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PScaleLoading.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 88F116B41C83E84900F431B7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116B31C83E84900F431B7 /* main.m */; }; 11 | 88F116BF1C83E84900F431B7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 88F116BE1C83E84900F431B7 /* Assets.xcassets */; }; 12 | 88F116C21C83E84900F431B7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 88F116C01C83E84900F431B7 /* LaunchScreen.storyboard */; }; 13 | 88F116CD1C83E84A00F431B7 /* PScaleLoadingTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116CC1C83E84A00F431B7 /* PScaleLoadingTests.m */; }; 14 | 88F116D81C83E84A00F431B7 /* PScaleLoadingUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116D71C83E84A00F431B7 /* PScaleLoadingUITests.m */; }; 15 | 88F116E71C83E88E00F431B7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116E61C83E88E00F431B7 /* AppDelegate.m */; }; 16 | 88F116F01C83E8B000F431B7 /* DurModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116E91C83E8B000F431B7 /* DurModel.m */; }; 17 | 88F116F11C83E8B000F431B7 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116EB1C83E8B000F431B7 /* MainViewController.m */; }; 18 | 88F116F21C83E8B000F431B7 /* PScaleLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116ED1C83E8B000F431B7 /* PScaleLoadingView.m */; }; 19 | 88F116F31C83E8B000F431B7 /* CustomShapeLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 88F116EF1C83E8B000F431B7 /* CustomShapeLayer.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 88F116C91C83E84A00F431B7 /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 88F116A71C83E84900F431B7 /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 88F116AE1C83E84900F431B7; 28 | remoteInfo = PScaleLoading; 29 | }; 30 | 88F116D41C83E84A00F431B7 /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 88F116A71C83E84900F431B7 /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 88F116AE1C83E84900F431B7; 35 | remoteInfo = PScaleLoading; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 88F116AF1C83E84900F431B7 /* PScaleLoading.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PScaleLoading.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 88F116B31C83E84900F431B7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 42 | 88F116BE1C83E84900F431B7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 88F116C11C83E84900F431B7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 88F116C31C83E84900F431B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 88F116C81C83E84A00F431B7 /* PScaleLoadingTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PScaleLoadingTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 88F116CC1C83E84A00F431B7 /* PScaleLoadingTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PScaleLoadingTests.m; sourceTree = ""; }; 47 | 88F116CE1C83E84A00F431B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 88F116D31C83E84A00F431B7 /* PScaleLoadingUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PScaleLoadingUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 88F116D71C83E84A00F431B7 /* PScaleLoadingUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PScaleLoadingUITests.m; sourceTree = ""; }; 50 | 88F116D91C83E84A00F431B7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 88F116E51C83E88E00F431B7 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 88F116E61C83E88E00F431B7 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 88F116E81C83E8B000F431B7 /* DurModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DurModel.h; sourceTree = ""; }; 54 | 88F116E91C83E8B000F431B7 /* DurModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DurModel.m; sourceTree = ""; }; 55 | 88F116EA1C83E8B000F431B7 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; 56 | 88F116EB1C83E8B000F431B7 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; 57 | 88F116EC1C83E8B000F431B7 /* PScaleLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PScaleLoadingView.h; sourceTree = ""; }; 58 | 88F116ED1C83E8B000F431B7 /* PScaleLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PScaleLoadingView.m; sourceTree = ""; }; 59 | 88F116EE1C83E8B000F431B7 /* CustomShapeLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomShapeLayer.h; sourceTree = ""; }; 60 | 88F116EF1C83E8B000F431B7 /* CustomShapeLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomShapeLayer.m; sourceTree = ""; }; 61 | /* End PBXFileReference section */ 62 | 63 | /* Begin PBXFrameworksBuildPhase section */ 64 | 88F116AC1C83E84900F431B7 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 88F116C51C83E84A00F431B7 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | 88F116D01C83E84A00F431B7 /* Frameworks */ = { 79 | isa = PBXFrameworksBuildPhase; 80 | buildActionMask = 2147483647; 81 | files = ( 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 88F116A61C83E84900F431B7 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 88F116B11C83E84900F431B7 /* PScaleLoading */, 92 | 88F116CB1C83E84A00F431B7 /* PScaleLoadingTests */, 93 | 88F116D61C83E84A00F431B7 /* PScaleLoadingUITests */, 94 | 88F116B01C83E84900F431B7 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 88F116B01C83E84900F431B7 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 88F116AF1C83E84900F431B7 /* PScaleLoading.app */, 102 | 88F116C81C83E84A00F431B7 /* PScaleLoadingTests.xctest */, 103 | 88F116D31C83E84A00F431B7 /* PScaleLoadingUITests.xctest */, 104 | ); 105 | name = Products; 106 | sourceTree = ""; 107 | }; 108 | 88F116B11C83E84900F431B7 /* PScaleLoading */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 88F116F61C83E8CF00F431B7 /* View */, 112 | 88F116F51C83E8C300F431B7 /* ViewController */, 113 | 88F116F41C83E8BB00F431B7 /* Model */, 114 | 88F116E51C83E88E00F431B7 /* AppDelegate.h */, 115 | 88F116E61C83E88E00F431B7 /* AppDelegate.m */, 116 | 88F116BE1C83E84900F431B7 /* Assets.xcassets */, 117 | 88F116C01C83E84900F431B7 /* LaunchScreen.storyboard */, 118 | 88F116C31C83E84900F431B7 /* Info.plist */, 119 | 88F116B21C83E84900F431B7 /* Supporting Files */, 120 | ); 121 | path = PScaleLoading; 122 | sourceTree = ""; 123 | }; 124 | 88F116B21C83E84900F431B7 /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 88F116B31C83E84900F431B7 /* main.m */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | 88F116CB1C83E84A00F431B7 /* PScaleLoadingTests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 88F116CC1C83E84A00F431B7 /* PScaleLoadingTests.m */, 136 | 88F116CE1C83E84A00F431B7 /* Info.plist */, 137 | ); 138 | path = PScaleLoadingTests; 139 | sourceTree = ""; 140 | }; 141 | 88F116D61C83E84A00F431B7 /* PScaleLoadingUITests */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 88F116D71C83E84A00F431B7 /* PScaleLoadingUITests.m */, 145 | 88F116D91C83E84A00F431B7 /* Info.plist */, 146 | ); 147 | path = PScaleLoadingUITests; 148 | sourceTree = ""; 149 | }; 150 | 88F116F41C83E8BB00F431B7 /* Model */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 88F116E81C83E8B000F431B7 /* DurModel.h */, 154 | 88F116E91C83E8B000F431B7 /* DurModel.m */, 155 | ); 156 | name = Model; 157 | sourceTree = ""; 158 | }; 159 | 88F116F51C83E8C300F431B7 /* ViewController */ = { 160 | isa = PBXGroup; 161 | children = ( 162 | 88F116EA1C83E8B000F431B7 /* MainViewController.h */, 163 | 88F116EB1C83E8B000F431B7 /* MainViewController.m */, 164 | ); 165 | name = ViewController; 166 | sourceTree = ""; 167 | }; 168 | 88F116F61C83E8CF00F431B7 /* View */ = { 169 | isa = PBXGroup; 170 | children = ( 171 | 88F116EC1C83E8B000F431B7 /* PScaleLoadingView.h */, 172 | 88F116ED1C83E8B000F431B7 /* PScaleLoadingView.m */, 173 | 88F116EE1C83E8B000F431B7 /* CustomShapeLayer.h */, 174 | 88F116EF1C83E8B000F431B7 /* CustomShapeLayer.m */, 175 | ); 176 | name = View; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXGroup section */ 180 | 181 | /* Begin PBXNativeTarget section */ 182 | 88F116AE1C83E84900F431B7 /* PScaleLoading */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = 88F116DC1C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoading" */; 185 | buildPhases = ( 186 | 88F116AB1C83E84900F431B7 /* Sources */, 187 | 88F116AC1C83E84900F431B7 /* Frameworks */, 188 | 88F116AD1C83E84900F431B7 /* Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | ); 194 | name = PScaleLoading; 195 | productName = PScaleLoading; 196 | productReference = 88F116AF1C83E84900F431B7 /* PScaleLoading.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | 88F116C71C83E84A00F431B7 /* PScaleLoadingTests */ = { 200 | isa = PBXNativeTarget; 201 | buildConfigurationList = 88F116DF1C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoadingTests" */; 202 | buildPhases = ( 203 | 88F116C41C83E84A00F431B7 /* Sources */, 204 | 88F116C51C83E84A00F431B7 /* Frameworks */, 205 | 88F116C61C83E84A00F431B7 /* Resources */, 206 | ); 207 | buildRules = ( 208 | ); 209 | dependencies = ( 210 | 88F116CA1C83E84A00F431B7 /* PBXTargetDependency */, 211 | ); 212 | name = PScaleLoadingTests; 213 | productName = PScaleLoadingTests; 214 | productReference = 88F116C81C83E84A00F431B7 /* PScaleLoadingTests.xctest */; 215 | productType = "com.apple.product-type.bundle.unit-test"; 216 | }; 217 | 88F116D21C83E84A00F431B7 /* PScaleLoadingUITests */ = { 218 | isa = PBXNativeTarget; 219 | buildConfigurationList = 88F116E21C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoadingUITests" */; 220 | buildPhases = ( 221 | 88F116CF1C83E84A00F431B7 /* Sources */, 222 | 88F116D01C83E84A00F431B7 /* Frameworks */, 223 | 88F116D11C83E84A00F431B7 /* Resources */, 224 | ); 225 | buildRules = ( 226 | ); 227 | dependencies = ( 228 | 88F116D51C83E84A00F431B7 /* PBXTargetDependency */, 229 | ); 230 | name = PScaleLoadingUITests; 231 | productName = PScaleLoadingUITests; 232 | productReference = 88F116D31C83E84A00F431B7 /* PScaleLoadingUITests.xctest */; 233 | productType = "com.apple.product-type.bundle.ui-testing"; 234 | }; 235 | /* End PBXNativeTarget section */ 236 | 237 | /* Begin PBXProject section */ 238 | 88F116A71C83E84900F431B7 /* Project object */ = { 239 | isa = PBXProject; 240 | attributes = { 241 | LastUpgradeCheck = 0710; 242 | ORGANIZATIONNAME = xp_mac; 243 | TargetAttributes = { 244 | 88F116AE1C83E84900F431B7 = { 245 | CreatedOnToolsVersion = 7.1.1; 246 | }; 247 | 88F116C71C83E84A00F431B7 = { 248 | CreatedOnToolsVersion = 7.1.1; 249 | DevelopmentTeam = Y42CU4L747; 250 | TestTargetID = 88F116AE1C83E84900F431B7; 251 | }; 252 | 88F116D21C83E84A00F431B7 = { 253 | CreatedOnToolsVersion = 7.1.1; 254 | DevelopmentTeam = Y42CU4L747; 255 | TestTargetID = 88F116AE1C83E84900F431B7; 256 | }; 257 | }; 258 | }; 259 | buildConfigurationList = 88F116AA1C83E84900F431B7 /* Build configuration list for PBXProject "PScaleLoading" */; 260 | compatibilityVersion = "Xcode 3.2"; 261 | developmentRegion = English; 262 | hasScannedForEncodings = 0; 263 | knownRegions = ( 264 | en, 265 | Base, 266 | ); 267 | mainGroup = 88F116A61C83E84900F431B7; 268 | productRefGroup = 88F116B01C83E84900F431B7 /* Products */; 269 | projectDirPath = ""; 270 | projectRoot = ""; 271 | targets = ( 272 | 88F116AE1C83E84900F431B7 /* PScaleLoading */, 273 | 88F116C71C83E84A00F431B7 /* PScaleLoadingTests */, 274 | 88F116D21C83E84A00F431B7 /* PScaleLoadingUITests */, 275 | ); 276 | }; 277 | /* End PBXProject section */ 278 | 279 | /* Begin PBXResourcesBuildPhase section */ 280 | 88F116AD1C83E84900F431B7 /* Resources */ = { 281 | isa = PBXResourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | 88F116C21C83E84900F431B7 /* LaunchScreen.storyboard in Resources */, 285 | 88F116BF1C83E84900F431B7 /* Assets.xcassets in Resources */, 286 | ); 287 | runOnlyForDeploymentPostprocessing = 0; 288 | }; 289 | 88F116C61C83E84A00F431B7 /* Resources */ = { 290 | isa = PBXResourcesBuildPhase; 291 | buildActionMask = 2147483647; 292 | files = ( 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | 88F116D11C83E84A00F431B7 /* Resources */ = { 297 | isa = PBXResourcesBuildPhase; 298 | buildActionMask = 2147483647; 299 | files = ( 300 | ); 301 | runOnlyForDeploymentPostprocessing = 0; 302 | }; 303 | /* End PBXResourcesBuildPhase section */ 304 | 305 | /* Begin PBXSourcesBuildPhase section */ 306 | 88F116AB1C83E84900F431B7 /* Sources */ = { 307 | isa = PBXSourcesBuildPhase; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | 88F116E71C83E88E00F431B7 /* AppDelegate.m in Sources */, 311 | 88F116B41C83E84900F431B7 /* main.m in Sources */, 312 | 88F116F21C83E8B000F431B7 /* PScaleLoadingView.m in Sources */, 313 | 88F116F01C83E8B000F431B7 /* DurModel.m in Sources */, 314 | 88F116F31C83E8B000F431B7 /* CustomShapeLayer.m in Sources */, 315 | 88F116F11C83E8B000F431B7 /* MainViewController.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | 88F116C41C83E84A00F431B7 /* Sources */ = { 320 | isa = PBXSourcesBuildPhase; 321 | buildActionMask = 2147483647; 322 | files = ( 323 | 88F116CD1C83E84A00F431B7 /* PScaleLoadingTests.m in Sources */, 324 | ); 325 | runOnlyForDeploymentPostprocessing = 0; 326 | }; 327 | 88F116CF1C83E84A00F431B7 /* Sources */ = { 328 | isa = PBXSourcesBuildPhase; 329 | buildActionMask = 2147483647; 330 | files = ( 331 | 88F116D81C83E84A00F431B7 /* PScaleLoadingUITests.m in Sources */, 332 | ); 333 | runOnlyForDeploymentPostprocessing = 0; 334 | }; 335 | /* End PBXSourcesBuildPhase section */ 336 | 337 | /* Begin PBXTargetDependency section */ 338 | 88F116CA1C83E84A00F431B7 /* PBXTargetDependency */ = { 339 | isa = PBXTargetDependency; 340 | target = 88F116AE1C83E84900F431B7 /* PScaleLoading */; 341 | targetProxy = 88F116C91C83E84A00F431B7 /* PBXContainerItemProxy */; 342 | }; 343 | 88F116D51C83E84A00F431B7 /* PBXTargetDependency */ = { 344 | isa = PBXTargetDependency; 345 | target = 88F116AE1C83E84900F431B7 /* PScaleLoading */; 346 | targetProxy = 88F116D41C83E84A00F431B7 /* PBXContainerItemProxy */; 347 | }; 348 | /* End PBXTargetDependency section */ 349 | 350 | /* Begin PBXVariantGroup section */ 351 | 88F116C01C83E84900F431B7 /* LaunchScreen.storyboard */ = { 352 | isa = PBXVariantGroup; 353 | children = ( 354 | 88F116C11C83E84900F431B7 /* Base */, 355 | ); 356 | name = LaunchScreen.storyboard; 357 | sourceTree = ""; 358 | }; 359 | /* End PBXVariantGroup section */ 360 | 361 | /* Begin XCBuildConfiguration section */ 362 | 88F116DA1C83E84A00F431B7 /* Debug */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | ALWAYS_SEARCH_USER_PATHS = NO; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_CONSTANT_CONVERSION = YES; 372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 373 | CLANG_WARN_EMPTY_BODY = YES; 374 | CLANG_WARN_ENUM_CONVERSION = YES; 375 | CLANG_WARN_INT_CONVERSION = YES; 376 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 377 | CLANG_WARN_UNREACHABLE_CODE = YES; 378 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 379 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 380 | COPY_PHASE_STRIP = NO; 381 | DEBUG_INFORMATION_FORMAT = dwarf; 382 | ENABLE_STRICT_OBJC_MSGSEND = YES; 383 | ENABLE_TESTABILITY = YES; 384 | GCC_C_LANGUAGE_STANDARD = gnu99; 385 | GCC_DYNAMIC_NO_PIC = NO; 386 | GCC_NO_COMMON_BLOCKS = YES; 387 | GCC_OPTIMIZATION_LEVEL = 0; 388 | GCC_PREPROCESSOR_DEFINITIONS = ( 389 | "DEBUG=1", 390 | "$(inherited)", 391 | ); 392 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 393 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 394 | GCC_WARN_UNDECLARED_SELECTOR = YES; 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 396 | GCC_WARN_UNUSED_FUNCTION = YES; 397 | GCC_WARN_UNUSED_VARIABLE = YES; 398 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 399 | MTL_ENABLE_DEBUG_INFO = YES; 400 | ONLY_ACTIVE_ARCH = YES; 401 | SDKROOT = iphoneos; 402 | TARGETED_DEVICE_FAMILY = "1,2"; 403 | }; 404 | name = Debug; 405 | }; 406 | 88F116DB1C83E84A00F431B7 /* Release */ = { 407 | isa = XCBuildConfiguration; 408 | buildSettings = { 409 | ALWAYS_SEARCH_USER_PATHS = NO; 410 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 411 | CLANG_CXX_LIBRARY = "libc++"; 412 | CLANG_ENABLE_MODULES = YES; 413 | CLANG_ENABLE_OBJC_ARC = YES; 414 | CLANG_WARN_BOOL_CONVERSION = YES; 415 | CLANG_WARN_CONSTANT_CONVERSION = YES; 416 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 417 | CLANG_WARN_EMPTY_BODY = YES; 418 | CLANG_WARN_ENUM_CONVERSION = YES; 419 | CLANG_WARN_INT_CONVERSION = YES; 420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 421 | CLANG_WARN_UNREACHABLE_CODE = YES; 422 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 423 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 424 | COPY_PHASE_STRIP = NO; 425 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 426 | ENABLE_NS_ASSERTIONS = NO; 427 | ENABLE_STRICT_OBJC_MSGSEND = YES; 428 | GCC_C_LANGUAGE_STANDARD = gnu99; 429 | GCC_NO_COMMON_BLOCKS = YES; 430 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 431 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 432 | GCC_WARN_UNDECLARED_SELECTOR = YES; 433 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 434 | GCC_WARN_UNUSED_FUNCTION = YES; 435 | GCC_WARN_UNUSED_VARIABLE = YES; 436 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 437 | MTL_ENABLE_DEBUG_INFO = NO; 438 | SDKROOT = iphoneos; 439 | TARGETED_DEVICE_FAMILY = "1,2"; 440 | VALIDATE_PRODUCT = YES; 441 | }; 442 | name = Release; 443 | }; 444 | 88F116DD1C83E84A00F431B7 /* Debug */ = { 445 | isa = XCBuildConfiguration; 446 | buildSettings = { 447 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 448 | CODE_SIGN_IDENTITY = "iPhone Developer"; 449 | INFOPLIST_FILE = PScaleLoading/Info.plist; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 452 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoading; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | }; 455 | name = Debug; 456 | }; 457 | 88F116DE1C83E84A00F431B7 /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | CODE_SIGN_IDENTITY = "iPhone Developer"; 462 | INFOPLIST_FILE = PScaleLoading/Info.plist; 463 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoading; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | }; 468 | name = Release; 469 | }; 470 | 88F116E01C83E84A00F431B7 /* Debug */ = { 471 | isa = XCBuildConfiguration; 472 | buildSettings = { 473 | BUNDLE_LOADER = "$(TEST_HOST)"; 474 | INFOPLIST_FILE = PScaleLoadingTests/Info.plist; 475 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 476 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoadingTests; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PScaleLoading.app/PScaleLoading"; 479 | }; 480 | name = Debug; 481 | }; 482 | 88F116E11C83E84A00F431B7 /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | BUNDLE_LOADER = "$(TEST_HOST)"; 486 | INFOPLIST_FILE = PScaleLoadingTests/Info.plist; 487 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 488 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoadingTests; 489 | PRODUCT_NAME = "$(TARGET_NAME)"; 490 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PScaleLoading.app/PScaleLoading"; 491 | }; 492 | name = Release; 493 | }; 494 | 88F116E31C83E84A00F431B7 /* Debug */ = { 495 | isa = XCBuildConfiguration; 496 | buildSettings = { 497 | INFOPLIST_FILE = PScaleLoadingUITests/Info.plist; 498 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 499 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoadingUITests; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | TEST_TARGET_NAME = PScaleLoading; 502 | USES_XCTRUNNER = YES; 503 | }; 504 | name = Debug; 505 | }; 506 | 88F116E41C83E84A00F431B7 /* Release */ = { 507 | isa = XCBuildConfiguration; 508 | buildSettings = { 509 | INFOPLIST_FILE = PScaleLoadingUITests/Info.plist; 510 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 511 | PRODUCT_BUNDLE_IDENTIFIER = com.Animation.PScaleLoadingUITests; 512 | PRODUCT_NAME = "$(TARGET_NAME)"; 513 | TEST_TARGET_NAME = PScaleLoading; 514 | USES_XCTRUNNER = YES; 515 | }; 516 | name = Release; 517 | }; 518 | /* End XCBuildConfiguration section */ 519 | 520 | /* Begin XCConfigurationList section */ 521 | 88F116AA1C83E84900F431B7 /* Build configuration list for PBXProject "PScaleLoading" */ = { 522 | isa = XCConfigurationList; 523 | buildConfigurations = ( 524 | 88F116DA1C83E84A00F431B7 /* Debug */, 525 | 88F116DB1C83E84A00F431B7 /* Release */, 526 | ); 527 | defaultConfigurationIsVisible = 0; 528 | defaultConfigurationName = Release; 529 | }; 530 | 88F116DC1C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoading" */ = { 531 | isa = XCConfigurationList; 532 | buildConfigurations = ( 533 | 88F116DD1C83E84A00F431B7 /* Debug */, 534 | 88F116DE1C83E84A00F431B7 /* Release */, 535 | ); 536 | defaultConfigurationIsVisible = 0; 537 | defaultConfigurationName = Release; 538 | }; 539 | 88F116DF1C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoadingTests" */ = { 540 | isa = XCConfigurationList; 541 | buildConfigurations = ( 542 | 88F116E01C83E84A00F431B7 /* Debug */, 543 | 88F116E11C83E84A00F431B7 /* Release */, 544 | ); 545 | defaultConfigurationIsVisible = 0; 546 | defaultConfigurationName = Release; 547 | }; 548 | 88F116E21C83E84A00F431B7 /* Build configuration list for PBXNativeTarget "PScaleLoadingUITests" */ = { 549 | isa = XCConfigurationList; 550 | buildConfigurations = ( 551 | 88F116E31C83E84A00F431B7 /* Debug */, 552 | 88F116E41C83E84A00F431B7 /* Release */, 553 | ); 554 | defaultConfigurationIsVisible = 0; 555 | defaultConfigurationName = Release; 556 | }; 557 | /* End XCConfigurationList section */ 558 | }; 559 | rootObject = 88F116A71C83E84900F431B7 /* Project object */; 560 | } 561 | -------------------------------------------------------------------------------- /PScaleLoading.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PScaleLoading.xcodeproj/xcuserdata/xp_mac.xcuserdatad/xcschemes/PScaleLoading.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /PScaleLoading.xcodeproj/xcuserdata/xp_mac.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PScaleLoading.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 88F116AE1C83E84900F431B7 16 | 17 | primary 18 | 19 | 20 | 88F116C71C83E84A00F431B7 21 | 22 | primary 23 | 24 | 25 | 88F116D21C83E84A00F431B7 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /PScaleLoading/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PScaleLoading 4 | // 5 | // Created by on 16-2-26. 6 | // Copyright (c) 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PScaleLoading/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PScaleLoading 4 | // 5 | // Created by on 16-2-26. 6 | // Copyright (c) 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "MainViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | 21 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | //主视图控制器 24 | MainViewController *mainVC = [[MainViewController alloc] init]; 25 | self.window.rootViewController = mainVC; 26 | 27 | [self.window makeKeyAndVisible]; 28 | 29 | 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application { 34 | // 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. 35 | // 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. 36 | } 37 | 38 | - (void)applicationDidEnterBackground:(UIApplication *)application { 39 | // 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. 40 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 41 | } 42 | 43 | - (void)applicationWillEnterForeground:(UIApplication *)application { 44 | // 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. 45 | } 46 | 47 | - (void)applicationDidBecomeActive:(UIApplication *)application { 48 | // 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. 49 | } 50 | 51 | - (void)applicationWillTerminate:(UIApplication *)application { 52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /PScaleLoading/Assets.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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /PScaleLoading/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /PScaleLoading/CustomShapeLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CircleShapeLayer.h 3 | // testAnimation 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CustomShapeLayer : CAShapeLayer 12 | 13 | - (instancetype) initTheFrame:(CGRect)frame withIndex:(NSInteger)index; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /PScaleLoading/CustomShapeLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CircleShapeLayer.m 3 | // testAnimation 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import "CustomShapeLayer.h" 10 | #import 11 | 12 | @implementation CustomShapeLayer 13 | 14 | - (instancetype) initTheFrame:(CGRect)frame withIndex:(NSInteger)index 15 | { 16 | self = [super init]; 17 | if (self) { 18 | 19 | self.frame = CGRectMake(99.5, 99.5, 1, 1); 20 | self.path = [self rectanglePath].CGPath; 21 | self.fillColor = [UIColor colorWithRed:0.875 green: 0.227 blue:0.118 alpha:1].CGColor; 22 | self.lineWidth = 0; 23 | } 24 | return self; 25 | } 26 | 27 | - (UIBezierPath *) rectanglePath 28 | { 29 | UIBezierPath *rectangle1Path = [UIBezierPath bezierPath]; 30 | [rectangle1Path moveToPoint:CGPointMake(0.189, 0.995)]; 31 | [rectangle1Path addCurveToPoint:CGPointMake(0.459, 0.993) controlPoint1:CGPointMake(0.26, 0.996) controlPoint2:CGPointMake(0.388, 0.992)]; 32 | [rectangle1Path addCurveToPoint:CGPointMake(0.758, 1) controlPoint1:CGPointMake(0.53, 0.994) controlPoint2:CGPointMake(0.687, 0.999)]; 33 | [rectangle1Path addLineToPoint:CGPointMake(1, 0.059)]; 34 | [rectangle1Path addCurveToPoint:CGPointMake(0.502, 0) controlPoint1:CGPointMake(0.877, 0.022) controlPoint2:CGPointMake(0.635, 0.002)]; 35 | [rectangle1Path addCurveToPoint:CGPointMake(0, 0.046) controlPoint1:CGPointMake(0.381, -0.002) controlPoint2:CGPointMake(0.128, 0.028)]; 36 | [rectangle1Path closePath]; 37 | [rectangle1Path moveToPoint:CGPointMake(0.189, 0.995)]; 38 | return rectangle1Path; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /PScaleLoading/DurModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // DurModel.h 3 | // PScaleLoading 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface DurModel : NSObject 13 | 14 | + (CGFloat) initWithTheDuration:(CABasicAnimation *)animation ; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /PScaleLoading/DurModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // DurModel.m 3 | // PScaleLoading 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import "DurModel.h" 10 | 11 | @implementation DurModel 12 | 13 | + (CGFloat) initWithTheDuration:(CABasicAnimation *)animation 14 | { 15 | CGFloat maxDuration = 0; 16 | maxDuration = MAX(animation.beginTime + animation.duration * (CGFloat)(animation.repeatCount == 0 ? 1.0f : animation.repeatCount) * (animation.autoreverses ? 2.0f : 1.0f), maxDuration); 17 | return maxDuration; 18 | } 19 | 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /PScaleLoading/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /PScaleLoading/MainViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PScaleLoading 4 | // 5 | // Created by on 16-2-26. 6 | // Copyright (c) 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MainViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /PScaleLoading/MainViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PScaleLoading 4 | // 5 | // Created by on 16-2-26. 6 | // Copyright (c) 2016年 Carl. All rights reserved. 7 | // 8 | 9 | #import "MainViewController.h" 10 | #import "PScaleLoadingView.h" 11 | 12 | @interface MainViewController () 13 | 14 | @property (nonatomic,strong) PScaleLoadingView *animationV; 15 | 16 | @end 17 | 18 | @implementation MainViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.view.backgroundColor = [UIColor colorWithRed:168/255.f green:169/255.f blue:38/255.f alpha:1.0]; 24 | 25 | _animationV = [[PScaleLoadingView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; 26 | _animationV.center = self.view.center; 27 | [_animationV customAnimations]; 28 | [self.view addSubview:_animationV]; 29 | 30 | NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:9 target:self selector:@selector(restartAnimation) userInfo:nil repeats:YES]; 31 | [timer fire]; 32 | } 33 | 34 | - (void) restartAnimation 35 | { 36 | [_animationV removeFromSuperview]; 37 | 38 | PScaleLoadingView *customAnimationV = [[PScaleLoadingView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; 39 | customAnimationV.center = self.view.center; 40 | [customAnimationV customAnimations]; 41 | [self.view addSubview:customAnimationV]; 42 | } 43 | 44 | - (void)didReceiveMemoryWarning { 45 | [super didReceiveMemoryWarning]; 46 | // Dispose of any resources that can be recreated. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /PScaleLoading/PScaleLoadingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PScaleLoadingView.h 3 | // testAnimation 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface PScaleLoadingView : UIView 13 | 14 | - (void)customAnimations; 15 | - (void)removeAllAnimations; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /PScaleLoading/PScaleLoadingView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PScaleLoadingView.h 3 | // testAnimation 4 | // 5 | // Created by xp_mac on 16/2/26. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import "PScaleLoadingView.h" 10 | #import "CustomShapeLayer.h" 11 | #import "DurModel.h" 12 | 13 | #define DURATION_TIME 1 14 | 15 | @interface PScaleLoadingView () 16 | 17 | @property (nonatomic, strong) NSMutableDictionary * layers; 18 | @property (nonatomic, strong) NSMapTable * completionBlocks; 19 | 20 | @end 21 | 22 | @implementation PScaleLoadingView 23 | 24 | #pragma mark - Animation init 25 | 26 | - (instancetype)initWithFrame:(CGRect)frame 27 | { 28 | self = [super initWithFrame:frame]; 29 | if (self) { 30 | [self setupProperties]; 31 | [self setupLayers]; 32 | 33 | } 34 | return self; 35 | } 36 | 37 | 38 | - (void)setupProperties{ 39 | //初始化数据 40 | self.completionBlocks = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaqueMemory valueOptions:NSPointerFunctionsStrongMemory];; 41 | self.layers = [NSMutableDictionary dictionary]; 42 | 43 | } 44 | 45 | - (void)setupLayers{ 46 | 47 | //创建8个自定义的矩形框 48 | for (int i = 0; i < 8; i++) { 49 | NSString *shapeLayerName = [NSString stringWithFormat:@"rectangle%d",i+1]; 50 | CustomShapeLayer *rectangle = [[CustomShapeLayer alloc] initTheFrame:CGRectZero withIndex:i+1]; 51 | [self.layer addSublayer:rectangle]; 52 | self.layers[shapeLayerName] = rectangle; 53 | } 54 | 55 | CAShapeLayer * oval = [CAShapeLayer layer]; 56 | oval.frame = CGRectMake(0, 0, 2, 2); 57 | oval.position = CGPointMake(self.center.x, self.center.y); 58 | oval.backgroundColor = [UIColor colorWithRed:168/255.f green:169/255.f blue:38/255.f alpha:1.0].CGColor; 59 | [self.layer addSublayer:oval]; 60 | } 61 | 62 | 63 | #pragma mark - Animation Setup 64 | 65 | - (void)customAnimations{ 66 | 67 | self.layer.speed = 1; 68 | 69 | //创建8个动画模型 70 | for (int i = 0; i < 8; i++) { 71 | CABasicAnimation *transformAnimation = [self eachPartAnimation:i]; 72 | NSString *layerNameStr = [NSString stringWithFormat:@"rectangle%d",i+1]; 73 | 74 | if (i == 0) { 75 | [self.layers[layerNameStr] addAnimation:transformAnimation forKey:nil]; 76 | [self performSelector:@selector(pauseLayer:) withObject:self.layers[layerNameStr] afterDelay:1]; 77 | [self performSelector:@selector(resumeLayer:) withObject:self.layers[layerNameStr] afterDelay:4.5]; 78 | } 79 | else 80 | { 81 | 82 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 83 | animationGroup.animations = @[transformAnimation]; 84 | animationGroup.duration = [DurModel initWithTheDuration:transformAnimation]; 85 | [self.layers[layerNameStr] addAnimation:animationGroup forKey:nil]; 86 | 87 | [self performSelector:@selector(pauseLayer:) withObject:self.layers[layerNameStr] afterDelay:1+(i)*0.5]; 88 | [self performSelector:@selector(resumeLayer:) withObject:self.layers[layerNameStr] afterDelay:4.5+(i)*0.5]; 89 | } 90 | 91 | } 92 | 93 | 94 | } 95 | 96 | //暂停动画 97 | -(void)pauseLayer:(CALayer*)layer 98 | { 99 | CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil]; 100 | layer.speed = 0.0; 101 | layer.timeOffset = pausedTime; 102 | } 103 | 104 | //重新启动动画 105 | -(void)resumeLayer:(CALayer*)layer 106 | { 107 | 108 | CFTimeInterval pausedTime = [layer timeOffset]; 109 | layer.speed = 1.0; 110 | layer.timeOffset = 0.0; 111 | layer.beginTime = 0.0; 112 | CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime; 113 | layer.beginTime = timeSincePause; 114 | } 115 | 116 | //依次索引不同的动画效果 117 | - (CABasicAnimation *) eachPartAnimation:(NSInteger)index 118 | { 119 | CABasicAnimation *animation = [CABasicAnimation animation]; 120 | switch (index) { 121 | case 0: 122 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 123 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];; 124 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0))];; 125 | animation.duration = DURATION_TIME; 126 | animation.beginTime = CACurrentMediaTime(); 127 | animation.autoreverses = YES; 128 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 129 | break; 130 | case 1: 131 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 132 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(-45 * M_PI/180, 0, 0, -1)];; 133 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(45 * M_PI/180, 0, -0, 1))];; 134 | animation.duration = DURATION_TIME; 135 | animation.beginTime = 0.5; 136 | animation.autoreverses = YES; 137 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 138 | break; 139 | case 2: 140 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 141 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(-90 * M_PI/180, 0, 0, -1)];; 142 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(90 * M_PI/180, 0, -0, 1))];; 143 | animation.duration = DURATION_TIME; 144 | animation.beginTime = 1; 145 | animation.autoreverses = YES; 146 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 147 | break; 148 | case 3: 149 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 150 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(225 * M_PI/180, 0, 0, -1)];; 151 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(-225 * M_PI/180, -0, 0, 1))];; 152 | animation.duration = DURATION_TIME; 153 | animation.beginTime = 1.5; 154 | animation.autoreverses = YES; 155 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 156 | break; 157 | case 4: 158 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 159 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI, 0, 0, -1)];; 160 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(-M_PI, 0, 0, 1))];; 161 | animation.duration = DURATION_TIME; 162 | animation.beginTime = 2; 163 | animation.autoreverses = YES; 164 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 165 | break; 166 | case 5: 167 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 168 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(135 * M_PI/180, 0, 0, -1)];; 169 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(-135 * M_PI/180, -0, 0, 1))];; 170 | animation.duration = DURATION_TIME; 171 | animation.beginTime = 2.5; 172 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 173 | animation.autoreverses = YES; 174 | break; 175 | case 6: 176 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 177 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0, 0, -1)];; 178 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(-M_PI_2, 0, 0, 1))];; 179 | animation.duration = DURATION_TIME; 180 | animation.beginTime = 3; 181 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 182 | animation.autoreverses = YES; 183 | break; 184 | case 7: 185 | animation = [CABasicAnimation animationWithKeyPath:@"transform"]; 186 | animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_4, 0, 0, -1)];; 187 | animation.toValue = [NSValue valueWithCATransform3D:CATransform3DConcat(CATransform3DConcat(CATransform3DMakeScale(30, 30, 30), CATransform3DMakeTranslation(0, -60, 0)), CATransform3DMakeRotation(-M_PI_4, 0, 0, 1))];; 188 | animation.duration = DURATION_TIME; 189 | animation.beginTime = 3.5; 190 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 191 | animation.autoreverses = YES; 192 | break; 193 | default: 194 | break; 195 | } 196 | 197 | return animation; 198 | } 199 | 200 | #pragma mark - Animation Cleanup 201 | 202 | - (void)removeAllAnimations{ 203 | [self.layers enumerateKeysAndObjectsUsingBlock:^(id key, CALayer *layer, BOOL *stop) { 204 | [layer removeAllAnimations]; 205 | }]; 206 | } 207 | 208 | @end 209 | -------------------------------------------------------------------------------- /PScaleLoading/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PScaleLoading 4 | // 5 | // Created by xp_mac on 16/2/29. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PScaleLoadingTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PScaleLoadingTests/PScaleLoadingTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PScaleLoadingTests.m 3 | // PScaleLoadingTests 4 | // 5 | // Created by xp_mac on 16/2/29. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PScaleLoadingTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PScaleLoadingTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /PScaleLoadingUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PScaleLoadingUITests/PScaleLoadingUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PScaleLoadingUITests.m 3 | // PScaleLoadingUITests 4 | // 5 | // Created by xp_mac on 16/2/29. 6 | // Copyright © 2016年 xp_mac. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PScaleLoadingUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation PScaleLoadingUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PScaleLoading 2 | 3 | 下面这个动画是网页的加载动画。 4 | The animation is “loading animation” on website。 5 | ![image](https://github.com/wxp2012/PScaleLoading/blob/master/loading.gif) 6 | 7 | 下面是我参考这个动画作出来的效果。 8 | The created animation is my reference to website animation 。 9 | ![image](https://github.com/wxp2012/PScaleLoading/blob/master/myloading.gif) 10 | 11 | 如有什么不好的地方,还望指点。(wxpnews@gmail.com) 12 | -------------------------------------------------------------------------------- /loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wxp2012/PScaleLoading/143a0e4adbc72e180646ffc895d0534baf988f7f/loading.gif -------------------------------------------------------------------------------- /myloading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wxp2012/PScaleLoading/143a0e4adbc72e180646ffc895d0534baf988f7f/myloading.gif --------------------------------------------------------------------------------