├── .gitignore ├── README.md ├── XBPraiseAnimation.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── XBPraiseAnimation ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── player_praise_s.imageset │ │ ├── Contents.json │ │ ├── 小横版点赞@2x.png │ │ └── 小横版点赞@3x.png │ ├── praise_sprite_0.imageset │ │ ├── Contents.json │ │ ├── 红@2x.png │ │ └── 红@3x.png │ ├── praise_sprite_1.imageset │ │ ├── Contents.json │ │ ├── 红星@2x.png │ │ └── 红星@3x.png │ ├── praise_sprite_2.imageset │ │ ├── Contents.json │ │ ├── 红赞@2x.png │ │ └── 红赞@3x.png │ ├── praise_sprite_3.imageset │ │ ├── Contents.json │ │ ├── 黄@2x.png │ │ └── 黄@3x.png │ ├── praise_sprite_4.imageset │ │ ├── Contents.json │ │ ├── 绿@2x.png │ │ └── 绿@3x.png │ └── praise_sprite_5.imageset │ │ ├── Contents.json │ │ ├── 紫赞@2x.png │ │ └── 紫赞@3x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.h ├── ViewController.m ├── XBPraiseAnimation │ ├── XBPraiseAnimation.h │ └── XBPraiseAnimation.m └── main.m └── demo_pictures.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 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | # Carthage/Checkouts 43 | 44 | Carthage/Build 45 | 46 | # fastlane 47 | # 48 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 49 | # screenshots whenever they are needed. 50 | # For more information about the recommended setup visit: 51 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 52 | 53 | fastlane/report.xml 54 | fastlane/Preview.html 55 | fastlane/screenshots/**/*.png 56 | fastlane/test_output 57 | 58 | # Code Injection 59 | # 60 | # After new code Injection tools there's a generated folder /iOSInjectionProject 61 | # https://github.com/johnno1962/injectionforxcode 62 | 63 | iOSInjectionProject/ 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # XBPraiseAnimation 2 | ## 简易、轻量级、基于基础动画的直播点赞动画实现 3 | 4 | 1.初始化对象,设置点赞动画图片数组、起点位置与显示层 5 | `NSArray * imageArray = @[[UIImage imageNamed:@"praise_sprite_0"],` 6 | ` [UIImage imageNamed:@"praise_sprite_1"],` 7 | ` [UIImage imageNamed:@"praise_sprite_2"],` 8 | ` [UIImage imageNamed:@"praise_sprite_3"],` 9 | ` [UIImage imageNamed:@"praise_sprite_4"]];` 10 | `XBPraiseAnimation *praiseAnimation = [[XBPraiseAnimation alloc] initWithImageArray:imageArray onView:self.view point:CGPointMake(btn_1.frame.origin.x, btn_1.frame.origin.y)];` 11 | 12 | 2.调节动画速度 13 | `praiseAnimation.speed = 5;` 14 | 15 | 3.调节动画左右摆动幅度 16 | `praiseAnimation.leftSpacing = 50; 17 | praiseAnimation.rightSpacing = 50;` 18 | 19 | 4.调节动画高度 20 | `praiseAnimation.animationH = 300;` 21 | 22 | 5.调节显示对象大小 23 | `praiseAnimation.imageSize = CGRectMark(25,25);` 24 | 25 | 6.开始启动动画,可设置同事展示数量 26 | `<[praiseAnimation animate:2];>` 27 | 28 | ![image text](https://github.com/Simbabo/XBPraiseAnimation/blob/master/demo_pictures.gif) 29 | -------------------------------------------------------------------------------- /XBPraiseAnimation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C0EAE70721FFFB9500B43AAF /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C0EAE70621FFFB9500B43AAF /* AppDelegate.m */; }; 11 | C0EAE70A21FFFB9500B43AAF /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C0EAE70921FFFB9500B43AAF /* ViewController.m */; }; 12 | C0EAE70D21FFFB9500B43AAF /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0EAE70B21FFFB9500B43AAF /* Main.storyboard */; }; 13 | C0EAE70F21FFFB9800B43AAF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C0EAE70E21FFFB9800B43AAF /* Assets.xcassets */; }; 14 | C0EAE71221FFFB9800B43AAF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C0EAE71021FFFB9800B43AAF /* LaunchScreen.storyboard */; }; 15 | C0EAE71521FFFB9800B43AAF /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C0EAE71421FFFB9800B43AAF /* main.m */; }; 16 | C0EAE71E2200003C00B43AAF /* XBPraiseAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = C0EAE71D2200003C00B43AAF /* XBPraiseAnimation.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | C0EAE70221FFFB9500B43AAF /* XBPraiseAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XBPraiseAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | C0EAE70521FFFB9500B43AAF /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 22 | C0EAE70621FFFB9500B43AAF /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 23 | C0EAE70821FFFB9500B43AAF /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 24 | C0EAE70921FFFB9500B43AAF /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 25 | C0EAE70C21FFFB9500B43AAF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 26 | C0EAE70E21FFFB9800B43AAF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | C0EAE71121FFFB9800B43AAF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 28 | C0EAE71321FFFB9800B43AAF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | C0EAE71421FFFB9800B43AAF /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 30 | C0EAE71C2200003C00B43AAF /* XBPraiseAnimation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XBPraiseAnimation.h; sourceTree = ""; }; 31 | C0EAE71D2200003C00B43AAF /* XBPraiseAnimation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XBPraiseAnimation.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | C0EAE6FF21FFFB9500B43AAF /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | C0EAE6F921FFFB9500B43AAF = { 46 | isa = PBXGroup; 47 | children = ( 48 | C0EAE70421FFFB9500B43AAF /* XBPraiseAnimation */, 49 | C0EAE70321FFFB9500B43AAF /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | C0EAE70321FFFB9500B43AAF /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | C0EAE70221FFFB9500B43AAF /* XBPraiseAnimation.app */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | C0EAE70421FFFB9500B43AAF /* XBPraiseAnimation */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | C0EAE71B21FFFE3D00B43AAF /* XBPraiseAnimation */, 65 | C0EAE70521FFFB9500B43AAF /* AppDelegate.h */, 66 | C0EAE70621FFFB9500B43AAF /* AppDelegate.m */, 67 | C0EAE70821FFFB9500B43AAF /* ViewController.h */, 68 | C0EAE70921FFFB9500B43AAF /* ViewController.m */, 69 | C0EAE70B21FFFB9500B43AAF /* Main.storyboard */, 70 | C0EAE70E21FFFB9800B43AAF /* Assets.xcassets */, 71 | C0EAE71021FFFB9800B43AAF /* LaunchScreen.storyboard */, 72 | C0EAE71321FFFB9800B43AAF /* Info.plist */, 73 | C0EAE71421FFFB9800B43AAF /* main.m */, 74 | ); 75 | path = XBPraiseAnimation; 76 | sourceTree = ""; 77 | }; 78 | C0EAE71B21FFFE3D00B43AAF /* XBPraiseAnimation */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | C0EAE71C2200003C00B43AAF /* XBPraiseAnimation.h */, 82 | C0EAE71D2200003C00B43AAF /* XBPraiseAnimation.m */, 83 | ); 84 | path = XBPraiseAnimation; 85 | sourceTree = ""; 86 | }; 87 | /* End PBXGroup section */ 88 | 89 | /* Begin PBXNativeTarget section */ 90 | C0EAE70121FFFB9500B43AAF /* XBPraiseAnimation */ = { 91 | isa = PBXNativeTarget; 92 | buildConfigurationList = C0EAE71821FFFB9800B43AAF /* Build configuration list for PBXNativeTarget "XBPraiseAnimation" */; 93 | buildPhases = ( 94 | C0EAE6FE21FFFB9500B43AAF /* Sources */, 95 | C0EAE6FF21FFFB9500B43AAF /* Frameworks */, 96 | C0EAE70021FFFB9500B43AAF /* Resources */, 97 | ); 98 | buildRules = ( 99 | ); 100 | dependencies = ( 101 | ); 102 | name = XBPraiseAnimation; 103 | productName = XBPraiseAnimation; 104 | productReference = C0EAE70221FFFB9500B43AAF /* XBPraiseAnimation.app */; 105 | productType = "com.apple.product-type.application"; 106 | }; 107 | /* End PBXNativeTarget section */ 108 | 109 | /* Begin PBXProject section */ 110 | C0EAE6FA21FFFB9500B43AAF /* Project object */ = { 111 | isa = PBXProject; 112 | attributes = { 113 | LastUpgradeCheck = 1010; 114 | ORGANIZATIONNAME = XXB; 115 | TargetAttributes = { 116 | C0EAE70121FFFB9500B43AAF = { 117 | CreatedOnToolsVersion = 10.1; 118 | }; 119 | }; 120 | }; 121 | buildConfigurationList = C0EAE6FD21FFFB9500B43AAF /* Build configuration list for PBXProject "XBPraiseAnimation" */; 122 | compatibilityVersion = "Xcode 9.3"; 123 | developmentRegion = en; 124 | hasScannedForEncodings = 0; 125 | knownRegions = ( 126 | en, 127 | Base, 128 | ); 129 | mainGroup = C0EAE6F921FFFB9500B43AAF; 130 | productRefGroup = C0EAE70321FFFB9500B43AAF /* Products */; 131 | projectDirPath = ""; 132 | projectRoot = ""; 133 | targets = ( 134 | C0EAE70121FFFB9500B43AAF /* XBPraiseAnimation */, 135 | ); 136 | }; 137 | /* End PBXProject section */ 138 | 139 | /* Begin PBXResourcesBuildPhase section */ 140 | C0EAE70021FFFB9500B43AAF /* Resources */ = { 141 | isa = PBXResourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | C0EAE71221FFFB9800B43AAF /* LaunchScreen.storyboard in Resources */, 145 | C0EAE70F21FFFB9800B43AAF /* Assets.xcassets in Resources */, 146 | C0EAE70D21FFFB9500B43AAF /* Main.storyboard in Resources */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | /* End PBXResourcesBuildPhase section */ 151 | 152 | /* Begin PBXSourcesBuildPhase section */ 153 | C0EAE6FE21FFFB9500B43AAF /* Sources */ = { 154 | isa = PBXSourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | C0EAE71E2200003C00B43AAF /* XBPraiseAnimation.m in Sources */, 158 | C0EAE70A21FFFB9500B43AAF /* ViewController.m in Sources */, 159 | C0EAE71521FFFB9800B43AAF /* main.m in Sources */, 160 | C0EAE70721FFFB9500B43AAF /* AppDelegate.m in Sources */, 161 | ); 162 | runOnlyForDeploymentPostprocessing = 0; 163 | }; 164 | /* End PBXSourcesBuildPhase section */ 165 | 166 | /* Begin PBXVariantGroup section */ 167 | C0EAE70B21FFFB9500B43AAF /* Main.storyboard */ = { 168 | isa = PBXVariantGroup; 169 | children = ( 170 | C0EAE70C21FFFB9500B43AAF /* Base */, 171 | ); 172 | name = Main.storyboard; 173 | sourceTree = ""; 174 | }; 175 | C0EAE71021FFFB9800B43AAF /* LaunchScreen.storyboard */ = { 176 | isa = PBXVariantGroup; 177 | children = ( 178 | C0EAE71121FFFB9800B43AAF /* Base */, 179 | ); 180 | name = LaunchScreen.storyboard; 181 | sourceTree = ""; 182 | }; 183 | /* End PBXVariantGroup section */ 184 | 185 | /* Begin XCBuildConfiguration section */ 186 | C0EAE71621FFFB9800B43AAF /* Debug */ = { 187 | isa = XCBuildConfiguration; 188 | buildSettings = { 189 | ALWAYS_SEARCH_USER_PATHS = NO; 190 | CLANG_ANALYZER_NONNULL = YES; 191 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 192 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 193 | CLANG_CXX_LIBRARY = "libc++"; 194 | CLANG_ENABLE_MODULES = YES; 195 | CLANG_ENABLE_OBJC_ARC = YES; 196 | CLANG_ENABLE_OBJC_WEAK = YES; 197 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 198 | CLANG_WARN_BOOL_CONVERSION = YES; 199 | CLANG_WARN_COMMA = YES; 200 | CLANG_WARN_CONSTANT_CONVERSION = YES; 201 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 202 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 203 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 204 | CLANG_WARN_EMPTY_BODY = YES; 205 | CLANG_WARN_ENUM_CONVERSION = YES; 206 | CLANG_WARN_INFINITE_RECURSION = YES; 207 | CLANG_WARN_INT_CONVERSION = YES; 208 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 209 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 210 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 212 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 213 | CLANG_WARN_STRICT_PROTOTYPES = YES; 214 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 215 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 216 | CLANG_WARN_UNREACHABLE_CODE = YES; 217 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 218 | CODE_SIGN_IDENTITY = "iPhone Developer"; 219 | COPY_PHASE_STRIP = NO; 220 | DEBUG_INFORMATION_FORMAT = dwarf; 221 | ENABLE_STRICT_OBJC_MSGSEND = YES; 222 | ENABLE_TESTABILITY = YES; 223 | GCC_C_LANGUAGE_STANDARD = gnu11; 224 | GCC_DYNAMIC_NO_PIC = NO; 225 | GCC_NO_COMMON_BLOCKS = YES; 226 | GCC_OPTIMIZATION_LEVEL = 0; 227 | GCC_PREPROCESSOR_DEFINITIONS = ( 228 | "DEBUG=1", 229 | "$(inherited)", 230 | ); 231 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 232 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 233 | GCC_WARN_UNDECLARED_SELECTOR = YES; 234 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 235 | GCC_WARN_UNUSED_FUNCTION = YES; 236 | GCC_WARN_UNUSED_VARIABLE = YES; 237 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 238 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 239 | MTL_FAST_MATH = YES; 240 | ONLY_ACTIVE_ARCH = YES; 241 | SDKROOT = iphoneos; 242 | }; 243 | name = Debug; 244 | }; 245 | C0EAE71721FFFB9800B43AAF /* Release */ = { 246 | isa = XCBuildConfiguration; 247 | buildSettings = { 248 | ALWAYS_SEARCH_USER_PATHS = NO; 249 | CLANG_ANALYZER_NONNULL = YES; 250 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 251 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 252 | CLANG_CXX_LIBRARY = "libc++"; 253 | CLANG_ENABLE_MODULES = YES; 254 | CLANG_ENABLE_OBJC_ARC = YES; 255 | CLANG_ENABLE_OBJC_WEAK = YES; 256 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_COMMA = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INFINITE_RECURSION = YES; 266 | CLANG_WARN_INT_CONVERSION = YES; 267 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 268 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 269 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 272 | CLANG_WARN_STRICT_PROTOTYPES = YES; 273 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 274 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | CODE_SIGN_IDENTITY = "iPhone Developer"; 278 | COPY_PHASE_STRIP = NO; 279 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 280 | ENABLE_NS_ASSERTIONS = NO; 281 | ENABLE_STRICT_OBJC_MSGSEND = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu11; 283 | GCC_NO_COMMON_BLOCKS = YES; 284 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 285 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 286 | GCC_WARN_UNDECLARED_SELECTOR = YES; 287 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 288 | GCC_WARN_UNUSED_FUNCTION = YES; 289 | GCC_WARN_UNUSED_VARIABLE = YES; 290 | IPHONEOS_DEPLOYMENT_TARGET = 12.1; 291 | MTL_ENABLE_DEBUG_INFO = NO; 292 | MTL_FAST_MATH = YES; 293 | SDKROOT = iphoneos; 294 | VALIDATE_PRODUCT = YES; 295 | }; 296 | name = Release; 297 | }; 298 | C0EAE71921FFFB9800B43AAF /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 302 | CODE_SIGN_STYLE = Automatic; 303 | INFOPLIST_FILE = XBPraiseAnimation/Info.plist; 304 | LD_RUNPATH_SEARCH_PATHS = ( 305 | "$(inherited)", 306 | "@executable_path/Frameworks", 307 | ); 308 | PRODUCT_BUNDLE_IDENTIFIER = XXB.XBPraiseAnimation; 309 | PRODUCT_NAME = "$(TARGET_NAME)"; 310 | TARGETED_DEVICE_FAMILY = "1,2"; 311 | }; 312 | name = Debug; 313 | }; 314 | C0EAE71A21FFFB9800B43AAF /* Release */ = { 315 | isa = XCBuildConfiguration; 316 | buildSettings = { 317 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 318 | CODE_SIGN_STYLE = Automatic; 319 | INFOPLIST_FILE = XBPraiseAnimation/Info.plist; 320 | LD_RUNPATH_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "@executable_path/Frameworks", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = XXB.XBPraiseAnimation; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | TARGETED_DEVICE_FAMILY = "1,2"; 327 | }; 328 | name = Release; 329 | }; 330 | /* End XCBuildConfiguration section */ 331 | 332 | /* Begin XCConfigurationList section */ 333 | C0EAE6FD21FFFB9500B43AAF /* Build configuration list for PBXProject "XBPraiseAnimation" */ = { 334 | isa = XCConfigurationList; 335 | buildConfigurations = ( 336 | C0EAE71621FFFB9800B43AAF /* Debug */, 337 | C0EAE71721FFFB9800B43AAF /* Release */, 338 | ); 339 | defaultConfigurationIsVisible = 0; 340 | defaultConfigurationName = Release; 341 | }; 342 | C0EAE71821FFFB9800B43AAF /* Build configuration list for PBXNativeTarget "XBPraiseAnimation" */ = { 343 | isa = XCConfigurationList; 344 | buildConfigurations = ( 345 | C0EAE71921FFFB9800B43AAF /* Debug */, 346 | C0EAE71A21FFFB9800B43AAF /* Release */, 347 | ); 348 | defaultConfigurationIsVisible = 0; 349 | defaultConfigurationName = Release; 350 | }; 351 | /* End XCConfigurationList section */ 352 | }; 353 | rootObject = C0EAE6FA21FFFB9500B43AAF /* Project object */; 354 | } 355 | -------------------------------------------------------------------------------- /XBPraiseAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /XBPraiseAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /XBPraiseAnimation/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. 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 | -------------------------------------------------------------------------------- /XBPraiseAnimation/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // 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. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | 30 | - (void)applicationDidEnterBackground:(UIApplication *)application { 31 | // 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. 32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 33 | } 34 | 35 | 36 | - (void)applicationWillEnterForeground:(UIApplication *)application { 37 | // 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. 38 | } 39 | 40 | 41 | - (void)applicationDidBecomeActive:(UIApplication *)application { 42 | // 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. 43 | } 44 | 45 | 46 | - (void)applicationWillTerminate:(UIApplication *)application { 47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 48 | } 49 | 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /XBPraiseAnimation/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" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/player_praise_s.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "小横版点赞@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "小横版点赞@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/player_praise_s.imageset/小横版点赞@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/player_praise_s.imageset/小横版点赞@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/player_praise_s.imageset/小横版点赞@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/player_praise_s.imageset/小横版点赞@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "红@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "红@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_0.imageset/红@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_0.imageset/红@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_0.imageset/红@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_0.imageset/红@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "红星@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "红星@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_1.imageset/红星@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_1.imageset/红星@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_1.imageset/红星@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_1.imageset/红星@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "红赞@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "红赞@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_2.imageset/红赞@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_2.imageset/红赞@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_2.imageset/红赞@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_2.imageset/红赞@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_3.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "黄@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "黄@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_3.imageset/黄@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_3.imageset/黄@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_3.imageset/黄@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_3.imageset/黄@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_4.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "绿@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "绿@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_4.imageset/绿@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_4.imageset/绿@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_4.imageset/绿@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_4.imageset/绿@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_5.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "紫赞@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "紫赞@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_5.imageset/紫赞@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_5.imageset/紫赞@2x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/Assets.xcassets/praise_sprite_5.imageset/紫赞@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/XBPraiseAnimation/Assets.xcassets/praise_sprite_5.imageset/紫赞@3x.png -------------------------------------------------------------------------------- /XBPraiseAnimation/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 | -------------------------------------------------------------------------------- /XBPraiseAnimation/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 | 25 | -------------------------------------------------------------------------------- /XBPraiseAnimation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | UIMainStoryboardFile 26 | Main 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 | -------------------------------------------------------------------------------- /XBPraiseAnimation/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /XBPraiseAnimation/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. All rights reserved. 7 | // 8 | #define ScreenWidth [UIScreen mainScreen].bounds.size.width 9 | #define ScreenHeight [UIScreen mainScreen].bounds.size.height 10 | 11 | #import "ViewController.h" 12 | #import "XBPraiseAnimation.h" 13 | 14 | @interface ViewController () 15 | @property (nonatomic ,strong) XBPraiseAnimation *praiseAnimation_1; 16 | @property (nonatomic ,strong) XBPraiseAnimation *praiseAnimation_2; 17 | @property (nonatomic ,strong) XBPraiseAnimation *praiseAnimation_3; 18 | 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | 26 | UIButton *btn_1 = [[UIButton alloc] initWithFrame:CGRectMake(30, ScreenHeight - 100, 25, 25)]; 27 | [btn_1 setImage:[UIImage imageNamed:@"player_praise_s"] forState:UIControlStateNormal]; 28 | btn_1.backgroundColor = [UIColor clearColor]; 29 | [btn_1 addTarget:self action:@selector(btn_1_Click) forControlEvents:UIControlEventTouchUpInside]; 30 | [self.view addSubview:btn_1]; 31 | 32 | UIButton *btn_2 = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth/2 - 25/2, ScreenHeight - 100, 25, 25)]; 33 | [btn_2 setImage:[UIImage imageNamed:@"player_praise_s"] forState:UIControlStateNormal]; 34 | btn_2.backgroundColor = [UIColor clearColor]; 35 | [btn_2 addTarget:self action:@selector(btn_2_Click) forControlEvents:UIControlEventTouchUpInside]; 36 | [self.view addSubview:btn_2]; 37 | 38 | UIButton *btn_3 = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth - 25 - 30, ScreenHeight - 100, 25, 25)]; 39 | [btn_3 setImage:[UIImage imageNamed:@"player_praise_s"] forState:UIControlStateNormal]; 40 | btn_3.backgroundColor = [UIColor clearColor]; 41 | [btn_3 addTarget:self action:@selector(btn_3_Click) forControlEvents:UIControlEventTouchUpInside]; 42 | [self.view addSubview:btn_3]; 43 | 44 | //设置点赞图片数组 45 | NSArray * imageArray = @[[UIImage imageNamed:@"praise_sprite_0"], 46 | [UIImage imageNamed:@"praise_sprite_1"], 47 | [UIImage imageNamed:@"praise_sprite_2"], 48 | [UIImage imageNamed:@"praise_sprite_3"], 49 | [UIImage imageNamed:@"praise_sprite_4"]]; 50 | 51 | //初始化点赞动画对象 52 | self.praiseAnimation_1 = [[XBPraiseAnimation alloc] initWithImageArray:imageArray onView:self.view point:CGPointMake(btn_1.frame.origin.x, btn_1.frame.origin.y)]; 53 | self.praiseAnimation_2 = [[XBPraiseAnimation alloc] initWithImageArray:imageArray onView:self.view point:CGPointMake(btn_2.frame.origin.x, btn_2.frame.origin.y)]; 54 | self.praiseAnimation_3 = [[XBPraiseAnimation alloc] initWithImageArray:imageArray onView:self.view point:CGPointMake(btn_3.frame.origin.x, btn_3.frame.origin.y)]; 55 | 56 | //调节左右移动边距 57 | self.praiseAnimation_1.leftSpacing = 10; 58 | self.praiseAnimation_1.rightSpacing = 60; 59 | 60 | self.praiseAnimation_2.leftSpacing = 50; 61 | self.praiseAnimation_2.rightSpacing = 50; 62 | 63 | self.praiseAnimation_3.leftSpacing = 60; 64 | self.praiseAnimation_3.rightSpacing = 10; 65 | } 66 | 67 | -(void)btn_1_Click{ 68 | [self.praiseAnimation_1 animate:2]; 69 | } 70 | 71 | -(void)btn_2_Click{ 72 | [self.praiseAnimation_2 animate:2]; 73 | } 74 | 75 | -(void)btn_3_Click{ 76 | [self.praiseAnimation_3 animate:2]; 77 | } 78 | 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /XBPraiseAnimation/XBPraiseAnimation/XBPraiseAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // XBPraiseAnimation.h 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface XBPraiseAnimation : NSObject 13 | 14 | /** 15 | * 动画对象大小 默认(25,25) 16 | */ 17 | @property (nonatomic ,assign) CGSize imageSize; 18 | 19 | /** 20 | * 动画移动高度 默认(300) 21 | */ 22 | @property (nonatomic ,assign) CGFloat animationH; 23 | 24 | /** 25 | * 动画左右幅度 以起点位置为参照点 默认50 26 | */ 27 | @property (nonatomic ,assign) CGFloat leftSpacing; 28 | @property (nonatomic ,assign) CGFloat rightSpacing; 29 | 30 | /** 31 | * 动画速度 默认 5 32 | */ 33 | @property (nonatomic ,assign) CGFloat speed; 34 | 35 | 36 | /** 37 | * 初始化 38 | * 39 | * @param imageArray 动画的图片数组 40 | * @param view 展示层 41 | * @param point 动画起点位置 42 | * return XBPraiseAnimation 43 | */ 44 | -(instancetype)initWithImageArray:(NSArray*)imageArray onView:(UIView *)view point:(CGPoint)point; 45 | 46 | /** 47 | * 开始动画 48 | * 49 | * @param count 展示对象数量 50 | */ 51 | -(void)animate:(NSInteger)count; 52 | @end 53 | 54 | -------------------------------------------------------------------------------- /XBPraiseAnimation/XBPraiseAnimation/XBPraiseAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // XBPraiseAnimation.m 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. All rights reserved. 7 | // 8 | 9 | #import "XBPraiseAnimation.h" 10 | 11 | @interface VZPraiseImage : UIImageView 12 | @property (nonatomic ,assign) CGFloat speed; 13 | @property (nonatomic ,assign) CGFloat animateH; 14 | @property (nonatomic ,assign) CGFloat minX; 15 | @property (nonatomic ,assign) CGFloat maxX; 16 | @end 17 | @implementation VZPraiseImage 18 | -(instancetype)initWithFrame:(CGRect)frame{ 19 | if (self = [super initWithFrame:frame]) { 20 | _speed = 5; 21 | _animateH = 300; 22 | } 23 | return self; 24 | } 25 | 26 | -(void)animate 27 | { 28 | 29 | CGFloat min = _minX; 30 | CGFloat random = _maxX - _minX; 31 | CGFloat animateDuration = arc4random_uniform(3)+_speed; 32 | self.alpha = 0; 33 | CABasicAnimation *scaleAnimate =[CABasicAnimation animationWithKeyPath:@"transform.scale"]; 34 | scaleAnimate.duration = 0.2; 35 | scaleAnimate.fromValue = @0.2; 36 | scaleAnimate.toValue = @1; 37 | 38 | CAKeyframeAnimation *xAnimate = [CAKeyframeAnimation animationWithKeyPath:@"position.x"]; 39 | xAnimate.duration = animateDuration; 40 | xAnimate.values = @[@(self.layer.position.x),@(arc4random_uniform(random)+min),@(arc4random_uniform(random)+min),@(arc4random_uniform(random)+min)]; 41 | 42 | CABasicAnimation *yAnimate =[CABasicAnimation animationWithKeyPath:@"position.y"]; 43 | yAnimate.duration = animateDuration; 44 | yAnimate.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; 45 | yAnimate.fromValue = @(self.frame.origin.y); 46 | yAnimate.toValue = @(self.frame.origin.y-(arc4random_uniform(50)+_animateH)); 47 | 48 | CABasicAnimation *opacityAnimate = [CABasicAnimation animationWithKeyPath:@"opacity"]; 49 | opacityAnimate.duration = animateDuration+1; 50 | opacityAnimate.fromValue = @1; 51 | opacityAnimate.toValue = @0; 52 | opacityAnimate.delegate = self; 53 | 54 | xAnimate.fillMode = kCAFillModeForwards; 55 | xAnimate.removedOnCompletion = NO; 56 | 57 | yAnimate.fillMode = kCAFillModeForwards; 58 | yAnimate.removedOnCompletion = NO; 59 | 60 | opacityAnimate.fillMode = kCAFillModeForwards; 61 | opacityAnimate.removedOnCompletion = NO; 62 | 63 | scaleAnimate.fillMode = kCAFillModeForwards; 64 | scaleAnimate.removedOnCompletion = NO; 65 | 66 | [self.layer addAnimation:xAnimate forKey:nil]; 67 | [self.layer addAnimation:yAnimate forKey:nil]; 68 | [self.layer addAnimation:opacityAnimate forKey:nil]; 69 | [self.layer addAnimation:scaleAnimate forKey:nil]; 70 | } 71 | 72 | -(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag 73 | { 74 | self.hidden = YES; 75 | [self removeFromSuperview]; 76 | [self.layer removeAllAnimations]; 77 | } 78 | @end 79 | 80 | 81 | @interface XBPraiseAnimation() 82 | @property (nonatomic ,strong) NSArray* imageArray; 83 | @property (nonatomic ,weak) UIView *view; 84 | @property (nonatomic ,assign) CGPoint point; 85 | @end 86 | @implementation XBPraiseAnimation 87 | -(instancetype)initWithImageArray:(NSArray*)imageArray onView:(UIView *)view point:(CGPoint)point{ 88 | self = [super init]; 89 | if (self) { 90 | _imageArray = imageArray; 91 | _view = view; 92 | _point = point; 93 | _imageSize = CGSizeMake(25, 25); 94 | _speed = 5; 95 | _animationH = 300.0; 96 | _leftSpacing = 50.0; 97 | _rightSpacing = 50.0; 98 | } 99 | return self; 100 | } 101 | 102 | -(void)animate:(NSInteger)count{ 103 | if (count == 0) count = 1; 104 | for (int i = 0; i < count; i++) { 105 | int random = (int)[_imageArray count]; 106 | NSInteger index = arc4random_uniform(random); 107 | UIImage *image = _imageArray[index]; 108 | VZPraiseImage *praise = [[VZPraiseImage alloc] initWithImage:image]; 109 | praise.frame = CGRectMake(_point.x, _point.y, _imageSize.width, _imageSize.height); 110 | praise.animateH = _animationH; 111 | praise.speed = _speed; 112 | praise.minX = _point.x - _leftSpacing; 113 | praise.maxX = CGRectGetMaxX(praise.frame) + _rightSpacing; 114 | [_view addSubview:praise]; 115 | [praise animate]; 116 | } 117 | } 118 | 119 | 120 | @end 121 | -------------------------------------------------------------------------------- /XBPraiseAnimation/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XBPraiseAnimation 4 | // 5 | // Created by 许鑫博 on 2019/1/29. 6 | // Copyright © 2019年 XXB. 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 | -------------------------------------------------------------------------------- /demo_pictures.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simbabo/XBPraiseAnimation/45f1d149a9449ac5475ea2c9dc271166a087b36a/demo_pictures.gif --------------------------------------------------------------------------------