├── .github ├── AnimatedMeshGradient.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── astemireleev.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── AnimatedMeshGradient ├── AnimatedMeshGradientApp.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── MeshGradientView.swift └── Preview Content │ └── Preview Assets.xcassets │ └── Contents.json ├── Assets └── demo.gif └── README.md /.github: -------------------------------------------------------------------------------- 1 | ## OS X Finder 2 | .DS_Store 3 | 4 | ## Build generated 5 | build/ 6 | DerivedData 7 | 8 | ## Various settings 9 | *.pbxuser 10 | !default.pbxuser 11 | *.mode1v3 12 | !default.mode1v3 13 | *.mode2v3 14 | !default.mode2v3 15 | *.perspectivev3 16 | !default.perspectivev3 17 | xcuserdata 18 | 19 | ## Other 20 | *.xccheckout 21 | *.moved-aside 22 | *.xcuserstate 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | 29 | # Swift Package Manager 30 | .build/ 31 | 32 | # Carthage 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /AnimatedMeshGradient.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 60; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A91563CC2C188216004D7747 /* AnimatedMeshGradientApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A91563CB2C188216004D7747 /* AnimatedMeshGradientApp.swift */; }; 11 | A91563CE2C188216004D7747 /* MeshGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A91563CD2C188216004D7747 /* MeshGradientView.swift */; }; 12 | A91563D02C188217004D7747 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A91563CF2C188217004D7747 /* Assets.xcassets */; }; 13 | A91563D32C188217004D7747 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A91563D22C188217004D7747 /* Preview Assets.xcassets */; }; 14 | A91563DB2C188821004D7747 /* demo.gif in Resources */ = {isa = PBXBuildFile; fileRef = A91563D92C188821004D7747 /* demo.gif */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | A91563C82C188216004D7747 /* AnimatedMeshGradient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AnimatedMeshGradient.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | A91563CB2C188216004D7747 /* AnimatedMeshGradientApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimatedMeshGradientApp.swift; sourceTree = ""; }; 20 | A91563CD2C188216004D7747 /* MeshGradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshGradientView.swift; sourceTree = ""; }; 21 | A91563CF2C188217004D7747 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | A91563D22C188217004D7747 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 23 | A91563D92C188821004D7747 /* demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = demo.gif; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | A91563C52C188216004D7747 /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | A91563BF2C188216004D7747 = { 38 | isa = PBXGroup; 39 | children = ( 40 | A91563DA2C188821004D7747 /* Assets */, 41 | A91563CA2C188216004D7747 /* AnimatedMeshGradient */, 42 | A91563C92C188216004D7747 /* Products */, 43 | ); 44 | sourceTree = ""; 45 | }; 46 | A91563C92C188216004D7747 /* Products */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | A91563C82C188216004D7747 /* AnimatedMeshGradient.app */, 50 | ); 51 | name = Products; 52 | sourceTree = ""; 53 | }; 54 | A91563CA2C188216004D7747 /* AnimatedMeshGradient */ = { 55 | isa = PBXGroup; 56 | children = ( 57 | A91563CB2C188216004D7747 /* AnimatedMeshGradientApp.swift */, 58 | A91563CD2C188216004D7747 /* MeshGradientView.swift */, 59 | A91563CF2C188217004D7747 /* Assets.xcassets */, 60 | A91563D12C188217004D7747 /* Preview Content */, 61 | ); 62 | path = AnimatedMeshGradient; 63 | sourceTree = ""; 64 | }; 65 | A91563D12C188217004D7747 /* Preview Content */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | A91563D22C188217004D7747 /* Preview Assets.xcassets */, 69 | ); 70 | path = "Preview Content"; 71 | sourceTree = ""; 72 | }; 73 | A91563DA2C188821004D7747 /* Assets */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | A91563D92C188821004D7747 /* demo.gif */, 77 | ); 78 | path = Assets; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | A91563C72C188216004D7747 /* AnimatedMeshGradient */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = A91563D62C188217004D7747 /* Build configuration list for PBXNativeTarget "AnimatedMeshGradient" */; 87 | buildPhases = ( 88 | A91563C42C188216004D7747 /* Sources */, 89 | A91563C52C188216004D7747 /* Frameworks */, 90 | A91563C62C188216004D7747 /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = AnimatedMeshGradient; 97 | productName = AnimatedMeshGradient; 98 | productReference = A91563C82C188216004D7747 /* AnimatedMeshGradient.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | A91563C02C188216004D7747 /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | BuildIndependentTargetsInParallel = 1; 108 | LastSwiftUpdateCheck = 1600; 109 | LastUpgradeCheck = 1600; 110 | TargetAttributes = { 111 | A91563C72C188216004D7747 = { 112 | CreatedOnToolsVersion = 16.0; 113 | }; 114 | }; 115 | }; 116 | buildConfigurationList = A91563C32C188216004D7747 /* Build configuration list for PBXProject "AnimatedMeshGradient" */; 117 | compatibilityVersion = "Xcode 15.0"; 118 | developmentRegion = en; 119 | hasScannedForEncodings = 0; 120 | knownRegions = ( 121 | en, 122 | Base, 123 | ); 124 | mainGroup = A91563BF2C188216004D7747; 125 | productRefGroup = A91563C92C188216004D7747 /* Products */; 126 | projectDirPath = ""; 127 | projectRoot = ""; 128 | targets = ( 129 | A91563C72C188216004D7747 /* AnimatedMeshGradient */, 130 | ); 131 | }; 132 | /* End PBXProject section */ 133 | 134 | /* Begin PBXResourcesBuildPhase section */ 135 | A91563C62C188216004D7747 /* Resources */ = { 136 | isa = PBXResourcesBuildPhase; 137 | buildActionMask = 2147483647; 138 | files = ( 139 | A91563D32C188217004D7747 /* Preview Assets.xcassets in Resources */, 140 | A91563DB2C188821004D7747 /* demo.gif in Resources */, 141 | A91563D02C188217004D7747 /* Assets.xcassets in Resources */, 142 | ); 143 | runOnlyForDeploymentPostprocessing = 0; 144 | }; 145 | /* End PBXResourcesBuildPhase section */ 146 | 147 | /* Begin PBXSourcesBuildPhase section */ 148 | A91563C42C188216004D7747 /* Sources */ = { 149 | isa = PBXSourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | A91563CE2C188216004D7747 /* MeshGradientView.swift in Sources */, 153 | A91563CC2C188216004D7747 /* AnimatedMeshGradientApp.swift in Sources */, 154 | ); 155 | runOnlyForDeploymentPostprocessing = 0; 156 | }; 157 | /* End PBXSourcesBuildPhase section */ 158 | 159 | /* Begin XCBuildConfiguration section */ 160 | A91563D42C188217004D7747 /* Debug */ = { 161 | isa = XCBuildConfiguration; 162 | buildSettings = { 163 | ALWAYS_SEARCH_USER_PATHS = NO; 164 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 165 | CLANG_ANALYZER_NONNULL = YES; 166 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 167 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 168 | CLANG_ENABLE_MODULES = YES; 169 | CLANG_ENABLE_OBJC_ARC = YES; 170 | CLANG_ENABLE_OBJC_WEAK = YES; 171 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 172 | CLANG_WARN_BOOL_CONVERSION = YES; 173 | CLANG_WARN_COMMA = YES; 174 | CLANG_WARN_CONSTANT_CONVERSION = YES; 175 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 176 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 177 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 178 | CLANG_WARN_EMPTY_BODY = YES; 179 | CLANG_WARN_ENUM_CONVERSION = YES; 180 | CLANG_WARN_INFINITE_RECURSION = YES; 181 | CLANG_WARN_INT_CONVERSION = YES; 182 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 183 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 184 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 185 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 186 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 187 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 188 | CLANG_WARN_STRICT_PROTOTYPES = YES; 189 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 190 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 191 | CLANG_WARN_UNREACHABLE_CODE = YES; 192 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 193 | COPY_PHASE_STRIP = NO; 194 | DEBUG_INFORMATION_FORMAT = dwarf; 195 | ENABLE_STRICT_OBJC_MSGSEND = YES; 196 | ENABLE_TESTABILITY = YES; 197 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 198 | GCC_C_LANGUAGE_STANDARD = gnu17; 199 | GCC_DYNAMIC_NO_PIC = NO; 200 | GCC_NO_COMMON_BLOCKS = YES; 201 | GCC_OPTIMIZATION_LEVEL = 0; 202 | GCC_PREPROCESSOR_DEFINITIONS = ( 203 | "DEBUG=1", 204 | "$(inherited)", 205 | ); 206 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 207 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 208 | GCC_WARN_UNDECLARED_SELECTOR = YES; 209 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 210 | GCC_WARN_UNUSED_FUNCTION = YES; 211 | GCC_WARN_UNUSED_VARIABLE = YES; 212 | IPHONEOS_DEPLOYMENT_TARGET = 18.0; 213 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 214 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 215 | MTL_FAST_MATH = YES; 216 | ONLY_ACTIVE_ARCH = YES; 217 | SDKROOT = iphoneos; 218 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 219 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 220 | }; 221 | name = Debug; 222 | }; 223 | A91563D52C188217004D7747 /* Release */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | ALWAYS_SEARCH_USER_PATHS = NO; 227 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 228 | CLANG_ANALYZER_NONNULL = YES; 229 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 231 | CLANG_ENABLE_MODULES = YES; 232 | CLANG_ENABLE_OBJC_ARC = YES; 233 | CLANG_ENABLE_OBJC_WEAK = YES; 234 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 235 | CLANG_WARN_BOOL_CONVERSION = YES; 236 | CLANG_WARN_COMMA = YES; 237 | CLANG_WARN_CONSTANT_CONVERSION = YES; 238 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 239 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 240 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INFINITE_RECURSION = YES; 244 | CLANG_WARN_INT_CONVERSION = YES; 245 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 246 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 247 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 249 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 250 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 251 | CLANG_WARN_STRICT_PROTOTYPES = YES; 252 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 253 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | COPY_PHASE_STRIP = NO; 257 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 258 | ENABLE_NS_ASSERTIONS = NO; 259 | ENABLE_STRICT_OBJC_MSGSEND = YES; 260 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu17; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 18.0; 270 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 271 | MTL_ENABLE_DEBUG_INFO = NO; 272 | MTL_FAST_MATH = YES; 273 | SDKROOT = iphoneos; 274 | SWIFT_COMPILATION_MODE = wholemodule; 275 | VALIDATE_PRODUCT = YES; 276 | }; 277 | name = Release; 278 | }; 279 | A91563D72C188217004D7747 /* Debug */ = { 280 | isa = XCBuildConfiguration; 281 | buildSettings = { 282 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 283 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 284 | CODE_SIGN_STYLE = Automatic; 285 | CURRENT_PROJECT_VERSION = 1; 286 | DEVELOPMENT_ASSET_PATHS = "\"AnimatedMeshGradient/Preview Content\""; 287 | DEVELOPMENT_TEAM = T3K58FE38R; 288 | ENABLE_PREVIEWS = YES; 289 | GENERATE_INFOPLIST_FILE = YES; 290 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 291 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 292 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 293 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 294 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 295 | LD_RUNPATH_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "@executable_path/Frameworks", 298 | ); 299 | MARKETING_VERSION = 1.0; 300 | PRODUCT_BUNDLE_IDENTIFIER = eleev.dev.AnimatedMeshGradient; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | SWIFT_EMIT_LOC_STRINGS = YES; 303 | SWIFT_VERSION = 5.0; 304 | TARGETED_DEVICE_FAMILY = "1,2"; 305 | }; 306 | name = Debug; 307 | }; 308 | A91563D82C188217004D7747 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 312 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 313 | CODE_SIGN_STYLE = Automatic; 314 | CURRENT_PROJECT_VERSION = 1; 315 | DEVELOPMENT_ASSET_PATHS = "\"AnimatedMeshGradient/Preview Content\""; 316 | DEVELOPMENT_TEAM = T3K58FE38R; 317 | ENABLE_PREVIEWS = YES; 318 | GENERATE_INFOPLIST_FILE = YES; 319 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 320 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 321 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 322 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 323 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 324 | LD_RUNPATH_SEARCH_PATHS = ( 325 | "$(inherited)", 326 | "@executable_path/Frameworks", 327 | ); 328 | MARKETING_VERSION = 1.0; 329 | PRODUCT_BUNDLE_IDENTIFIER = eleev.dev.AnimatedMeshGradient; 330 | PRODUCT_NAME = "$(TARGET_NAME)"; 331 | SWIFT_EMIT_LOC_STRINGS = YES; 332 | SWIFT_VERSION = 5.0; 333 | TARGETED_DEVICE_FAMILY = "1,2"; 334 | }; 335 | name = Release; 336 | }; 337 | /* End XCBuildConfiguration section */ 338 | 339 | /* Begin XCConfigurationList section */ 340 | A91563C32C188216004D7747 /* Build configuration list for PBXProject "AnimatedMeshGradient" */ = { 341 | isa = XCConfigurationList; 342 | buildConfigurations = ( 343 | A91563D42C188217004D7747 /* Debug */, 344 | A91563D52C188217004D7747 /* Release */, 345 | ); 346 | defaultConfigurationIsVisible = 0; 347 | defaultConfigurationName = Release; 348 | }; 349 | A91563D62C188217004D7747 /* Build configuration list for PBXNativeTarget "AnimatedMeshGradient" */ = { 350 | isa = XCConfigurationList; 351 | buildConfigurations = ( 352 | A91563D72C188217004D7747 /* Debug */, 353 | A91563D82C188217004D7747 /* Release */, 354 | ); 355 | defaultConfigurationIsVisible = 0; 356 | defaultConfigurationName = Release; 357 | }; 358 | /* End XCConfigurationList section */ 359 | }; 360 | rootObject = A91563C02C188216004D7747 /* Project object */; 361 | } 362 | -------------------------------------------------------------------------------- /AnimatedMeshGradient.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AnimatedMeshGradient.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AnimatedMeshGradient.xcodeproj/xcuserdata/astemireleev.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AnimatedMeshGradient.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/AnimatedMeshGradientApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AnimatedMeshGradientApp.swift 3 | // AnimatedMeshGradient 4 | // 5 | // Created by Astemir Eleev on 6/11/24. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct AnimatedMeshGradientApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | MeshGradientView() 15 | .statusBarHidden() 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | }, 8 | { 9 | "appearances" : [ 10 | { 11 | "appearance" : "luminosity", 12 | "value" : "dark" 13 | } 14 | ], 15 | "idiom" : "universal", 16 | "platform" : "ios", 17 | "size" : "1024x1024" 18 | }, 19 | { 20 | "appearances" : [ 21 | { 22 | "appearance" : "luminosity", 23 | "value" : "tinted" 24 | } 25 | ], 26 | "idiom" : "universal", 27 | "platform" : "ios", 28 | "size" : "1024x1024" 29 | } 30 | ], 31 | "info" : { 32 | "author" : "xcode", 33 | "version" : 1 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/MeshGradientView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MeshGradientView.swift 3 | // AnimatedMeshGradient 4 | // 5 | // Created by Astemir Eleev on 6/11/24. 6 | // 7 | 8 | import SwiftUI 9 | 10 | struct MeshGradientView: View { 11 | @State var d: Float = 0.0 12 | @State var timer: Timer? 13 | 14 | var body: some View { 15 | ZStack { 16 | Color.black 17 | 18 | MeshGradient( 19 | width: 3, 20 | height: 3, 21 | points: [ 22 | [sine(in: (-0.5)...0.0, 0.2, 0.234, d, 1.0, 0.1, noiseFunction), 23 | sine(in: (-0.4)...0.0, 0.2, 0.353, d, 1.0, 0.1, noiseFunction)], 24 | [sine(in: 0.5...0.6, 0.2, 0.134, d, 1.0, 0.1, noiseFunction), 25 | sine(in: -0.5...(-0.015), 0.15, 0.523, d, 1.0, 0.1, noiseFunction)], 26 | 27 | [sine(in: 1.1...1.5, 0.2, 0.214, d, 1.0, 0.1, noiseFunction), 28 | sine(in: -0.1...0.0, 0.1, 0.053, d, 1.0, 0.1, noiseFunction)], 29 | 30 | [sine(in: -0.8...(-0.1), 1.439, 0.342, d, 1.0, 0.1, noiseFunction), 31 | sine(in: 0.3...0.7, 4.42, 0.984, d, 1.0, 0.1, noiseFunction)], 32 | 33 | [sine(in: 0.1...0.8, 0.239, 0.084, d, 1.0, 0.1, noiseFunction), 34 | sine(in: 0.2...0.8, 5.21, 0.242, d, 1.0, 0.1, noiseFunction)], 35 | 36 | [sine(in: 1.0...1.5, 0.939, 0.084, d, 1.0, 0.1, noiseFunction), 37 | sine(in: 0.4...0.8, 0.25, 0.642, d, 1.0, 0.1, noiseFunction)], 38 | 39 | [sine(in: -0.8...0.0, 1.439, 0.442, d, 1.0, 0.1, noiseFunction), 40 | sine(in: 1.4...1.9, 3.42, 0.984, d, 1.0, 0.1, noiseFunction)], 41 | 42 | [sine(in: 0.25...0.65, 0.339, 0.784, d, 1.0, 0.1, noiseFunction), 43 | sine(in: 1.1...1.2, 0.124, 0.772, d, 1.0, 0.1, noiseFunction)], 44 | 45 | [sine(in: 1.0...1.5, 0.939, 0.056, d, 1.0, 0.1, noiseFunction), 46 | sine(in: 1.3...1.7, 0.47, 0.342, d, 1.0, 0.1, noiseFunction)] 47 | ], colors: [ 48 | .black, .blue, .black, 49 | .orange, .white, .red, 50 | .yellow, .black, .pink 51 | ]) 52 | } 53 | .ignoresSafeArea() 54 | .edgesIgnoringSafeArea(.all) 55 | .onAppear { 56 | timer = Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true, block: { _ in 57 | d += 0.05 58 | }) 59 | } 60 | } 61 | 62 | private func noiseFunction(_ t: Float) -> Float { 63 | return (sin(t * 0.5) + cos(t * 0.25)) / 2 64 | } 65 | 66 | private func sine( 67 | in range: ClosedRange, 68 | _ offset: Float, 69 | _ scale: Float, 70 | _ t: Float, 71 | _ frequencyModulation: Float, 72 | _ noiseAmplitude: Float, 73 | _ noiseFunction: (Float) -> Float 74 | ) -> Float { 75 | let amplitude = (range.upperBound - range.lowerBound) / 2 76 | let midPoint = (range.upperBound + range.lowerBound) / 2 77 | 78 | // Primary sine wave 79 | let primarySine = sin(scale * t + offset) 80 | 81 | // Frequency modulation using another sine wave 82 | let modulatingSine = sin(frequencyModulation * t + offset) 83 | 84 | // Noise factor to add randomness 85 | let noiseFactor = noiseFunction(t) * noiseAmplitude 86 | 87 | // Combining primary sine, frequency modulation, and noise 88 | return midPoint + amplitude * (primarySine + modulatingSine * noiseFactor) 89 | } 90 | } 91 | 92 | #Preview { 93 | MeshGradientView() 94 | } 95 | -------------------------------------------------------------------------------- /AnimatedMeshGradient/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Assets/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleev/animated-mesh-gradient/0ea8081ed43f5819cf464b0d15309e838a2055e2/Assets/demo.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Animated Mesh Gradient [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) 2 | 3 | [![Platform](https://img.shields.io/badge/platform-iOS_18-yellow.svg)]() 4 | [![Platform](https://img.shields.io/badge/platform-iPadOS_18-darkyellow.svg)]() 5 | [![Language](https://img.shields.io/badge/language-Swift_5.10-orange.svg)]() 6 | [![Last Commit](https://img.shields.io/github/last-commit/eleev/animated-mesh-gradient)]() 7 | [![NLOC](https://img.shields.io/tokei/lines/github/eleev/animated-mesh-gradient)]() 8 | [![Contributors](https://img.shields.io/github/contributors/eleev/animated-mesh-gradient)]() 9 | [![Repo Size](https://img.shields.io/github/repo-size/eleev/animated-mesh-gradient)]() 10 | [![License](https://img.shields.io/badge/license-MIT-blue.svg)]() 11 | 12 | 13 | 14 | ### If you like the project, please give it a star ⭐ It will show the creator your appreciation and help others to discover the repo. 15 | 16 | # ✍️ About 17 | ✨ SwiftUI 6 animated mesh gradient. 18 | 19 | # 📺 Demo 20 | Please note that the `.gif` files have low frame rate due to compression and accessibility of demo. 21 | 22 | ![](Assets/demo.gif) 23 | 24 | # 👨‍💻 Author 25 | [Astemir Eleev](https://github.com/eleev) 26 | 27 | # 🔖 Licence 28 | The project is available under [MIT Licence](https://github.com/eleev/swiftui-new-metal-shaders/blob/master/LICENSE) 29 | --------------------------------------------------------------------------------