├── .DS_Store ├── .gitignore ├── .swift-version ├── LICENSE ├── README.md ├── XYFSnowAnimation.podspec ├── XYFSnowAnimationDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── xyf.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── xyf.xcuserdatad │ └── xcschemes │ ├── XYFSnowAnimationDemo.xcscheme │ └── xcschememanagement.plist ├── XYFSnowAnimationDemo ├── .DS_Store ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── .DS_Store │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── flower.imageset │ │ ├── Contents.json │ │ ├── sakura_2@2x.png │ │ └── sakura_2@3x.png │ ├── flower_bg.imageset │ │ ├── Contents.json │ │ └── sakuraBg.png │ ├── snow.imageset │ │ ├── Contents.json │ │ ├── snow@2x.png │ │ └── snow@3x.png │ └── snow_bg.imageset │ │ ├── Contents.json │ │ └── snow_bg_1.png ├── BGM │ ├── flower_bgm.mp3 │ └── snow_bgm.mp3 ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── ExampleViewController │ ├── BaseViewController.h │ ├── BaseViewController.m │ ├── FlowerAnimationViewController.h │ ├── FlowerAnimationViewController.m │ ├── SnowAnimationViewController.h │ └── SnowAnimationViewController.m ├── Info.plist ├── ViewController.h ├── ViewController.m ├── XYFSnowAnimation │ ├── .DS_Store │ ├── NSTimer+XYFSnowAnimation.h │ └── NSTimer+XYFSnowAnimation.m └── main.m └── previewEffectGIFImage ├── .DS_Store ├── fallingFlower.gif └── snow.gif /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/.DS_Store -------------------------------------------------------------------------------- /.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 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 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/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /.swift-version: -------------------------------------------------------------------------------- 1 | 3.0 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 CoderXYF 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XYFSnowAnimation 2 | A category of NSTimer for showing 3D Fluttered animation for iOS, which is used very simply. Lightweight CALayer animation, core animation, 3D transform, performance safety. 3 | 4 | Usage 5 | ============== 6 | 7 | ### Add snow(Falling flower) animation 8 | ```objc 9 | // Snow 10 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"snow_bg"] snowImage:[UIImage imageNamed:@"snow"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"snow_bgm" ofType:@"mp3"]] 11 | // Falling flower: 12 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"flower_bg"] snowImage:[UIImage imageNamed:@"flower"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"flower_bgm" ofType:@"mp3"]]; 13 | ``` 14 | ### remove snow(Falling flower) animation 15 | ```objc 16 | [NSTimer removeSnowAnimation]; 17 | ``` 18 | 19 | Installation 20 | ============== 21 | 22 | ### CocoaPods 23 | 24 | 1. Add `pod 'XYFSnowAnimation'` to your Podfile. 25 | 2. Run `pod install` or `pod update`. 26 | 3. Import \. 27 | 28 | ### Manually 29 | 30 | 1. Download XYFSnowAnimation and find XYFSnowAnimationDemo/XYFSnowAnimation finder. 31 | 2. Add the source files to your Xcode project. 32 | 3. Import `NSTimer+XYFSnowAnimation.h`. 33 | 34 | Requirements 35 | ============== 36 | This library requires `iOS 8.0+`. 37 | 38 | License 39 | ============== 40 | XYFSnowAnimation is provided under the MIT license. See LICENSE file for details. 41 | 42 |

