diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.pbxproj b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.pbxproj new file mode 100644 index 0000000..b0c33da --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.pbxproj @@ -0,0 +1,346 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + D884F60D28C3689D00B00540 /* Challenge_3_Fire_AnimationApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F5FD28C3689B00B00540 /* Challenge_3_Fire_AnimationApp.swift */; }; + D884F61128C3689D00B00540 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D884F5FF28C3689C00B00540 /* Assets.xcassets */; }; + D884F61C28C3690C00B00540 /* FireAnimationColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F61B28C3690C00B00540 /* FireAnimationColor.swift */; }; + D884F61F28C3692700B00540 /* FireShape.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F61E28C3692700B00540 /* FireShape.swift */; }; + D884F62228C3695600B00540 /* FireAnimationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F62128C3695600B00540 /* FireAnimationView.swift */; }; + D884F62528C3697700B00540 /* FireView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F62428C3697700B00540 /* FireView.swift */; }; + D884F62828C36B6A00B00540 /* MeasureSizeModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D884F62728C36B6A00B00540 /* MeasureSizeModifier.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + D884F5FD28C3689B00B00540 /* Challenge_3_Fire_AnimationApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Challenge_3_Fire_AnimationApp.swift; sourceTree = ""; }; + D884F5FF28C3689C00B00540 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + D884F60428C3689D00B00540 /* Challenge-3_Fire-Animation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Challenge-3_Fire-Animation.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + D884F61B28C3690C00B00540 /* FireAnimationColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireAnimationColor.swift; sourceTree = ""; }; + D884F61E28C3692700B00540 /* FireShape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireShape.swift; sourceTree = ""; }; + D884F62128C3695600B00540 /* FireAnimationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireAnimationView.swift; sourceTree = ""; }; + D884F62428C3697700B00540 /* FireView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireView.swift; sourceTree = ""; }; + D884F62728C36B6A00B00540 /* MeasureSizeModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasureSizeModifier.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + D884F60128C3689D00B00540 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + D884F5F728C3689B00B00540 = { + isa = PBXGroup; + children = ( + D884F5FC28C3689B00B00540 /* Shared */, + D884F60528C3689D00B00540 /* Products */, + ); + sourceTree = ""; + }; + D884F5FC28C3689B00B00540 /* Shared */ = { + isa = PBXGroup; + children = ( + D884F5FD28C3689B00B00540 /* Challenge_3_Fire_AnimationApp.swift */, + D884F62428C3697700B00540 /* FireView.swift */, + D884F62128C3695600B00540 /* FireAnimationView.swift */, + D884F61E28C3692700B00540 /* FireShape.swift */, + D884F61B28C3690C00B00540 /* FireAnimationColor.swift */, + D884F62728C36B6A00B00540 /* MeasureSizeModifier.swift */, + D884F5FF28C3689C00B00540 /* Assets.xcassets */, + ); + path = Shared; + sourceTree = ""; + }; + D884F60528C3689D00B00540 /* Products */ = { + isa = PBXGroup; + children = ( + D884F60428C3689D00B00540 /* Challenge-3_Fire-Animation.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + D884F60328C3689D00B00540 /* Challenge-3_Fire-Animation (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = D884F61528C3689D00B00540 /* Build configuration list for PBXNativeTarget "Challenge-3_Fire-Animation (iOS)" */; + buildPhases = ( + D884F60028C3689D00B00540 /* Sources */, + D884F60128C3689D00B00540 /* Frameworks */, + D884F60228C3689D00B00540 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Challenge-3_Fire-Animation (iOS)"; + productName = "Challenge-3_Fire-Animation (iOS)"; + productReference = D884F60428C3689D00B00540 /* Challenge-3_Fire-Animation.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D884F5F828C3689B00B00540 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1340; + LastUpgradeCheck = 1340; + TargetAttributes = { + D884F60328C3689D00B00540 = { + CreatedOnToolsVersion = 13.4.1; + }; + }; + }; + buildConfigurationList = D884F5FB28C3689B00B00540 /* Build configuration list for PBXProject "Challenge-3_Fire-Animation" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = D884F5F728C3689B00B00540; + productRefGroup = D884F60528C3689D00B00540 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + D884F60328C3689D00B00540 /* Challenge-3_Fire-Animation (iOS) */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D884F60228C3689D00B00540 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D884F61128C3689D00B00540 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + D884F60028C3689D00B00540 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D884F62528C3697700B00540 /* FireView.swift in Sources */, + D884F62228C3695600B00540 /* FireAnimationView.swift in Sources */, + D884F62828C36B6A00B00540 /* MeasureSizeModifier.swift in Sources */, + D884F61F28C3692700B00540 /* FireShape.swift in Sources */, + D884F61C28C3690C00B00540 /* FireAnimationColor.swift in Sources */, + D884F60D28C3689D00B00540 /* Challenge_3_Fire_AnimationApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + D884F61328C3689D00B00540 /* 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++17"; + 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; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + D884F61428C3689D00B00540 /* 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++17"; + 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; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + D884F61628C3689D00B00540 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = N43PPTQ65U; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Challenge-3-Fire-Animation.Challenge-3-Fire-Animation"; + PRODUCT_NAME = "Challenge-3_Fire-Animation"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + D884F61728C3689D00B00540 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = N43PPTQ65U; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.5; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "Challenge-3-Fire-Animation.Challenge-3-Fire-Animation"; + PRODUCT_NAME = "Challenge-3_Fire-Animation"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + D884F5FB28C3689B00B00540 /* Build configuration list for PBXProject "Challenge-3_Fire-Animation" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D884F61328C3689D00B00540 /* Debug */, + D884F61428C3689D00B00540 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D884F61528C3689D00B00540 /* Build configuration list for PBXNativeTarget "Challenge-3_Fire-Animation (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D884F61628C3689D00B00540 /* Debug */, + D884F61728C3689D00B00540 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D884F5F828C3689B00B00540 /* Project object */; +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Challenge-3_Fire-Animation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Demo_video.mp4 b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Demo_video.mp4 new file mode 100644 index 0000000..e15b81f Binary files /dev/null and b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Demo_video.mp4 differ diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..c136eaf --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,148 @@ +{ + "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" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/Contents.json b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Challenge_3_Fire_AnimationApp.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Challenge_3_Fire_AnimationApp.swift new file mode 100644 index 0000000..da3b04e --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/Challenge_3_Fire_AnimationApp.swift @@ -0,0 +1,18 @@ +// +// Challenge_3_Fire_AnimationApp.swift +// Shared +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +@main +struct Challenge_3_Fire_AnimationApp: App { + var body: some Scene { + WindowGroup { + FireView() + .background(FireAnimationColor.background.actualColor) + } + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationColor.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationColor.swift new file mode 100644 index 0000000..aaf2212 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationColor.swift @@ -0,0 +1,26 @@ +// +// FireAnimationColor.swift +// Challenge-3_Fire-Animation +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +enum FireAnimationColor { + + case background, primary, secondary, tertiary + + var actualColor: Color { + switch self { + case .background: + return Color(red: 179/255, green: 216/255, blue: 255/255) + case .primary: + return Color(red: 255/255, green: 204/255, blue: 0/255) + case .secondary: + return Color(red: 254/255, green: 148/255, blue: 0/255) + case .tertiary: + return Color(red: 233/255, green: 169/255, blue: 79/255) + } + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationView.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationView.swift new file mode 100644 index 0000000..72a6a3a --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireAnimationView.swift @@ -0,0 +1,62 @@ +// +// FireAnimationView.swift +// Challenge-3_Fire-Animation +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +struct FireAnimationView: View { + + var viewSize: CGSize + @State var spikePositionX: CGFloat = 0 + @State var spikePositionY: CGFloat = 0 + + let fireColor: FireAnimationColor + let fireDynamicConstant: CGFloat + let fireWidth: CGFloat + let fireHeight: CGFloat + let fireOffsetX: CGFloat + + let timer = Timer.publish(every: 0.15, on: .main, in: .common).autoconnect() + + internal init(viewSize: CGSize, + fireColor: FireAnimationColor, + fireDynamicConstant: CGFloat, + fireWidth: CGFloat, + fireHeight: CGFloat, + fireOffsetX: CGFloat = 0) { + + self.viewSize = viewSize + self.fireColor = fireColor + self.fireDynamicConstant = fireDynamicConstant + self.fireWidth = fireWidth + self.fireHeight = fireHeight + self.fireOffsetX = fireOffsetX + } + + var body: some View { + FireShape(width: fireWidth, + spikePositionX: spikePositionX, + spikePositionY: spikePositionY, + fireSpikeRadius: fireWidth * 0.03) + .fill(fireColor.actualColor) + .onReceive(timer) { _ in + withAnimation(.spring()) { + updateView() + } + } + } + + private func updateView() { + let limitX = Int(fireWidth/2 * fireDynamicConstant) + let randomX = Int.random(in: -limitX/2...limitX/2) * 2 + + let limitY = Int(fireHeight * fireDynamicConstant) + let randomY = Int.random(in: 0...limitY) * 2 + + spikePositionX = fireOffsetX + CGFloat(randomX) + spikePositionY = fireHeight + CGFloat(randomY) + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireShape.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireShape.swift new file mode 100644 index 0000000..82b7dd7 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireShape.swift @@ -0,0 +1,65 @@ +// +// FireShape.swift +// Challenge-3_Fire-Animation +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +struct FireShape: Shape { + + let width: CGFloat + var spikePositionX: CGFloat + var spikePositionY: CGFloat + var fireSpikeRadius: CGFloat + + var animatableData: AnimatablePair { + get { AnimatablePair(spikePositionX, spikePositionY) } + set { + spikePositionX = newValue.first + spikePositionY = newValue.second + } + } + + func path(in rect: CGRect) -> Path { + var path = Path() + + let offset: CGFloat = rect.height/15 + + let firstPoint = CGPoint( + x: rect.midX, + y: rect.midY + offset + ) + + let secondPoint = CGPoint( + x: rect.midX + spikePositionX, + y: rect.midY - spikePositionY + offset + ) + + let thirdPoint = CGPoint( + x: rect.midX + width/2, + y: rect.midY + offset + ) + + path.addArc(center: firstPoint, radius: width/2, + startAngle: Angle(degrees: 0), + endAngle: Angle(degrees: 180), + clockwise: false) + + path.addCurve(to: CGPoint(x: secondPoint.x, y: secondPoint.y), + control1: CGPoint(x: secondPoint.x - fireSpikeRadius, + y: secondPoint.y), + control2: CGPoint(x: secondPoint.x - fireSpikeRadius, + y: secondPoint.y)) + + path.addCurve(to: CGPoint(x: thirdPoint.x, y: thirdPoint.y), + control1: CGPoint(x: secondPoint.x + fireSpikeRadius, + y: secondPoint.y), + control2: CGPoint(x: secondPoint.x + fireSpikeRadius, + y: secondPoint.y)) + + + return path + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireView.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireView.swift new file mode 100644 index 0000000..f2d41a7 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/FireView.swift @@ -0,0 +1,98 @@ +// +// FireView.swift +// Challenge-3_Fire-Animation +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +struct FireView: View { + + @State var showMiniFire: Bool = false + @State var fireShapeRotation: Angle = Angle() + @State var measuredViewSize: CGSize = CGSize() + + let fireShapeRotationTimer = Timer.publish(every: 0.5, on: .main, in: .common).autoconnect() + var frame: CGSize? + var fireSizeConstant: CGFloat { + if let frame = frame { + return frame.width > frame.height ? frame.height/2 : frame.width/2 + } else { + return measuredViewSize.width > measuredViewSize.height ? measuredViewSize.height/2 : measuredViewSize.width/2 + } + } + + internal init(frame: CGSize? = nil) { + self.frame = frame + } + + var body: some View { + if let frame = frame { + fire.frame(width: frame.width, height: frame.height) + } else { + fire.measureSize($measuredViewSize) + } + } + + private var fire: some View { + ZStack { + firstFireLayer + miniFire + secondFireLayer + thirdFireLayer + } + } + + private var firstFireLayer: some View { + FireAnimationView(viewSize: frame ?? measuredViewSize, + fireColor: .tertiary, + fireDynamicConstant: 0.1, + fireWidth: fireSizeConstant, + fireHeight: fireSizeConstant/1.8, + fireOffsetX: -fireSizeConstant/3.5) + } + + private var miniFire: some View { + FireShape(width: fireSizeConstant/8, + spikePositionX: 0, + spikePositionY: fireSizeConstant/8, + fireSpikeRadius: fireSizeConstant/40) + .fill(FireAnimationColor.secondary.actualColor) + .rotationEffect(fireShapeRotation) + .offset(x: -fireSizeConstant/6, y: showMiniFire ? -fireSizeConstant/1.1 : fireSizeConstant/5) + .opacity(showMiniFire ? 0.1 : 1) + .foregroundColor(.red) + .animation(.easeIn(duration: 0.5).repeatForever(autoreverses: false), value: showMiniFire) + .task { + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + showMiniFire.toggle() + } + } + .onReceive(fireShapeRotationTimer) { _ in + fireShapeRotation = Angle(degrees: Double(Int.random(in: -2...2)*5)) + } + } + + private var secondFireLayer: some View { + FireAnimationView(viewSize: frame ?? measuredViewSize, + fireColor: .secondary, + fireDynamicConstant: 0.15, + fireWidth: fireSizeConstant, + fireHeight: fireSizeConstant/1.5) + } + + private var thirdFireLayer: some View { + FireAnimationView(viewSize: frame ?? measuredViewSize, + fireColor: .primary, + fireDynamicConstant: 0.15, + fireWidth: fireSizeConstant/2, + fireHeight: fireSizeConstant/4) + } +} + +struct FireView_Previews: PreviewProvider { + static var previews: some View { + FireView() + } +} diff --git a/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/MeasureSizeModifier.swift b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/MeasureSizeModifier.swift new file mode 100644 index 0000000..5a26979 --- /dev/null +++ b/PRIMOZ_CUVAN-Challenge-3_Fire-Animation/Shared/MeasureSizeModifier.swift @@ -0,0 +1,30 @@ +// +// MeasureSizeModifier.swift +// Challenge-3_Fire-Animation +// +// Created by Primoz Cuvan on 03.09.22. +// + +import SwiftUI + +struct MeasureSizeModifier: ViewModifier { + + @Binding var size: CGSize + + public func body(content: Content) -> some View { + content + .background { + GeometryReader { reader in + Color.clear.onAppear { + size = reader.size + } + } + } + } +} + +extension View { + func measureSize(_ size: Binding) -> some View { + self.modifier(MeasureSizeModifier(size: size)) + } +}