diff --git a/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.pbxproj b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.pbxproj new file mode 100644 index 0000000..22ee7d2 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.pbxproj @@ -0,0 +1,335 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 6B908B2B2575904100629ACE /* ParticleAnimationEffectApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B908B2A2575904100629ACE /* ParticleAnimationEffectApp.swift */; }; + 6B908B2D2575904100629ACE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B908B2C2575904100629ACE /* ContentView.swift */; }; + 6B908B2F2575904300629ACE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B908B2E2575904300629ACE /* Assets.xcassets */; }; + 6B908B322575904300629ACE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6B908B312575904300629ACE /* Preview Assets.xcassets */; }; + 6B908B3B2575906900629ACE /* ParticleEffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B908B3A2575906900629ACE /* ParticleEffectView.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 6B908B272575904100629ACE /* ParticleAnimationEffect.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ParticleAnimationEffect.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 6B908B2A2575904100629ACE /* ParticleAnimationEffectApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticleAnimationEffectApp.swift; sourceTree = ""; }; + 6B908B2C2575904100629ACE /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 6B908B2E2575904300629ACE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 6B908B312575904300629ACE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 6B908B332575904300629ACE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6B908B3A2575906900629ACE /* ParticleEffectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParticleEffectView.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 6B908B242575904100629ACE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 6B908B1E2575904100629ACE = { + isa = PBXGroup; + children = ( + 6B908B292575904100629ACE /* ParticleAnimationEffect */, + 6B908B282575904100629ACE /* Products */, + ); + sourceTree = ""; + }; + 6B908B282575904100629ACE /* Products */ = { + isa = PBXGroup; + children = ( + 6B908B272575904100629ACE /* ParticleAnimationEffect.app */, + ); + name = Products; + sourceTree = ""; + }; + 6B908B292575904100629ACE /* ParticleAnimationEffect */ = { + isa = PBXGroup; + children = ( + 6B908B2A2575904100629ACE /* ParticleAnimationEffectApp.swift */, + 6B908B2C2575904100629ACE /* ContentView.swift */, + 6B908B3A2575906900629ACE /* ParticleEffectView.swift */, + 6B908B2E2575904300629ACE /* Assets.xcassets */, + 6B908B332575904300629ACE /* Info.plist */, + 6B908B302575904300629ACE /* Preview Content */, + ); + path = ParticleAnimationEffect; + sourceTree = ""; + }; + 6B908B302575904300629ACE /* Preview Content */ = { + isa = PBXGroup; + children = ( + 6B908B312575904300629ACE /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 6B908B262575904100629ACE /* ParticleAnimationEffect */ = { + isa = PBXNativeTarget; + buildConfigurationList = 6B908B362575904300629ACE /* Build configuration list for PBXNativeTarget "ParticleAnimationEffect" */; + buildPhases = ( + 6B908B232575904100629ACE /* Sources */, + 6B908B242575904100629ACE /* Frameworks */, + 6B908B252575904100629ACE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParticleAnimationEffect; + productName = ParticleAnimationEffect; + productReference = 6B908B272575904100629ACE /* ParticleAnimationEffect.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 6B908B1F2575904100629ACE /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1220; + LastUpgradeCheck = 1220; + TargetAttributes = { + 6B908B262575904100629ACE = { + CreatedOnToolsVersion = 12.2; + }; + }; + }; + buildConfigurationList = 6B908B222575904100629ACE /* Build configuration list for PBXProject "ParticleAnimationEffect" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 6B908B1E2575904100629ACE; + productRefGroup = 6B908B282575904100629ACE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 6B908B262575904100629ACE /* ParticleAnimationEffect */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 6B908B252575904100629ACE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B908B322575904300629ACE /* Preview Assets.xcassets in Resources */, + 6B908B2F2575904300629ACE /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 6B908B232575904100629ACE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6B908B3B2575906900629ACE /* ParticleEffectView.swift in Sources */, + 6B908B2D2575904100629ACE /* ContentView.swift in Sources */, + 6B908B2B2575904100629ACE /* ParticleAnimationEffectApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 6B908B342575904300629ACE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 6B908B352575904300629ACE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.2; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 6B908B372575904300629ACE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"ParticleAnimationEffect/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = ParticleAnimationEffect/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.DevLiuSir.ParticleAnimationEffect; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 6B908B382575904300629ACE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"ParticleAnimationEffect/Preview Content\""; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = ParticleAnimationEffect/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.DevLiuSir.ParticleAnimationEffect; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 6B908B222575904100629ACE /* Build configuration list for PBXProject "ParticleAnimationEffect" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6B908B342575904300629ACE /* Debug */, + 6B908B352575904300629ACE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 6B908B362575904300629ACE /* Build configuration list for PBXNativeTarget "ParticleAnimationEffect" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6B908B372575904300629ACE /* Debug */, + 6B908B382575904300629ACE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 6B908B1F2575904100629ACE /* Project object */; +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AccentColor.colorset/Contents.json b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AppIcon.appiconset/Contents.json b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9221b9b --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/Contents.json b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/ContentView.swift b/ParticleAnimationEffect/ParticleAnimationEffect/ContentView.swift new file mode 100644 index 0000000..e105730 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/ContentView.swift @@ -0,0 +1,41 @@ +// +// ContentView.swift +// ParticleAnimationEffect +// +// Created by Liu Chuan on 2020/11/09. +// + +import SwiftUI + +struct ContentView: View { + + var body: some View { + + ZStack { + Color.black + + // 可以多个组合使用:红、绿、蓝 + Circle() + .fill(Color.red) + .frame(width: 40, height: 40) + .modifier(ParticleEffectView(count: 100)) + + Circle() + .fill(Color.green) + .frame(width: 40, height: 40) + .modifier(ParticleEffectView(count: 100)) + + Circle() + .fill(Color.blue) + .frame(width: 40, height: 40) + .modifier(ParticleEffectView(count: 100)) + } + .edgesIgnoringSafeArea(.all) + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/Info.plist b/ParticleAnimationEffect/ParticleAnimationEffect/Info.plist new file mode 100644 index 0000000..efc211a --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/Info.plist @@ -0,0 +1,50 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + + UIApplicationSupportsIndirectInputEvents + + UILaunchScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/ParticleAnimationEffectApp.swift b/ParticleAnimationEffect/ParticleAnimationEffect/ParticleAnimationEffectApp.swift new file mode 100644 index 0000000..271df53 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/ParticleAnimationEffectApp.swift @@ -0,0 +1,17 @@ +// +// ParticleAnimationEffectApp.swift +// ParticleAnimationEffect +// +// Created by Liu Chuan on 2020/11/09. +// + +import SwiftUI + +@main +struct ParticleAnimationEffectApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/ParticleEffectView.swift b/ParticleAnimationEffect/ParticleAnimationEffect/ParticleEffectView.swift new file mode 100644 index 0000000..9035789 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/ParticleEffectView.swift @@ -0,0 +1,68 @@ +// +// ParticleEffectView.swift +// ParticleAnimationEffect +// +// Created by Liu Chuan on 2020/11/09. +// + +import SwiftUI + +/// 粒子效果视图 +struct ParticleEffectView: ViewModifier { + + /// 个数 + let count: Int + /// 持续时间 + let duration: Double = 2.0 + /// time + @State var time: Double = 0.0 + + func body(content: Content) -> some View { + + let animation = Animation.linear(duration: duration).repeatForever(autoreverses: false) + + return ZStack { + // 根据个数循环创建粒子 + ForEach (0.. ProjectionTransform { + let dx = v0 * time * cos(alpha) + let dy = v0 * sin(alpha) * time - 0.5 * g * time * time + let affineTransform = CGAffineTransform(translationX: CGFloat(dx), y: CGFloat(-dy)) + return ProjectionTransform(affineTransform) + } +} diff --git a/ParticleAnimationEffect/ParticleAnimationEffect/Preview Content/Preview Assets.xcassets/Contents.json b/ParticleAnimationEffect/ParticleAnimationEffect/Preview Content/Preview Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/ParticleAnimationEffect/ParticleAnimationEffect/Preview Content/Preview Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}