43 | --- 44 | 中文介绍 45 | ============== 46 | iOS 3D三维飘落下雪落花动画,轻量级CALayer图层动画,核心动画,3D形变,性能安全,定时器NSTimer分类,直接使用,很简单 。
47 | 48 | 使用 49 | ============== 50 | 51 | ### 添加下雪(落花)动画 52 | ```objc 53 | // 下雪 54 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"snow_bg"] snowImage:[UIImage imageNamed:@"snow"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"snow_bgm" ofType:@"mp3"]] 55 | // 落花: 56 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"flower_bg"] snowImage:[UIImage imageNamed:@"flower"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"flower_bgm" ofType:@"mp3"]]; 57 | ``` 58 | ### 移除下雪(落花)动画 59 | ```objc 60 | [NSTimer removeSnowAnimation]; 61 | ``` 62 | 63 | 安装 64 | ============== 65 | 66 | ### CocoaPods 67 | 68 | 1. 在 Podfile 中添加 `pod 'XYFSnowAnimation'`。 69 | 2. 执行 `pod install` 或 `pod update`。 70 | 3. 导入 \。 71 | 72 | ### 手动安装 73 | 74 | 1. 下载 XYFSnowAnimation 并找到 XYFSnowAnimationDemo/XYFSnowAnimation 文件夹。 75 | 2. 将 XYFSnowAnimation 文件夹内的源文件添加(拖放)到你的工程。 76 | 3. 导入 `NSTimer+XYFSnowAnimation.h`。 77 | 78 | 系统要求 79 | ============== 80 | 该工具最低支持 `iOS 8.0`。 81 | 82 | 许可证 83 | ============== 84 | XYFSnowAnimation 使用 MIT 许可证,详情见 LICENSE 文件。 85 | # Preview(预览效果动态图): 86 | ![img](https://github.com/CoderXYF/XYFSnowAnimation/blob/master/previewEffectGIFImage/snow.gif)  ![img](https://github.com/CoderXYF/XYFSnowAnimation/blob/master/previewEffectGIFImage/fallingFlower.gif) 87 | Tip(提示):It may need to load for a while to show dynamic effect.可能需要加载一会才能看到动态效果。 88 | # Contact me (联系我) 89 | QQ:2016003298 90 | 微信(WeChat):yz33915958 91 | -------------------------------------------------------------------------------- /XYFSnowAnimation.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | s.name = "XYFSnowAnimation" 4 | 5 | s.version = "2.0.1" 6 | 7 | s.ios.deployment_target = '8.0' 8 | 9 | s.summary = "A category of NSTimer for showing 3D Fluttered animation, which is used very simply." 10 | 11 | s.homepage = "https://github.com/CoderXYF/XYFSnowAnimation" 12 | 13 | s.license = { :type => "MIT", :file => "LICENSE" } 14 | 15 | s.author = { "CoderXYF" => "https://github.com/CoderXYF" } 16 | 17 | s.source = { :git => "https://github.com/CoderXYF/XYFSnowAnimation.git", :tag => "2.0.1" } 18 | 19 | s.source_files = "XYFSnowAnimationDemo/XYFSnowAnimation/*.{h,m}" 20 | 21 | s.requires_arc = true 22 | 23 | end 24 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0013138A1E3E9D1B001FC573 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 001313891E3E9D1B001FC573 /* main.m */; }; 11 | 0013138D1E3E9D1B001FC573 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0013138C1E3E9D1B001FC573 /* AppDelegate.m */; }; 12 | 001313901E3E9D1B001FC573 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0013138F1E3E9D1B001FC573 /* ViewController.m */; }; 13 | 001313931E3E9D1B001FC573 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 001313911E3E9D1B001FC573 /* Main.storyboard */; }; 14 | 001313951E3E9D1B001FC573 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 001313941E3E9D1B001FC573 /* Assets.xcassets */; }; 15 | 001313981E3E9D1B001FC573 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 001313961E3E9D1B001FC573 /* LaunchScreen.storyboard */; }; 16 | 044F3808215B23230096B016 /* snow_bgm.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 044F3807215B23230096B016 /* snow_bgm.mp3 */; }; 17 | 04A897FC216C7EC5006FD84D /* SnowAnimationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A897FB216C7EC5006FD84D /* SnowAnimationViewController.m */; }; 18 | 04A89803216C7F5F006FD84D /* FlowerAnimationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A89802216C7F5F006FD84D /* FlowerAnimationViewController.m */; }; 19 | 04A89806216C8B8C006FD84D /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04A89805216C8B8C006FD84D /* BaseViewController.m */; }; 20 | 04ABEF93216C54DB00960E7D /* flower_bgm.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 04ABEF92216C54DB00960E7D /* flower_bgm.mp3 */; }; 21 | 04ABEF96216C74BB00960E7D /* NSTimer+XYFSnowAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = 04ABEF95216C74BB00960E7D /* NSTimer+XYFSnowAnimation.m */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXFileReference section */ 25 | 001313851E3E9D1B001FC573 /* XYFSnowAnimationDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XYFSnowAnimationDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 001313891E3E9D1B001FC573 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 27 | 0013138B1E3E9D1B001FC573 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 28 | 0013138C1E3E9D1B001FC573 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 29 | 0013138E1E3E9D1B001FC573 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 30 | 0013138F1E3E9D1B001FC573 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 31 | 001313921E3E9D1B001FC573 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 32 | 001313941E3E9D1B001FC573 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 33 | 001313971E3E9D1B001FC573 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 34 | 001313991E3E9D1B001FC573 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | 044F3807215B23230096B016 /* snow_bgm.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = snow_bgm.mp3; sourceTree = ""; }; 36 | 04A897FA216C7EC5006FD84D /* SnowAnimationViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SnowAnimationViewController.h; sourceTree = ""; }; 37 | 04A897FB216C7EC5006FD84D /* SnowAnimationViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SnowAnimationViewController.m; sourceTree = ""; }; 38 | 04A89801216C7F5F006FD84D /* FlowerAnimationViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FlowerAnimationViewController.h; sourceTree = ""; }; 39 | 04A89802216C7F5F006FD84D /* FlowerAnimationViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FlowerAnimationViewController.m; sourceTree = ""; }; 40 | 04A89804216C8B8C006FD84D /* BaseViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = ""; }; 41 | 04A89805216C8B8C006FD84D /* BaseViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = ""; }; 42 | 04ABEF92216C54DB00960E7D /* flower_bgm.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = flower_bgm.mp3; sourceTree = ""; }; 43 | 04ABEF94216C74BB00960E7D /* NSTimer+XYFSnowAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSTimer+XYFSnowAnimation.h"; sourceTree = ""; }; 44 | 04ABEF95216C74BB00960E7D /* NSTimer+XYFSnowAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSTimer+XYFSnowAnimation.m"; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 001313821E3E9D1B001FC573 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 0013137C1E3E9D1B001FC573 = { 59 | isa = PBXGroup; 60 | children = ( 61 | 001313871E3E9D1B001FC573 /* XYFSnowAnimationDemo */, 62 | 001313861E3E9D1B001FC573 /* Products */, 63 | ); 64 | sourceTree = ""; 65 | }; 66 | 001313861E3E9D1B001FC573 /* Products */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 001313851E3E9D1B001FC573 /* XYFSnowAnimationDemo.app */, 70 | ); 71 | name = Products; 72 | sourceTree = ""; 73 | }; 74 | 001313871E3E9D1B001FC573 /* XYFSnowAnimationDemo */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 044F3806215B23230096B016 /* BGM */, 78 | 0013139F1E3E9D31001FC573 /* XYFSnowAnimation */, 79 | 04A897FD216C7F1F006FD84D /* ExampleViewController */, 80 | 0013138B1E3E9D1B001FC573 /* AppDelegate.h */, 81 | 0013138C1E3E9D1B001FC573 /* AppDelegate.m */, 82 | 0013138E1E3E9D1B001FC573 /* ViewController.h */, 83 | 0013138F1E3E9D1B001FC573 /* ViewController.m */, 84 | 001313911E3E9D1B001FC573 /* Main.storyboard */, 85 | 001313941E3E9D1B001FC573 /* Assets.xcassets */, 86 | 001313961E3E9D1B001FC573 /* LaunchScreen.storyboard */, 87 | 001313991E3E9D1B001FC573 /* Info.plist */, 88 | 001313881E3E9D1B001FC573 /* Supporting Files */, 89 | ); 90 | path = XYFSnowAnimationDemo; 91 | sourceTree = ""; 92 | }; 93 | 001313881E3E9D1B001FC573 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 001313891E3E9D1B001FC573 /* main.m */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 0013139F1E3E9D31001FC573 /* XYFSnowAnimation */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 04ABEF94216C74BB00960E7D /* NSTimer+XYFSnowAnimation.h */, 105 | 04ABEF95216C74BB00960E7D /* NSTimer+XYFSnowAnimation.m */, 106 | ); 107 | path = XYFSnowAnimation; 108 | sourceTree = ""; 109 | }; 110 | 044F3806215B23230096B016 /* BGM */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 044F3807215B23230096B016 /* snow_bgm.mp3 */, 114 | 04ABEF92216C54DB00960E7D /* flower_bgm.mp3 */, 115 | ); 116 | path = BGM; 117 | sourceTree = ""; 118 | }; 119 | 04A897FD216C7F1F006FD84D /* ExampleViewController */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 04A89804216C8B8C006FD84D /* BaseViewController.h */, 123 | 04A89805216C8B8C006FD84D /* BaseViewController.m */, 124 | 04A897FA216C7EC5006FD84D /* SnowAnimationViewController.h */, 125 | 04A897FB216C7EC5006FD84D /* SnowAnimationViewController.m */, 126 | 04A89801216C7F5F006FD84D /* FlowerAnimationViewController.h */, 127 | 04A89802216C7F5F006FD84D /* FlowerAnimationViewController.m */, 128 | ); 129 | path = ExampleViewController; 130 | sourceTree = ""; 131 | }; 132 | /* End PBXGroup section */ 133 | 134 | /* Begin PBXNativeTarget section */ 135 | 001313841E3E9D1B001FC573 /* XYFSnowAnimationDemo */ = { 136 | isa = PBXNativeTarget; 137 | buildConfigurationList = 0013139C1E3E9D1B001FC573 /* Build configuration list for PBXNativeTarget "XYFSnowAnimationDemo" */; 138 | buildPhases = ( 139 | 001313811E3E9D1B001FC573 /* Sources */, 140 | 001313821E3E9D1B001FC573 /* Frameworks */, 141 | 001313831E3E9D1B001FC573 /* Resources */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = XYFSnowAnimationDemo; 148 | productName = XYFSnowAnimationDemo; 149 | productReference = 001313851E3E9D1B001FC573 /* XYFSnowAnimationDemo.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 0013137D1E3E9D1B001FC573 /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0820; 159 | ORGANIZATIONNAME = XYF; 160 | TargetAttributes = { 161 | 001313841E3E9D1B001FC573 = { 162 | CreatedOnToolsVersion = 8.2.1; 163 | DevelopmentTeam = BRGV5Q76U9; 164 | ProvisioningStyle = Automatic; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 001313801E3E9D1B001FC573 /* Build configuration list for PBXProject "XYFSnowAnimationDemo" */; 169 | compatibilityVersion = "Xcode 3.2"; 170 | developmentRegion = English; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | Base, 175 | ); 176 | mainGroup = 0013137C1E3E9D1B001FC573; 177 | productRefGroup = 001313861E3E9D1B001FC573 /* Products */; 178 | projectDirPath = ""; 179 | projectRoot = ""; 180 | targets = ( 181 | 001313841E3E9D1B001FC573 /* XYFSnowAnimationDemo */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 001313831E3E9D1B001FC573 /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 001313981E3E9D1B001FC573 /* LaunchScreen.storyboard in Resources */, 192 | 04ABEF93216C54DB00960E7D /* flower_bgm.mp3 in Resources */, 193 | 001313951E3E9D1B001FC573 /* Assets.xcassets in Resources */, 194 | 001313931E3E9D1B001FC573 /* Main.storyboard in Resources */, 195 | 044F3808215B23230096B016 /* snow_bgm.mp3 in Resources */, 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | }; 199 | /* End PBXResourcesBuildPhase section */ 200 | 201 | /* Begin PBXSourcesBuildPhase section */ 202 | 001313811E3E9D1B001FC573 /* Sources */ = { 203 | isa = PBXSourcesBuildPhase; 204 | buildActionMask = 2147483647; 205 | files = ( 206 | 001313901E3E9D1B001FC573 /* ViewController.m in Sources */, 207 | 0013138D1E3E9D1B001FC573 /* AppDelegate.m in Sources */, 208 | 04A89803216C7F5F006FD84D /* FlowerAnimationViewController.m in Sources */, 209 | 04ABEF96216C74BB00960E7D /* NSTimer+XYFSnowAnimation.m in Sources */, 210 | 0013138A1E3E9D1B001FC573 /* main.m in Sources */, 211 | 04A89806216C8B8C006FD84D /* BaseViewController.m in Sources */, 212 | 04A897FC216C7EC5006FD84D /* SnowAnimationViewController.m in Sources */, 213 | ); 214 | runOnlyForDeploymentPostprocessing = 0; 215 | }; 216 | /* End PBXSourcesBuildPhase section */ 217 | 218 | /* Begin PBXVariantGroup section */ 219 | 001313911E3E9D1B001FC573 /* Main.storyboard */ = { 220 | isa = PBXVariantGroup; 221 | children = ( 222 | 001313921E3E9D1B001FC573 /* Base */, 223 | ); 224 | name = Main.storyboard; 225 | sourceTree = ""; 226 | }; 227 | 001313961E3E9D1B001FC573 /* LaunchScreen.storyboard */ = { 228 | isa = PBXVariantGroup; 229 | children = ( 230 | 001313971E3E9D1B001FC573 /* Base */, 231 | ); 232 | name = LaunchScreen.storyboard; 233 | sourceTree = ""; 234 | }; 235 | /* End PBXVariantGroup section */ 236 | 237 | /* Begin XCBuildConfiguration section */ 238 | 0013139A1E3E9D1B001FC573 /* Debug */ = { 239 | isa = XCBuildConfiguration; 240 | buildSettings = { 241 | ALWAYS_SEARCH_USER_PATHS = NO; 242 | CLANG_ANALYZER_NONNULL = YES; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 256 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 257 | CLANG_WARN_UNREACHABLE_CODE = YES; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 260 | COPY_PHASE_STRIP = NO; 261 | DEBUG_INFORMATION_FORMAT = dwarf; 262 | ENABLE_STRICT_OBJC_MSGSEND = YES; 263 | ENABLE_TESTABILITY = YES; 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_DYNAMIC_NO_PIC = NO; 266 | GCC_NO_COMMON_BLOCKS = YES; 267 | GCC_OPTIMIZATION_LEVEL = 0; 268 | GCC_PREPROCESSOR_DEFINITIONS = ( 269 | "DEBUG=1", 270 | "$(inherited)", 271 | ); 272 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 273 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 274 | GCC_WARN_UNDECLARED_SELECTOR = YES; 275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 276 | GCC_WARN_UNUSED_FUNCTION = YES; 277 | GCC_WARN_UNUSED_VARIABLE = YES; 278 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 279 | MTL_ENABLE_DEBUG_INFO = YES; 280 | ONLY_ACTIVE_ARCH = YES; 281 | SDKROOT = iphoneos; 282 | }; 283 | name = Debug; 284 | }; 285 | 0013139B1E3E9D1B001FC573 /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ALWAYS_SEARCH_USER_PATHS = NO; 289 | CLANG_ANALYZER_NONNULL = YES; 290 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 291 | CLANG_CXX_LIBRARY = "libc++"; 292 | CLANG_ENABLE_MODULES = YES; 293 | CLANG_ENABLE_OBJC_ARC = YES; 294 | CLANG_WARN_BOOL_CONVERSION = YES; 295 | CLANG_WARN_CONSTANT_CONVERSION = YES; 296 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 297 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 298 | CLANG_WARN_EMPTY_BODY = YES; 299 | CLANG_WARN_ENUM_CONVERSION = YES; 300 | CLANG_WARN_INFINITE_RECURSION = YES; 301 | CLANG_WARN_INT_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 304 | CLANG_WARN_UNREACHABLE_CODE = YES; 305 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 306 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 307 | COPY_PHASE_STRIP = NO; 308 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 309 | ENABLE_NS_ASSERTIONS = NO; 310 | ENABLE_STRICT_OBJC_MSGSEND = YES; 311 | GCC_C_LANGUAGE_STANDARD = gnu99; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 315 | GCC_WARN_UNDECLARED_SELECTOR = YES; 316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 317 | GCC_WARN_UNUSED_FUNCTION = YES; 318 | GCC_WARN_UNUSED_VARIABLE = YES; 319 | IPHONEOS_DEPLOYMENT_TARGET = 10.2; 320 | MTL_ENABLE_DEBUG_INFO = NO; 321 | SDKROOT = iphoneos; 322 | VALIDATE_PRODUCT = YES; 323 | }; 324 | name = Release; 325 | }; 326 | 0013139D1E3E9D1B001FC573 /* Debug */ = { 327 | isa = XCBuildConfiguration; 328 | buildSettings = { 329 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 330 | DEVELOPMENT_TEAM = BRGV5Q76U9; 331 | INFOPLIST_FILE = XYFSnowAnimationDemo/Info.plist; 332 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 334 | PRODUCT_BUNDLE_IDENTIFIER = com.xyf.XYFSnowAnimationDemo; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | }; 337 | name = Debug; 338 | }; 339 | 0013139E1E3E9D1B001FC573 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | DEVELOPMENT_TEAM = BRGV5Q76U9; 344 | INFOPLIST_FILE = XYFSnowAnimationDemo/Info.plist; 345 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 346 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 347 | PRODUCT_BUNDLE_IDENTIFIER = com.xyf.XYFSnowAnimationDemo; 348 | PRODUCT_NAME = "$(TARGET_NAME)"; 349 | }; 350 | name = Release; 351 | }; 352 | /* End XCBuildConfiguration section */ 353 | 354 | /* Begin XCConfigurationList section */ 355 | 001313801E3E9D1B001FC573 /* Build configuration list for PBXProject "XYFSnowAnimationDemo" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | 0013139A1E3E9D1B001FC573 /* Debug */, 359 | 0013139B1E3E9D1B001FC573 /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | 0013139C1E3E9D1B001FC573 /* Build configuration list for PBXNativeTarget "XYFSnowAnimationDemo" */ = { 365 | isa = XCConfigurationList; 366 | buildConfigurations = ( 367 | 0013139D1E3E9D1B001FC573 /* Debug */, 368 | 0013139E1E3E9D1B001FC573 /* Release */, 369 | ); 370 | defaultConfigurationIsVisible = 0; 371 | defaultConfigurationName = Release; 372 | }; 373 | /* End XCConfigurationList section */ 374 | }; 375 | rootObject = 0013137D1E3E9D1B001FC573 /* Project object */; 376 | } 377 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/project.xcworkspace/xcuserdata/xyf.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo.xcodeproj/project.xcworkspace/xcuserdata/xyf.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/xcuserdata/xyf.xcuserdatad/xcschemes/XYFSnowAnimationDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo.xcodeproj/xcuserdata/xyf.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XYFSnowAnimationDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 001313841E3E9D1B001FC573 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/.DS_Store -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by xyf on 2017/1/30. 6 | // Copyright © 2017年 XYF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by xyf on 2017/1/30. 6 | // Copyright © 2017年 XYF. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | ViewController *rootVC = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateInitialViewController]; 21 | UINavigationController *rootNavC = [[UINavigationController alloc] initWithRootViewController:rootVC]; 22 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 23 | self.window.rootViewController = rootNavC; 24 | self.window.backgroundColor = [UIColor whiteColor]; 25 | [self.window makeKeyAndVisible]; 26 | return YES; 27 | } 28 | 29 | 30 | - (void)applicationWillResignActive:(UIApplication *)application { 31 | // 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. 32 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 33 | } 34 | 35 | 36 | - (void)applicationDidEnterBackground:(UIApplication *)application { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | 42 | - (void)applicationWillEnterForeground:(UIApplication *)application { 43 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 44 | } 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 | 52 | - (void)applicationWillTerminate:(UIApplication *)application { 53 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 54 | } 55 | 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/flower.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "sakura_2@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "sakura_2@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/flower.imageset/sakura_2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/flower.imageset/sakura_2@2x.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/flower.imageset/sakura_2@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/flower.imageset/sakura_2@3x.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/flower_bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "sakuraBg.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/flower_bg.imageset/sakuraBg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/flower_bg.imageset/sakuraBg.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/snow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "snow@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "snow@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/snow.imageset/snow@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/snow.imageset/snow@2x.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/snow.imageset/snow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/snow.imageset/snow@3x.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/snow_bg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "snow_bg_1.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Assets.xcassets/snow_bg.imageset/snow_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/Assets.xcassets/snow_bg.imageset/snow_bg_1.png -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/BGM/flower_bgm.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/BGM/flower_bgm.mp3 -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/BGM/snow_bgm.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/BGM/snow_bgm.mp3 -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/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 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/Base.lproj/Main.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 | 31 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/BaseViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BaseViewController : UIViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/BaseViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // BaseViewController.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | @interface BaseViewController () 12 | 13 | @end 14 | 15 | @implementation BaseViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // 导航栏变透明 20 | [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; 21 | [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; 22 | // 改变导航栏返回按钮色调 23 | self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; 24 | // 去除导航栏返回按钮文字 25 | self.navigationController.navigationBar.topItem.title = @""; 26 | // 状态栏样式改为白色 27 | self.navigationController.navigationBar.barStyle = UIBarStyleBlack; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/FlowerAnimationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FlowerAnimationViewController.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface FlowerAnimationViewController : BaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/FlowerAnimationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FlowerAnimationViewController.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "FlowerAnimationViewController.h" 10 | #import "NSTimer+XYFSnowAnimation.h" 11 | 12 | @interface FlowerAnimationViewController () 13 | 14 | @end 15 | 16 | @implementation FlowerAnimationViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // 改变导航栏返回按钮色调 21 | self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:251/255.0 green:168/255.0 blue:177/255.0 alpha:1.0]; 22 | // 落花动画 23 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"flower_bg"] snowImage:[UIImage imageNamed:@"flower"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"flower_bgm" ofType:@"mp3"]]; 24 | } 25 | 26 | - (void)viewWillDisappear:(BOOL)animated { 27 | [super viewWillDisappear:animated]; 28 | [NSTimer removeSnowAnimation]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/SnowAnimationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SnowAnimationViewController.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "BaseViewController.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface SnowAnimationViewController : BaseViewController 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ExampleViewController/SnowAnimationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SnowAnimationViewController.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "SnowAnimationViewController.h" 10 | #import "NSTimer+XYFSnowAnimation.h" 11 | 12 | @interface SnowAnimationViewController () 13 | 14 | @end 15 | 16 | @implementation SnowAnimationViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // 下雪动画 21 | [NSTimer timerWithSnowAnimationInView:self.view backgroundImage:[UIImage imageNamed:@"snow_bg"] snowImage:[UIImage imageNamed:@"snow"] BGMFilePath:[[NSBundle mainBundle] pathForResource:@"snow_bgm" ofType:@"mp3"]]; 22 | } 23 | 24 | - (void)viewWillDisappear:(BOOL)animated { 25 | [super viewWillDisappear:animated]; 26 | [NSTimer removeSnowAnimation]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UIViewControllerBasedStatusBarAppearance 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by xyf on 2017/1/30. 6 | // Copyright © 2017年 XYF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by xyf on 2017/1/30. 6 | // Copyright © 2017年 XYF. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "SnowAnimationViewController.h" 11 | #import "FlowerAnimationViewController.h" 12 | 13 | @interface ViewController () 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | } 22 | 23 | - (IBAction)jumpToSnowAnimationPage { 24 | SnowAnimationViewController *snowAnimationVC = [[SnowAnimationViewController alloc] init]; 25 | [self.navigationController pushViewController:snowAnimationVC animated:YES]; 26 | } 27 | 28 | - (IBAction)jumpToFlowerAnimationPage { 29 | FlowerAnimationViewController *flowerAnimationVC = [[FlowerAnimationViewController alloc] init]; 30 | [self.navigationController pushViewController:flowerAnimationVC animated:YES]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/XYFSnowAnimation/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/XYFSnowAnimationDemo/XYFSnowAnimation/.DS_Store -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/XYFSnowAnimation/NSTimer+XYFSnowAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSTimer+XYFSnowAnimation.h 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface NSTimer (XYFSnowAnimation) 14 | 15 | /** 16 | 持续下雪动画 17 | 18 | @param view 展示动画所在视图 19 | @param backgroundImage 动画背景图 20 | @param snowImage 动画图 21 | @param filePath 背景音乐文件本地路径 22 | @return 持续执行动画的定时器 23 | */ 24 | + (NSTimer *)timerWithSnowAnimationInView:(nullable UIView *)view backgroundImage:(nullable UIImage *)backgroundImage snowImage:(nullable UIImage *)snowImage BGMFilePath:(nullable NSString *)filePath; 25 | 26 | /** 27 | 移除动画 28 | */ 29 | + (void)removeSnowAnimation; 30 | 31 | @end 32 | 33 | NS_ASSUME_NONNULL_END 34 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/XYFSnowAnimation/NSTimer+XYFSnowAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSTimer+XYFSnowAnimation.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by Mac on 2018/9/1. 6 | // Copyright © 2018年 XYF. All rights reserved. 7 | // 8 | 9 | #import "NSTimer+XYFSnowAnimation.h" 10 | #import 11 | 12 | static const CGFloat interval = 0.02f; 13 | static const CGFloat duration = 8.0f; 14 | // 雪花左右飘动范围距离 15 | static const CGFloat maximumHorizontalDistance = 166; 16 | 17 | static AVAudioPlayer *audioPlayer = nil; 18 | static NSTimer *timer = nil; 19 | static UIView *animationView = nil; 20 | 21 | @implementation NSTimer (XYFSnowAnimation) 22 | 23 | static CGFloat currentContainerViewHeight = 0; 24 | 25 | + (NSTimer *)timerWithSnowAnimationInView:(nullable UIView *)view backgroundImage:(nullable UIImage *)backgroundImage snowImage:(nullable UIImage *)snowImage BGMFilePath:(nullable NSString *)filePath { 26 | // 当前容器视图宽度 27 | CGFloat currentContainerViewWidth = view.bounds.size.width; 28 | currentContainerViewHeight = view.bounds.size.height; 29 | // 先新添加一个动画视图 30 | animationView = [[UIView alloc] initWithFrame:view.bounds]; 31 | [view addSubview:animationView]; 32 | // 让背景图不变形且填充 33 | animationView.contentMode = UIViewContentModeScaleAspectFill; 34 | animationView.layer.contents = (id)backgroundImage.CGImage; 35 | /********** 一次性创建好所需要的雪花图层 **********/ 36 | NSMutableArray *snowLayersArray = @[].mutableCopy; 37 | // 雪花图层数量 38 | NSInteger snowLayersCount = (NSInteger)duration/interval; 39 | CGFloat imageWidth = CGImageGetWidth(snowImage.CGImage) / [UIScreen mainScreen].scale; 40 | CGFloat imageHeight = CGImageGetHeight(snowImage.CGImage) / [UIScreen mainScreen].scale; 41 | CGFloat startY = -imageHeight; 42 | for (NSInteger i = 0; i < snowLayersCount; i++) { 43 | // 每个雪花图层随机横向位置 44 | CGFloat startX = arc4random_uniform(currentContainerViewWidth + maximumHorizontalDistance + 1) - maximumHorizontalDistance * 0.5; 45 | CALayer *snowLayer = [[CALayer alloc] init]; 46 | snowLayer.frame = CGRectMake(startX, startY, imageWidth, imageHeight); 47 | snowLayer.contents = (id)snowImage.CGImage; 48 | [animationView.layer addSublayer:snowLayer]; 49 | [snowLayersArray addObject:snowLayer]; 50 | // 初始化缩放比例与透明度模拟远近 51 | CGFloat startScale = (arc4random_uniform(11) + 5) / 10.0; 52 | snowLayer.transform = CATransform3DScale(snowLayer.transform, startScale, startScale, startScale); 53 | snowLayer.opacity = startScale * 2 / 3.0 * 0.2 + 0.8; 54 | // 初始化旋转角度 55 | // -90度到90度(顺时针为正) 56 | CGFloat startAngleX = arc4random_uniform(180 + 1) / 180.0 * M_PI - M_PI_2; 57 | CGFloat startAngleY = arc4random_uniform(180 + 1) / 180.0 * M_PI - M_PI_2; 58 | // -180度到180度(顺时针为正) 59 | CGFloat startAngleZ = arc4random_uniform(360 + 1) / 360.0 * M_PI * 2 - M_PI; 60 | snowLayer.transform = CATransform3DRotate(snowLayer.transform, startAngleX, 1, 0, 0); 61 | snowLayer.transform = CATransform3DRotate(snowLayer.transform, startAngleY, 0, 1, 0); 62 | snowLayer.transform = CATransform3DRotate(snowLayer.transform, startAngleZ, 0, 0, 1); 63 | } 64 | // 创建定时器 65 | timer = [NSTimer timerWithTimeInterval:interval target:self selector:@selector(timerFire:) userInfo:snowLayersArray repeats:YES]; 66 | // 将定时器添加进当前运行循环(开启定时器) 67 | [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; 68 | // 播放背景音乐 69 | [self playBGMWithFilePath:filePath]; 70 | return timer; 71 | } 72 | 73 | static NSInteger snowIndex = 0; 74 | + (void)timerFire:(NSTimer *)timer { 75 | // 创建定时器持续下落雪花 76 | // 依次取出雪花图层 77 | NSMutableArray *snowLayersArray = timer.userInfo; 78 | CALayer *snowLayer = snowLayersArray[snowIndex]; 79 | snowIndex++; 80 | if (snowIndex == snowLayersArray.count) { 81 | snowIndex = 0; 82 | } 83 | /********** 图层核心动画 **********/ 84 | // 在最大横向移动范围内随机位置 85 | CGFloat endX = snowLayer.frame.origin.x + arc4random_uniform(maximumHorizontalDistance + 1) - maximumHorizontalDistance * 0.5; 86 | CGFloat endY = currentContainerViewHeight; 87 | // 雪花落入终点旋转角度 88 | // -90度到90度(顺时针为正) 89 | CGFloat endAngleX = arc4random_uniform(180 + 1) / 180.0 * M_PI - M_PI_2; 90 | CGFloat endAngleY = arc4random_uniform(180 + 1) / 180.0 * M_PI - M_PI_2; 91 | // -180度到180度(顺时针为正) 92 | CGFloat endAngleZ = arc4random_uniform(360 + 1) / 360.0 * M_PI * 2 - M_PI; 93 | // 缩放比例 94 | CGFloat endScale = (arc4random_uniform(11) + 5) / 10.0; 95 | // 左右平移动画 96 | CABasicAnimation *leftAndRightTranslationAnimation = [CABasicAnimation animation]; 97 | leftAndRightTranslationAnimation.keyPath = @"position.x"; 98 | leftAndRightTranslationAnimation.toValue = @(endX); 99 | // 下平移动画 100 | CABasicAnimation *downwardTranslationAnimation = [CABasicAnimation animation]; 101 | downwardTranslationAnimation.keyPath = @"position.y"; 102 | downwardTranslationAnimation.toValue = @(endY); 103 | // 比例转化和透明度模拟远近飘落 104 | // 比例缩放 105 | CABasicAnimation *scaleAnimation = [CABasicAnimation animation]; 106 | scaleAnimation.keyPath = @"transform.scale"; 107 | scaleAnimation.toValue = @(endScale); 108 | // 透明度变化 109 | CABasicAnimation *transparencyAnimation = [CABasicAnimation animation]; 110 | transparencyAnimation.keyPath = @"transform.opacity"; 111 | transparencyAnimation.toValue = @(endScale * 2 / 3.0 * 0.2 + 0.8); 112 | // 旋转动画 113 | // 绕X轴 114 | CABasicAnimation *rotationAnimationX = [CABasicAnimation animation]; 115 | rotationAnimationX.keyPath = @"transform.rotation.x"; 116 | rotationAnimationX.toValue = @(endAngleX); 117 | // 绕Z轴 118 | CABasicAnimation *rotationAnimationY = [CABasicAnimation animation]; 119 | rotationAnimationY.keyPath = @"transform.rotation.y"; 120 | rotationAnimationY.toValue = @(endAngleY); 121 | // 绕Z轴 122 | CABasicAnimation *rotationAnimationZ = [CABasicAnimation animation]; 123 | rotationAnimationZ.keyPath = @"transform.rotation.z"; 124 | rotationAnimationZ.toValue = @(endAngleZ); 125 | // 添加进动画组 126 | CAAnimationGroup *group = [CAAnimationGroup animation]; 127 | group.animations = @[leftAndRightTranslationAnimation, downwardTranslationAnimation, scaleAnimation, transparencyAnimation, rotationAnimationX, rotationAnimationY, rotationAnimationZ]; 128 | group.duration = duration; 129 | group.removedOnCompletion = YES; 130 | // 添加动画 131 | [snowLayer addAnimation:group forKey:nil]; 132 | } 133 | 134 | + (void)playBGMWithFilePath:(NSString *)filePath { 135 | if (!filePath.length) { 136 | return; 137 | } 138 | audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:filePath] error:NULL]; 139 | audioPlayer.numberOfLoops = -1; 140 | [audioPlayer play]; 141 | } 142 | 143 | + (void)removeSnowAnimation { 144 | // 移除定时器 145 | [timer invalidate]; 146 | timer = nil; 147 | // 移除动画视图 148 | [animationView removeFromSuperview]; 149 | animationView = nil; 150 | // 移除音频播放器 151 | [audioPlayer stop]; 152 | audioPlayer = nil; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /XYFSnowAnimationDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XYFSnowAnimationDemo 4 | // 5 | // Created by xyf on 2017/1/30. 6 | // Copyright © 2017年 XYF. 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 | -------------------------------------------------------------------------------- /previewEffectGIFImage/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/previewEffectGIFImage/.DS_Store -------------------------------------------------------------------------------- /previewEffectGIFImage/fallingFlower.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/previewEffectGIFImage/fallingFlower.gif -------------------------------------------------------------------------------- /previewEffectGIFImage/snow.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderXYF/XYFSnowAnimation/04166ddc3d4bd07ccb0437e13592c2fe904f363b/previewEffectGIFImage/snow.gif --------------------------------------------------------------------------------