{"id":3206,"date":"2023-06-08T20:59:53","date_gmt":"2023-06-09T00:59:53","guid":{"rendered":"https:\/\/michaelrowe01.com\/?p=3206"},"modified":"2023-06-08T20:59:55","modified_gmt":"2023-06-09T00:59:55","slug":"explore-swiftui-animation","status":"publish","type":"post","link":"https:\/\/michaelrowe01.com\/index.php\/blog\/explore-swiftui-animation\/","title":{"rendered":"Explore SwiftUI Animation"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"660\" height=\"371\" data-attachment-id=\"3207\" data-permalink=\"https:\/\/michaelrowe01.com\/index.php\/blog\/explore-swiftui-animation\/attachment\/%ef%a3%bfwwdc23-24\/\" data-orig-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?fit=1920%2C1080&amp;ssl=1\" data-orig-size=\"1920,1080\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"\uf8ffWWDC23-24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?fit=660%2C371&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?resize=660%2C371&#038;ssl=1\" alt=\"\" class=\"wp-image-3207\" srcset=\"https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?resize=1024%2C576&amp;ssl=1 1024w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?resize=300%2C169&amp;ssl=1 300w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?resize=768%2C432&amp;ssl=1 768w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?resize=1536%2C864&amp;ssl=1 1536w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?w=1920&amp;ssl=1 1920w, https:\/\/i0.wp.com\/michaelrowe01.com\/wp-content\/uploads\/2023\/06\/%EF%A3%BFWWDC23-24.png?w=1320&amp;ssl=1 1320w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Overview of animation capabilities (to be honest, a lot of this was over my head, and probably explains why my apps don\u2019t have a lot of animation).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Anatomy of an update<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SwiftUI tracker view\u2019s dependencies &#8211; if anything&nbsp; changes the view is invalid and the close of the body will call another body to redraw the view.<\/li>\n\n\n\n<li>If you add an animation, the body is called with new values, including a animatable attribute. If that attribute changes, then it makes a copy and interpolates to transition from old value to new value. It will then update off the main thread for built in animations, which is very efficient&nbsp; and doesn\u2019t call your view code.<\/li>\n\n\n\n<li>There are two aspects &#8211; Animatable attributes and Animations that describes how it changes over time.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Animatable<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You must conform to Vector Arithmetic to allow you to process a list of points in the animation<\/li>\n\n\n\n<li>ScaleEffect let\u2019s you to independently define 4 different vectors so animation.&nbsp; It is public type so you can look at it if you want to learn how to create your own animatable views.<\/li>\n\n\n\n<li>Really good demo of the actual updates along the timeline of the animation<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Animation<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can customize withAnimation by passing in a specific animation, there are three basic categories &#8211; Timing Curve, Spring, and Higher Order animations (which modify a base animation)<\/li>\n\n\n\n<li>Apple recommends using Spring animations &#8211; and it is the default (.smooth) if you use withAnimation { }<\/li>\n\n\n\n<li>New category &#8211; \u201cCustom\u201d animations.\u00a0 Animate, shouldMerge and Velocity are the three requirements to create a custom animation\n<ul class=\"wp-block-list\">\n<li>All three of these are vectors&nbsp; only Animate is required<\/li>\n\n\n\n<li>ShouldMerge allows you to handle if a user interrupts your executing animation<\/li>\n\n\n\n<li>Velocity allows velocity to be preserved when a running animation&nbsp; is combined with a new one<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Transaction<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This is a family of APIs, Transaction is a dictionary to propagate all the context for the current update<\/li>\n\n\n\n<li>This section of the talk explains what the actual transaction dictionary is used across the attribute graph<\/li>\n\n\n\n<li>This behavior enables APIs to control an animation, use a view modifier like .transaction { \/\/action in there }\n<ul class=\"wp-block-list\">\n<li>Be careful with overriding &#8211; you should just .animation(.bouncy, value: selected) instead to remove accidental animation<\/li>\n\n\n\n<li>There is a new version of .animation(.smooth) this will scope it only to that modifier.&nbsp; So you can have it only react to the .smooth animation , this will reduce the likelihood of accidental animation.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>You can now update the Transaction Dictionary via an extension for use in Custom Animations, with your own TransactionKey&nbsp;<\/li>\n\n\n\n<li>There are two new variants of the transaction modifier to make it even more unlikely to have accidental animation<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Overview of animation capabilities (to be honest, a lot of this was over my head, and probably explains why my apps don\u2019t have a lot of animation). Anatomy of an update Animatable Animation Transaction<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_wp_convertkit_post_meta":{"form":"-1","landing_page":"0","tag":"0","restrict_content":"0"},"hide_page_title":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[2,3],"tags":[721,109,720,680],"class_list":["post-3206","post","type-post","status-publish","format-standard","hentry","category-blog","category-personal-softwareandit","tag-animation","tag-day-4","tag-switfui","tag-wwdc23"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2aMa8-PI","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/comments?post=3206"}],"version-history":[{"count":1,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3206\/revisions"}],"predecessor-version":[{"id":3208,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/posts\/3206\/revisions\/3208"}],"wp:attachment":[{"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/media?parent=3206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/categories?post=3206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelrowe01.com\/index.php\/wp-json\/wp\/v2\/tags?post=3206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}