{"id":6265,"date":"2020-09-24T14:59:15","date_gmt":"2020-09-24T12:59:15","guid":{"rendered":"http:\/\/blog.bart.sk\/en\/?p=6265"},"modified":"2024-01-29T10:36:00","modified_gmt":"2024-01-29T09:36:00","slug":"bodymovin-tos-svg-animations-web","status":"publish","type":"post","link":"https:\/\/blog.bart.sk\/en\/bodymovin-tos-svg-animations-web\/","title":{"rendered":"Bodymovin or how to&#8217;s of SVG animations on your web"},"content":{"rendered":"\n<p>In today&#8217;s article, we&#8217;ll introduce a plugin for Adobe After Effects, thanks to which we can relatively quickly and easily create engaging animations and take our website to the next level.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"450\" src=\"https:\/\/blog.bart.sk\/wp-content\/uploads\/2020\/06\/02.gif\" alt=\"\" class=\"wp-image-5860\"\/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"450\" src=\"https:\/\/blog.bart.sk\/wp-content\/uploads\/2020\/06\/03.gif\" alt=\"\" class=\"wp-image-5861\"\/><\/figure><\/div>\n\n\n<p class=\"has-text-align-center\"><span style=\"font-weight: 400; font-size: 12px; color: #808080;\">Source: bart.sk<\/span><\/p>\n\n\n\n<p><strong>But first, let&#8217;s talk about the advantages and disadvantages of SVG animations.<\/strong><\/p>\n\n\n\n<p>+ Smaller file size (compared to GIF)<\/p>\n\n\n\n<p>+ Higher quality (no need to deal with the viewing on retina displays)<\/p>\n\n\n\n<p>+ An option to control the animation using JavaScript events<\/p>\n\n\n\n<p>&#8211; Cannot animate e.g. photos (lines and shapes only)<\/p>\n\n\n\n<p>This means that SVG animations are a great choice if we want to liven up our website and differentiate ourselves from the competition. However, we must understand that we can only create animations from \u2018icons\u2019 and \u2018pictograms\u2019.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to do it?<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Preparation of materials for animation<\/h4>\n\n\n\n<p>At the beginning, it&#8217;s necessary to prepare the materials so that we can work with them later. We at bart.sk use programs from Adobe, so to prepare our materials, we also chose Adobe Illustrator, which is used to draw vector graphics.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/illustrator.png\"><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"383\" src=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/illustrator.png\" alt=\"\" class=\"wp-image-5863\" srcset=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/illustrator.png 551w, https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/illustrator-300x209.png 300w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/a><\/figure><\/div>\n\n\n<p>We&#8217;ll draw an icon to animate later and save it in an &#8216;.ai&#8217; format.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Installing the plugin for After Effects<\/h3>\n\n\n\n<p>In the next step, we&#8217;ll install the aforementioned Bodymovin plugin in After Effects. The great thing is that this plugin is completely free. You can download it e.g. here: <a href=\"https:\/\/exchange.adobe.com\/creativecloud.details.12557.bodymovin.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/exchange.adobe.com\/creativecloud.details.12557.bodymovin.html<\/a><\/p>\n\n\n\n<p>After installing, this panel will be added to your After Effects.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/bodymovin-plugin.png\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"545\" src=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/bodymovin-plugin.png\" alt=\"\" class=\"wp-image-5862\" srcset=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/bodymovin-plugin.png 436w, https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/bodymovin-plugin-240x300.png 240w\" sizes=\"(max-width: 436px) 100vw, 436px\" \/><\/a><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Creating animation<\/h3>\n\n\n\n<p>Once we have the plugin installed and we also have our \u2018.ai\u2019 file ready to animate, we insert it into After Effects. In order to be able to work with it further, we will right-click on our file, e.g. illustration.ai -&gt; Create -&gt; Create Shapes from Vector Layer<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><a href=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/vector-layer.png\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"244\" src=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/vector-layer.png\" alt=\"\" class=\"wp-image-5864\" srcset=\"https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/vector-layer.png 698w, https:\/\/blog.bart.sk\/en\/wp-content\/uploads\/2020\/06\/vector-layer-300x105.png 300w\" sizes=\"(max-width: 698px) 100vw, 698px\" \/><\/a><\/figure><\/div>\n\n\n<p>Now there is nothing stopping us and we can start with the animation itself.<\/p>\n\n\n\n<p>When the animation is ready, we just mark it in the Bodymovin plugin, click on &#8220;Render&#8221; and voil\u00e0! our &#8216;.json&#8217; animation file, which we implement on the web, is ready.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Implementation to the web<\/h3>\n\n\n\n<p>Subsequently, we just implement the library to our website, either using CDNJ or directly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">script src<\/span><span style=\"font-weight: 400;\">=\"\/<\/span><span style=\"font-weight: 400;\">js\/bodymovin.js<\/span><span style=\"font-weight: 400;\">\"<\/span><span style=\"font-weight: 400;\"> type<\/span><span style=\"font-weight: 400;\">=\"<\/span><span style=\"font-weight: 400;\">text\/javascript<\/span><span style=\"font-weight: 400;\">\"&gt;&lt;\/<\/span><span style=\"font-weight: 400;\">script<\/span><span style=\"font-weight: 400;\">&gt;<\/span><br><span style=\"font-weight: 400;\">&lt;!-- OR --&gt;<\/span><br><span style=\"font-weight: 400;\">&lt;<\/span><span style=\"font-weight: 400;\">script src<\/span><span style=\"font-weight: 400;\">=\"<\/span><span style=\"font-weight: 400;\">https:\/\/cdnjs.com\/libraries\/bodymovin<\/span><span style=\"font-weight: 400;\">\"<\/span><span style=\"font-weight: 400;\"> type<\/span><span style=\"font-weight: 400;\">=\"<\/span><span style=\"font-weight: 400;\">text\/javascript<\/span><span style=\"font-weight: 400;\">\"&gt;&lt;\/<\/span><span style=\"font-weight: 400;\">script<\/span><span style=\"font-weight: 400;\">&gt;<\/span><\/pre>\n\n\n\n<p>In the last step, we load our animation using JavaScript.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span style=\"font-weight: 400;\">var<\/span><span style=\"font-weight: 400;\"> animation <\/span><span style=\"font-weight: 400;\">=<\/span><span style=\"font-weight: 400;\"> bodymovin<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">loadAnimation<\/span><span style=\"font-weight: 400;\">({<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;container<\/span><span style=\"font-weight: 400;\">:<\/span><span style=\"font-weight: 400;\"> document<\/span><span style=\"font-weight: 400;\">.<\/span><span style=\"font-weight: 400;\">getElementById<\/span><span style=\"font-weight: 400;\">(<\/span><span style=\"font-weight: 400;\">'lottie'<\/span><span style=\"font-weight: 400;\">),<\/span> <span style=\"font-weight: 400;\">\/\/ Required<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;path<\/span><span style=\"font-weight: 400;\">:<\/span> <span style=\"font-weight: 400;\">'data.json'<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\/\/ Required<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;renderer<\/span><span style=\"font-weight: 400;\">:<\/span> <span style=\"font-weight: 400;\">'svg\/canvas\/html'<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\/\/ Required<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;loop<\/span><span style=\"font-weight: 400;\">:<\/span> <span style=\"font-weight: 400;\">true<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\/\/ Optional<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;autoplay<\/span><span style=\"font-weight: 400;\">:<\/span> <span style=\"font-weight: 400;\">true<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\/\/ Optional<\/span><br><span style=\"font-weight: 400;\">&nbsp;&nbsp;name<\/span><span style=\"font-weight: 400;\">:<\/span> <span style=\"font-weight: 400;\">\"Hello World\"<\/span><span style=\"font-weight: 400;\">,<\/span> <span style=\"font-weight: 400;\">\/\/ Name for future reference. Optional.<\/span><br><span style=\"font-weight: 400;\">})<\/span><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"450\" src=\"https:\/\/blog.bart.sk\/wp-content\/uploads\/2020\/06\/01.gif\" alt=\"\" class=\"wp-image-5859\"\/><\/figure><\/div>\n\n\n<p class=\"has-text-align-center\"><span style=\"color: #808080; font-size: 12px;\">Source: bart.sk<\/span><\/p>\n\n\n\n<p><strong>References<br><\/strong>Documentation &#8211;&nbsp;<a href=\"https:\/\/airbnb.io\/lottie\/#\/web\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/airbnb.io\/lottie\/#\/web<br><\/a>Plugin &#8211;&nbsp;<a href=\"https:\/\/exchange.adobe.com\/creativecloud.details.12557.bodymovin.html\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/exchange.adobe.com\/creativecloud.details.12557.bodymovin.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"In today&#8217;s article, we&#8217;ll introduce a plugin for Adobe After Effects, thanks to which we can relatively quickly&hellip;","protected":false},"author":21,"featured_media":5861,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","csco_display_header_overlay":false,"csco_singular_sidebar":"","csco_page_header_type":""},"categories":[199],"tags":[214,215,212],"_links":{"self":[{"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/posts\/6265"}],"collection":[{"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/comments?post=6265"}],"version-history":[{"count":12,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/posts\/6265\/revisions"}],"predecessor-version":[{"id":7381,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/posts\/6265\/revisions\/7381"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/media\/5861"}],"wp:attachment":[{"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/media?parent=6265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/categories?post=6265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bart.sk\/en\/wp-json\/wp\/v2\/tags?post=6265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}