├── .gitignore ├── LICENSE.md ├── MeshTransformAnimation.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── swiftpm │ │ └── Package.resolved └── xcuserdata │ └── janum.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── MeshTransformAnimation ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── card.imageset │ │ ├── Contents.json │ │ └── card.png ├── ContentView.swift ├── Info.plist ├── MeshTransformAnimationApp.swift ├── Preview Content │ └── Preview Assets.xcassets │ │ └── Contents.json ├── Shader.metal └── card.png └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | 92 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2023 Janum Trivedi 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /MeshTransformAnimation.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 56; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F7346AB72B40A50D006B1EA7 /* Shader.metal in Sources */ = {isa = PBXBuildFile; fileRef = F7346AB62B40A50D006B1EA7 /* Shader.metal */; }; 11 | F7F5BC412B40A4C100899AA2 /* MeshTransformAnimationApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F5BC402B40A4C100899AA2 /* MeshTransformAnimationApp.swift */; }; 12 | F7F5BC432B40A4C100899AA2 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F5BC422B40A4C100899AA2 /* ContentView.swift */; }; 13 | F7F5BC452B40A4C200899AA2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7F5BC442B40A4C200899AA2 /* Assets.xcassets */; }; 14 | F7F5BC482B40A4C200899AA2 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7F5BC472B40A4C200899AA2 /* Preview Assets.xcassets */; }; 15 | F7F5BC502B40A4D800899AA2 /* Wave in Frameworks */ = {isa = PBXBuildFile; productRef = F7F5BC4F2B40A4D800899AA2 /* Wave */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | F7346AB62B40A50D006B1EA7 /* Shader.metal */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.metal; path = Shader.metal; sourceTree = ""; }; 20 | F7346AB82B40A541006B1EA7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 21 | F7F5BC3D2B40A4C100899AA2 /* MeshTransformAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MeshTransformAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F7F5BC402B40A4C100899AA2 /* MeshTransformAnimationApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshTransformAnimationApp.swift; sourceTree = ""; }; 23 | F7F5BC422B40A4C100899AA2 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 24 | F7F5BC442B40A4C200899AA2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | F7F5BC472B40A4C200899AA2 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 26 | /* End PBXFileReference section */ 27 | 28 | /* Begin PBXFrameworksBuildPhase section */ 29 | F7F5BC3A2B40A4C100899AA2 /* Frameworks */ = { 30 | isa = PBXFrameworksBuildPhase; 31 | buildActionMask = 2147483647; 32 | files = ( 33 | F7F5BC502B40A4D800899AA2 /* Wave in Frameworks */, 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | F7F5BC342B40A4C100899AA2 = { 41 | isa = PBXGroup; 42 | children = ( 43 | F7F5BC3F2B40A4C100899AA2 /* MeshTransformAnimation */, 44 | F7F5BC3E2B40A4C100899AA2 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | F7F5BC3E2B40A4C100899AA2 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | F7F5BC3D2B40A4C100899AA2 /* MeshTransformAnimation.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | F7F5BC3F2B40A4C100899AA2 /* MeshTransformAnimation */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | F7346AB82B40A541006B1EA7 /* Info.plist */, 60 | F7F5BC402B40A4C100899AA2 /* MeshTransformAnimationApp.swift */, 61 | F7F5BC422B40A4C100899AA2 /* ContentView.swift */, 62 | F7346AB62B40A50D006B1EA7 /* Shader.metal */, 63 | F7F5BC442B40A4C200899AA2 /* Assets.xcassets */, 64 | F7F5BC462B40A4C200899AA2 /* Preview Content */, 65 | ); 66 | path = MeshTransformAnimation; 67 | sourceTree = ""; 68 | }; 69 | F7F5BC462B40A4C200899AA2 /* Preview Content */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | F7F5BC472B40A4C200899AA2 /* Preview Assets.xcassets */, 73 | ); 74 | path = "Preview Content"; 75 | sourceTree = ""; 76 | }; 77 | /* End PBXGroup section */ 78 | 79 | /* Begin PBXNativeTarget section */ 80 | F7F5BC3C2B40A4C100899AA2 /* MeshTransformAnimation */ = { 81 | isa = PBXNativeTarget; 82 | buildConfigurationList = F7F5BC4B2B40A4C200899AA2 /* Build configuration list for PBXNativeTarget "MeshTransformAnimation" */; 83 | buildPhases = ( 84 | F7F5BC392B40A4C100899AA2 /* Sources */, 85 | F7F5BC3A2B40A4C100899AA2 /* Frameworks */, 86 | F7F5BC3B2B40A4C100899AA2 /* Resources */, 87 | ); 88 | buildRules = ( 89 | ); 90 | dependencies = ( 91 | ); 92 | name = MeshTransformAnimation; 93 | packageProductDependencies = ( 94 | F7F5BC4F2B40A4D800899AA2 /* Wave */, 95 | ); 96 | productName = MeshTransformAnimation; 97 | productReference = F7F5BC3D2B40A4C100899AA2 /* MeshTransformAnimation.app */; 98 | productType = "com.apple.product-type.application"; 99 | }; 100 | /* End PBXNativeTarget section */ 101 | 102 | /* Begin PBXProject section */ 103 | F7F5BC352B40A4C100899AA2 /* Project object */ = { 104 | isa = PBXProject; 105 | attributes = { 106 | BuildIndependentTargetsInParallel = 1; 107 | LastSwiftUpdateCheck = 1510; 108 | LastUpgradeCheck = 1510; 109 | TargetAttributes = { 110 | F7F5BC3C2B40A4C100899AA2 = { 111 | CreatedOnToolsVersion = 15.1; 112 | }; 113 | }; 114 | }; 115 | buildConfigurationList = F7F5BC382B40A4C100899AA2 /* Build configuration list for PBXProject "MeshTransformAnimation" */; 116 | compatibilityVersion = "Xcode 14.0"; 117 | developmentRegion = en; 118 | hasScannedForEncodings = 0; 119 | knownRegions = ( 120 | en, 121 | Base, 122 | ); 123 | mainGroup = F7F5BC342B40A4C100899AA2; 124 | packageReferences = ( 125 | F7F5BC4E2B40A4D800899AA2 /* XCRemoteSwiftPackageReference "Wave" */, 126 | ); 127 | productRefGroup = F7F5BC3E2B40A4C100899AA2 /* Products */; 128 | projectDirPath = ""; 129 | projectRoot = ""; 130 | targets = ( 131 | F7F5BC3C2B40A4C100899AA2 /* MeshTransformAnimation */, 132 | ); 133 | }; 134 | /* End PBXProject section */ 135 | 136 | /* Begin PBXResourcesBuildPhase section */ 137 | F7F5BC3B2B40A4C100899AA2 /* Resources */ = { 138 | isa = PBXResourcesBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | F7F5BC482B40A4C200899AA2 /* Preview Assets.xcassets in Resources */, 142 | F7F5BC452B40A4C200899AA2 /* Assets.xcassets in Resources */, 143 | ); 144 | runOnlyForDeploymentPostprocessing = 0; 145 | }; 146 | /* End PBXResourcesBuildPhase section */ 147 | 148 | /* Begin PBXSourcesBuildPhase section */ 149 | F7F5BC392B40A4C100899AA2 /* Sources */ = { 150 | isa = PBXSourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | F7346AB72B40A50D006B1EA7 /* Shader.metal in Sources */, 154 | F7F5BC432B40A4C100899AA2 /* ContentView.swift in Sources */, 155 | F7F5BC412B40A4C100899AA2 /* MeshTransformAnimationApp.swift in Sources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXSourcesBuildPhase section */ 160 | 161 | /* Begin XCBuildConfiguration section */ 162 | F7F5BC492B40A4C200899AA2 /* Debug */ = { 163 | isa = XCBuildConfiguration; 164 | buildSettings = { 165 | ALWAYS_SEARCH_USER_PATHS = NO; 166 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 167 | CLANG_ANALYZER_NONNULL = YES; 168 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 169 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 170 | CLANG_ENABLE_MODULES = YES; 171 | CLANG_ENABLE_OBJC_ARC = YES; 172 | CLANG_ENABLE_OBJC_WEAK = YES; 173 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 174 | CLANG_WARN_BOOL_CONVERSION = YES; 175 | CLANG_WARN_COMMA = YES; 176 | CLANG_WARN_CONSTANT_CONVERSION = YES; 177 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 178 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 179 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 180 | CLANG_WARN_EMPTY_BODY = YES; 181 | CLANG_WARN_ENUM_CONVERSION = YES; 182 | CLANG_WARN_INFINITE_RECURSION = YES; 183 | CLANG_WARN_INT_CONVERSION = YES; 184 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 185 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 186 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 187 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 188 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 189 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 190 | CLANG_WARN_STRICT_PROTOTYPES = YES; 191 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 192 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 193 | CLANG_WARN_UNREACHABLE_CODE = YES; 194 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 195 | COPY_PHASE_STRIP = NO; 196 | DEBUG_INFORMATION_FORMAT = dwarf; 197 | ENABLE_STRICT_OBJC_MSGSEND = YES; 198 | ENABLE_TESTABILITY = YES; 199 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu17; 201 | GCC_DYNAMIC_NO_PIC = NO; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | GCC_OPTIMIZATION_LEVEL = 0; 204 | GCC_PREPROCESSOR_DEFINITIONS = ( 205 | "DEBUG=1", 206 | "$(inherited)", 207 | ); 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | IPHONEOS_DEPLOYMENT_TARGET = 17.2; 215 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 216 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 217 | MTL_FAST_MATH = YES; 218 | ONLY_ACTIVE_ARCH = YES; 219 | SDKROOT = iphoneos; 220 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; 221 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 222 | }; 223 | name = Debug; 224 | }; 225 | F7F5BC4A2B40A4C200899AA2 /* Release */ = { 226 | isa = XCBuildConfiguration; 227 | buildSettings = { 228 | ALWAYS_SEARCH_USER_PATHS = NO; 229 | ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; 230 | CLANG_ANALYZER_NONNULL = YES; 231 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 232 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; 233 | CLANG_ENABLE_MODULES = YES; 234 | CLANG_ENABLE_OBJC_ARC = YES; 235 | CLANG_ENABLE_OBJC_WEAK = YES; 236 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 237 | CLANG_WARN_BOOL_CONVERSION = YES; 238 | CLANG_WARN_COMMA = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 241 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 242 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INFINITE_RECURSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 249 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 250 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 251 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 252 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 253 | CLANG_WARN_STRICT_PROTOTYPES = YES; 254 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 255 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 256 | CLANG_WARN_UNREACHABLE_CODE = YES; 257 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 258 | COPY_PHASE_STRIP = NO; 259 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 260 | ENABLE_NS_ASSERTIONS = NO; 261 | ENABLE_STRICT_OBJC_MSGSEND = YES; 262 | ENABLE_USER_SCRIPT_SANDBOXING = YES; 263 | GCC_C_LANGUAGE_STANDARD = gnu17; 264 | GCC_NO_COMMON_BLOCKS = YES; 265 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 267 | GCC_WARN_UNDECLARED_SELECTOR = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 269 | GCC_WARN_UNUSED_FUNCTION = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | IPHONEOS_DEPLOYMENT_TARGET = 17.2; 272 | LOCALIZATION_PREFERS_STRING_CATALOGS = YES; 273 | MTL_ENABLE_DEBUG_INFO = NO; 274 | MTL_FAST_MATH = YES; 275 | SDKROOT = iphoneos; 276 | SWIFT_COMPILATION_MODE = wholemodule; 277 | VALIDATE_PRODUCT = YES; 278 | }; 279 | name = Release; 280 | }; 281 | F7F5BC4C2B40A4C200899AA2 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 285 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 286 | CODE_SIGN_STYLE = Automatic; 287 | CURRENT_PROJECT_VERSION = 1; 288 | DEVELOPMENT_ASSET_PATHS = "\"MeshTransformAnimation/Preview Content\""; 289 | DEVELOPMENT_TEAM = GP8VNBM7WP; 290 | ENABLE_PREVIEWS = YES; 291 | GENERATE_INFOPLIST_FILE = YES; 292 | INFOPLIST_FILE = MeshTransformAnimation/Info.plist; 293 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 294 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 295 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 296 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 297 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 298 | IPHONEOS_DEPLOYMENT_TARGET = 17; 299 | LD_RUNPATH_SEARCH_PATHS = ( 300 | "$(inherited)", 301 | "@executable_path/Frameworks", 302 | ); 303 | MARKETING_VERSION = 1.0; 304 | PRODUCT_BUNDLE_IDENTIFIER = com.janumtrivedi.MeshTransformAnimation; 305 | PRODUCT_NAME = "$(TARGET_NAME)"; 306 | SWIFT_EMIT_LOC_STRINGS = YES; 307 | SWIFT_VERSION = 5.0; 308 | TARGETED_DEVICE_FAMILY = "1,2"; 309 | }; 310 | name = Debug; 311 | }; 312 | F7F5BC4D2B40A4C200899AA2 /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 317 | CODE_SIGN_STYLE = Automatic; 318 | CURRENT_PROJECT_VERSION = 1; 319 | DEVELOPMENT_ASSET_PATHS = "\"MeshTransformAnimation/Preview Content\""; 320 | DEVELOPMENT_TEAM = GP8VNBM7WP; 321 | ENABLE_PREVIEWS = YES; 322 | GENERATE_INFOPLIST_FILE = YES; 323 | INFOPLIST_FILE = MeshTransformAnimation/Info.plist; 324 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 325 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 326 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 327 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 328 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 329 | IPHONEOS_DEPLOYMENT_TARGET = 17; 330 | LD_RUNPATH_SEARCH_PATHS = ( 331 | "$(inherited)", 332 | "@executable_path/Frameworks", 333 | ); 334 | MARKETING_VERSION = 1.0; 335 | PRODUCT_BUNDLE_IDENTIFIER = com.janumtrivedi.MeshTransformAnimation; 336 | PRODUCT_NAME = "$(TARGET_NAME)"; 337 | SWIFT_EMIT_LOC_STRINGS = YES; 338 | SWIFT_VERSION = 5.0; 339 | TARGETED_DEVICE_FAMILY = "1,2"; 340 | }; 341 | name = Release; 342 | }; 343 | /* End XCBuildConfiguration section */ 344 | 345 | /* Begin XCConfigurationList section */ 346 | F7F5BC382B40A4C100899AA2 /* Build configuration list for PBXProject "MeshTransformAnimation" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | F7F5BC492B40A4C200899AA2 /* Debug */, 350 | F7F5BC4A2B40A4C200899AA2 /* Release */, 351 | ); 352 | defaultConfigurationIsVisible = 0; 353 | defaultConfigurationName = Release; 354 | }; 355 | F7F5BC4B2B40A4C200899AA2 /* Build configuration list for PBXNativeTarget "MeshTransformAnimation" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | F7F5BC4C2B40A4C200899AA2 /* Debug */, 359 | F7F5BC4D2B40A4C200899AA2 /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | /* End XCConfigurationList section */ 365 | 366 | /* Begin XCRemoteSwiftPackageReference section */ 367 | F7F5BC4E2B40A4D800899AA2 /* XCRemoteSwiftPackageReference "Wave" */ = { 368 | isa = XCRemoteSwiftPackageReference; 369 | repositoryURL = "https://github.com/jtrivedi/Wave"; 370 | requirement = { 371 | kind = upToNextMajorVersion; 372 | minimumVersion = 0.3.2; 373 | }; 374 | }; 375 | /* End XCRemoteSwiftPackageReference section */ 376 | 377 | /* Begin XCSwiftPackageProductDependency section */ 378 | F7F5BC4F2B40A4D800899AA2 /* Wave */ = { 379 | isa = XCSwiftPackageProductDependency; 380 | package = F7F5BC4E2B40A4D800899AA2 /* XCRemoteSwiftPackageReference "Wave" */; 381 | productName = Wave; 382 | }; 383 | /* End XCSwiftPackageProductDependency section */ 384 | }; 385 | rootObject = F7F5BC352B40A4C100899AA2 /* Project object */; 386 | } 387 | -------------------------------------------------------------------------------- /MeshTransformAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MeshTransformAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MeshTransformAnimation.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved: -------------------------------------------------------------------------------- 1 | { 2 | "pins" : [ 3 | { 4 | "identity" : "wave", 5 | "kind" : "remoteSourceControl", 6 | "location" : "https://github.com/jtrivedi/Wave", 7 | "state" : { 8 | "revision" : "d95ce41fa52c42d9790388e9086c892930e9e48b", 9 | "version" : "0.3.2" 10 | } 11 | } 12 | ], 13 | "version" : 2 14 | } 15 | -------------------------------------------------------------------------------- /MeshTransformAnimation.xcodeproj/xcuserdata/janum.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | MeshTransformAnimation.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MeshTransformAnimation/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 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "platform" : "ios", 6 | "size" : "1024x1024" 7 | } 8 | ], 9 | "info" : { 10 | "author" : "xcode", 11 | "version" : 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Assets.xcassets/card.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "card.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Assets.xcassets/card.imageset/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtrivedi/Mesh-Transform-Animation/73f1cb87e546ee0074bb8b160248a4dce2e6935d/MeshTransformAnimation/Assets.xcassets/card.imageset/card.png -------------------------------------------------------------------------------- /MeshTransformAnimation/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // MeshTransformAnimation 4 | // 5 | // Created by Janum Trivedi on 12/30/23. 6 | // 7 | 8 | import SwiftUI 9 | import Wave 10 | 11 | struct ContentView: View { 12 | 13 | @State var progress: CGFloat = 0 14 | 15 | let progressAnimator = SpringAnimator( 16 | spring: .init(dampingRatio: 0.75, response: 0.8), 17 | value: 0, 18 | target: 1 19 | ) 20 | 21 | var blurRadius: CGFloat { 22 | mapRange(progressAnimator.value ?? 0, 0, 1, 0, 8) 23 | } 24 | 25 | func shader() -> Shader { 26 | Shader(function: .init(library: .default, name: "distortion"), arguments: [ 27 | .boundingRect, 28 | .float(progress) 29 | ]) 30 | } 31 | 32 | var body: some View { 33 | ZStack { 34 | backgroundBlue 35 | 36 | Image("card") 37 | .resizable() 38 | .aspectRatio(contentMode: .fit) 39 | .clipShape(RoundedRectangle(cornerRadius: 28, style: /*@START_MENU_TOKEN@*/.continuous/*@END_MENU_TOKEN@*/)) 40 | .shadow(color: shadowBlue.opacity(0.15), radius: 12, y: 8) 41 | .padding(24) 42 | .distortionEffect(shader(), maxSampleOffset: CGSize(width: 100, height: 200)) 43 | .blur(radius: blurRadius) 44 | 45 | } 46 | .ignoresSafeArea(.all) 47 | .onTapGesture { 48 | guard let target = progressAnimator.target else { return } 49 | 50 | progressAnimator.target = (target == 0) ? 1 : 0 51 | progressAnimator.start() 52 | } 53 | .onAppear { 54 | progressAnimator.valueChanged = { value in 55 | self.progress = value 56 | } 57 | progressAnimator.start() 58 | } 59 | } 60 | 61 | var shadowBlue: Color { 62 | Color(hue: 0.635, saturation: 0.674, brightness: 0.614, opacity: 1.0) 63 | } 64 | 65 | var backgroundBlue: Color { 66 | Color(hue: 0.63, saturation: 0.071, brightness: 0.94, opacity: 1.0) 67 | } 68 | } 69 | 70 | #Preview { 71 | ContentView() 72 | } 73 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /MeshTransformAnimation/MeshTransformAnimationApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MeshTransformAnimationApp.swift 3 | // MeshTransformAnimation 4 | // 5 | // Created by Janum Trivedi on 12/30/23. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct MeshTransformAnimationApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /MeshTransformAnimation/Shader.metal: -------------------------------------------------------------------------------- 1 | // 2 | // Shader.metal 3 | // MeshTransformAnimation 4 | // 5 | // Created by Janum Trivedi on 12/30/23. 6 | // 7 | 8 | #include 9 | #include 10 | 11 | using namespace metal; 12 | 13 | /* 14 | Linearly interpolates `value` from its original range `(inMin, inMax)` to a new range `(outMin, outMax)` 15 | ex. mapRange(0.5, 0, 1, 10, 20) = 15 16 | */ 17 | float mapRange(float value, float inMin, float inMax, float outMin, float outMax) { 18 | return ((value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin); 19 | } 20 | 21 | [[ stitchable ]] float2 distortion(float2 position, float4 bounds, float progress) { 22 | float2 size = float2(bounds[2], bounds[3]); 23 | 24 | // Normalize the current pixel position to a [0, 1] range. 25 | float2 p = position / size; 26 | 27 | // Pixels that are further away from the horizontal center should compress more. 28 | // The last two values `-1.0` and `1.0` control the amount of compression. 29 | float xOffset = mapRange(p.x - 0.5, -0.5, 0.5, -1.0, 1.0); 30 | 31 | // Adjust the horizontal compression based on the pixel's y-coordinate. 32 | // This creates the asymmetric "squeeze" effect. 33 | xOffset *= (1.0 - p.y); 34 | 35 | // `xOffset` is normalized from [0, 1], so multiply it by the view's width to convert back to screen coordinates. 36 | float xOffsetDenormalized = xOffset * size.x; 37 | 38 | // Move card up and down based on the animation's `progress`. 39 | // When progress is 0, `yOffsetDenorm` is 0. When progress = 1, the translation is slightly larger than the screen's height. 40 | float yOffsetDenorm = size.y * 1.3 * progress; 41 | 42 | // De-normalize back to screen coordinates again. 43 | xOffsetDenormalized *= progress; 44 | 45 | // Return our adjusted coordinate for this pixel. 46 | return float2(position.x + xOffsetDenormalized, position.y + yOffsetDenorm); 47 | } 48 | -------------------------------------------------------------------------------- /MeshTransformAnimation/card.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jtrivedi/Mesh-Transform-Animation/73f1cb87e546ee0074bb8b160248a4dce2e6935d/MeshTransformAnimation/card.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mesh Transform Animation 2 | 3 | This is a simplified reproduction of the Dynamic Island mesh transform animation, written in Swift/SwiftUI and Metal. 4 | 5 | --------------------------------------------------------------------------------