{"id":2739,"date":"2024-06-14T13:39:34","date_gmt":"2024-06-14T19:39:34","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=2739"},"modified":"2024-06-14T13:39:35","modified_gmt":"2024-06-14T19:39:35","slug":"morphing-arbitrary-paths-in-svg","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/morphing-arbitrary-paths-in-svg\/","title":{"rendered":"Morphing Arbitrary Paths in SVG"},"content":{"rendered":"\n<p>Shape morphing animations can be awfully cool. They can be artistic and elaborate like the waving cape of a brand character, or simple and understated like video player controls morphing from one state to another. <a href=\"https:\/\/minus-ze.ro\/posts\/morphing-arbitrary-paths-in-svg\/?ck_subscriber_id=2246502080\">Alexandru-Gabriel Ic\u0103 digs into doing this in <code>&lt;svg><\/code><\/a>. There is a fairly big prerequisite to these kind of animations: the shapes need the same number of points. The trick is typically to use a <code>&lt;path d=\"\"><\/code> which is capable of drawing anything, then force both shapes to have the same number of points even if you don&#8217;t need them all. Alexandru-Gabriel goes deep on this writing script to convert arbitrary paths into morphable shapes, which is the same kind of thing <a href=\"https:\/\/gsap.com\/docs\/v3\/Plugins\/MorphSVGPlugin\/\">libraries like Greensock <\/a><a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/GoYdOQ\">do<\/a>. I love the idea that you can <a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/wzrgYm\">do the morph directly in CSS<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Shape morphing animations can be awfully cool. They can be artistic and elaborate like the waving cape of a brand character, or simple and understated like video player controls morphing from one state to another. Alexandru-Gabriel Ic\u0103 digs into doing this in &lt;svg>. There is a fairly big prerequisite to these kind of animations: the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2740,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[91],"class_list":["post-2739","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-svg"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2024\/06\/Screenshot-2024-06-14-at-12.30.50%E2%80%AFPM.png?fit=1622%2C974&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2739","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=2739"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2739\/revisions"}],"predecessor-version":[{"id":2742,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/2739\/revisions\/2742"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/2740"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=2739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=2739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=2739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}