{"id":7359,"date":"2021-08-03T17:38:11","date_gmt":"2021-08-03T14:38:11","guid":{"rendered":"https:\/\/flatlogic.com\/blog\/?p=7359"},"modified":"2022-04-13T18:23:38","modified_gmt":"2022-04-13T15:23:38","slug":"spicing-up-the-ui-a-guide-for-approaching-css-animations","status":"publish","type":"post","link":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/","title":{"rendered":"Spicing Up the UI: a Guide for Approaching CSS Animations"},"content":{"rendered":"<p>I guess every front-end developer had that moment in their career when work on a website was already at the finish line, but the website looked like it lacked some life. Users weren&#8217;t able to interact with the design, and the only plan for making it more dynamic was to turn the cursor into a pointer via <em>cursor: pointer<\/em> to indicate links and buttons.<\/p><p>Today, a high-quality user interface is not complete if it lacks interactivity and smooth motion &#8211; especially with the number of instruments available to <a href=\"https:\/\/youteam.io\/blog\/top-10-places-to-find-and-hire-freelance-developers\/\">web developers<\/a>.<\/p><p>Here, we&#8217;ll discuss different approaches to creating animations on the web and spicing up the UI.<\/p><h2 class=\"wp-block-heading\" id=\"one\">Basic principles of animation<\/h2><p>First, let&#8217;s cover why animations are so important.<\/p><p>Every day we interact with objects and observe objects&#8217; reactions to those interactions. If you throw a ball from some height, its speed will be continuously increasing right until it hits the ground. After that, it will bounce a few times, and every jump will be shorter than the previous one, right until the ball finally stops.<\/p><p>These are the laws of physics. We are used to observing objects&#8217; responses, and having objects provide us with some sort of response is an approach common for modern design. E.g., you can hear a shutter sound on your mobile phone when you take a new photo. It&#8217;s designed this way because users like products that work similarly to what they&#8217;re used to. Users like it when it&#8217;s predictable how a product reacts.<\/p><p>Let&#8217;s go through four main principles of animation:<\/p><p><strong>Suitability<\/strong>. Animations must suit the context of the website. Animations must work either as responses to users&#8217; actions or as a silent background that doesn&#8217;t draw too much attention. The website should never &#8220;scream&#8221; with animations.<\/p><p><strong>Stability<\/strong>. Animations must compliment the UI, not break it. No content should be jumping or falling apart when the animation starts.<\/p><p><strong>Unity<\/strong>. Pay attention to the timing and smoothness of animations. Timing of the animations of basic UI elements must be synchronized (buttons, links, etc.). It&#8217;s common sense to separate <em>timing<\/em> parameters and <em>easing <\/em>in stand-alone variables.<\/p><p><strong>Usability<\/strong>. It&#8217;s not enough for elements to only move smoothly. Usability also matters. An animation too long will most probably interrupt the user experience rather than make it more pleasant. <a href=\"https:\/\/flatlogic.com\/generator\"><img decoding=\"async\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding.png\" alt=\"Professional Vibe Coding\" class=\"banner-img lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 2560px; --smush-placeholder-aspect-ratio: 2560\/640;\" data-srcset=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding.png 2560w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-600x150.png 600w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-1024x256.png 1024w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-768x192.png 768w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-1536x384.png 1536w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-2048x512.png 2048w\" data-sizes=\"auto\" data-original-sizes=\"(max-width: 2560px) 100vw, 2560px\"> <\/a><\/p><p>Just think of animations as of a drummer in a band: nobody pays attention to a drummer until they fail.<\/p><h2 class=\"wp-block-heading\" id=\"two\">CSS-animations<\/h2><p>The easiest way to make the website feel more cheery is to use <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/transition\">transition<\/a> or <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/animation\">animation<\/a> properties in CSS. <strong>Transition<\/strong> is used for making the animation smooth, but it&#8217;s not a function that makes an object animated. The animation starts when the property changes. E.g., you can write <em>transition: color 0.3s<\/em> and <em>change color<\/em> <em>on : hover<\/em>.<\/p><p>On the contrary to <strong>transition<\/strong>, the <strong>animation <\/strong>function launches the animation immediately. Most of the time, I use <strong>transition<\/strong> since animations should respond to users&#8217; actions. <strong>Animation <\/strong>function can be used to animate the background.<\/p><p>Without animations, the UI isn&#8217;t attractive. You may have an excellent website, but when it feels &#8220;cold&#8221; and doesn&#8217;t respond to the user&#8217;s actions, it feels unfinished or broken. For example, the menu below begs for <strong>transition<\/strong>:<\/p><figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"256\" height=\"360\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image3_pPrUYpx-1.gif\" alt=\"\" class=\"wp-image-7370 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 256px; --smush-placeholder-aspect-ratio: 256\/360;\" \/><\/figure><p>What if you add a bit of smoothness?<\/p><figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"292\" height=\"360\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image10_kgAZ7ie.gif\" alt=\"\" class=\"wp-image-7371 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 292px; --smush-placeholder-aspect-ratio: 292\/360;\" \/><\/figure><p>Keep in mind that we didn&#8217;t change how the menu acts when we hover over a link or move between lists. We only added a <strong>transition <\/strong>to some actions. It looks much better now, right?<\/p><p>Still, something is still missing. When you move between lists, all elements are animated in the same way, which doesn&#8217;t serve a native experience. Just remember what happens when the train starts moving or when cars start driving on the green light &#8211; they all start their motion with an inevitable delay.<\/p><p>Let&#8217;s apply this principle to animation. Consider the element a user clicks on to be &#8220;leading&#8221;, and others &#8220;to follow&#8221;. Technically, we&#8217;re adding +1 to the sibling elements&#8217; index <strong>(i) <\/strong>and apply <strong>transition-delay <\/strong>to each element <strong>i * 0.1s<\/strong>. The further the element is from the &#8220;leading&#8221; element, the more significant the animation delay.<\/p><p>Such an approach has the name of a stagger animation effect. You can check <a href=\"https:\/\/css-tricks.com\/staggering-animations\">a good article<\/a> about it.<br><\/p><p><img decoding=\"async\" width=\"292\" height=\"360\" data-src=\"https:\/\/lh3.googleusercontent.com\/fQBZOYU6XzkoRpkhECTcJcboMthPdZydZLqSZvXQjjo1tiEU9UUUM707mpnsex0JfHOxej4GLF-DK9cTHC9srVm7fXWqrKN5tRqpyl-3czyQuFHr3xCSZs8OWVyN-Vju7rNRo_ah\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 292px; --smush-placeholder-aspect-ratio: 292\/360;\"><\/p><p>You can find more animation samples on the website called <a href=\"https:\/\/www.hotel-spider.com\/en\">Hotel spider<\/a>.<\/p><p>In CSS, you can set <strong>transition-delay<\/strong> depending on the element&#8217;s position on the list:<\/p><pre class=\"wp-block-code\"><code>.selector:nth-child(1) { transition-delay: 0.1s;}.selector:nth-child(2) { transition-delay: 0.2s;}.selector:nth-child(3) { transition-delay: 0.3s;}<\/code><\/pre><p>With preprocessors, you can use loops to generate required styles:<\/p><pre class=\"wp-block-code\"><code>@for $i from 1 through 10 { &amp;:nth-child(#{$i}) { transition-delay: #{$i\/10}s; }}<\/code><\/pre><h2 class=\"wp-block-heading\" id=\"three\">Speed of the website<\/h2><p>When we speak of the website performance, the first thing that comes to mind is the page loading speed, and points websites receive at Google&#8217;s <a href=\"https:\/\/developers.google.com\/speed\/pagespeed\/insights\/\">PageSpeed Insights<\/a>. However, besides those numbers, you should also think of user experience.<\/p><p>When there is a freeze, e.g., when a user sends data from the contact form to the server or switches between pages, you could show them an animation. It would distract their attention, so a user doesn&#8217;t notice that loading takes too much time.<\/p><figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"419\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image13-1024x419.gif\" alt=\"\" class=\"wp-image-7374 lazyload\" data-srcset=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image13-1024x419.gif 1024w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image13-600x246.gif 600w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/image13-768x314.gif 768w\" data-sizes=\"auto\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1024px; --smush-placeholder-aspect-ratio: 1024\/419;\" data-original-sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><p>If you are writing in plain HTML (no <a href=\"https:\/\/flatlogic.com\/templates\/react\">React<\/a> or <a href=\"https:\/\/flatlogic.com\/templates\/angular\">Angular<\/a>), I recommend using the <a href=\"https:\/\/barba.js.org\/\">barba.js<\/a> library for organizing smooth transitions between pages. It allows creating navigation similar to one in Single Page Applications.<\/p><h2 class=\"wp-block-heading\" id=\"four\">FPS: How it works<\/h2><p>Any animation is the transition of an object from one state to another.<\/p><p>To change from 0 to 1 in a specific time <em>t<\/em>, we split the process into iterations, and 0 changes in certain intervals until it becomes 1. Animating from 0 to 1 is the basics for building anything.<\/p><p><img decoding=\"async\" width=\"624\" height=\"64\" data-src=\"https:\/\/lh3.googleusercontent.com\/vmR5NZB7iOSZ_PWatFoSZuW9pHPg4BG3EhnaNLOirQU39AkQtzM_tWr9i0XzJGuLtXJ2CDTB1ssb_dipEFPf3AFIxnaGOELVPNxBEiekbgHVF4RfompOXkDi8UTUkiM6DuB7wEmj\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/64;\"><\/p><p>If you learn to animate from 0 to 1, you&#8217;ll be able to calculate the position of any element using the interpolation formula.<\/p><p><img decoding=\"async\" width=\"624\" height=\"271\" data-src=\"https:\/\/lh6.googleusercontent.com\/Rh6ANCzOb58qchqtQeGtrqE2-oT9j7E7pKYaDKeMy-qNueeMKjrqXMKd45KvzK7fLwOzr7xqaiJiJAKm5RiUO4rovPnIennokvNfxHYXdqMYldKKxMnmCAlrAHCMeyHlIqATVkXf\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/271;\"><\/p><p>This is the formula of linear interpolation. In our case, when an <strong>x <\/strong>changes from 0 to 1, <strong>y <\/strong>will change linearly from <strong>a<\/strong> to <strong>b<\/strong>.<\/p><h2 class=\"wp-block-heading\" id=\"five\">60 FPS<\/h2><p>In a browser, animation speed is calculated according to 60 FPS (frames per second). Why 60 but not 30 or 24?<\/p><p><strong>24 FPS <\/strong>is the TV standard. In general, our brain needs only 10-12 FPS to start treating separate frames as an animation. When the cinema was born, silent movies were shot with time frames from 12 to 40 FPS. Back then, it was easy to manage the scenes&#8217; swiftness by increasing or decreasing the FPS.<\/p><p>The 24 FPS standard appears when movies get sound and you have to sync video and audio. While the \u00b15% is hard to notice when it comes to video, such a difference is critical when we speak about sound. 24 <a href=\"https:\/\/www.slrlounge.com\/how-24fps-became-the-standard-8-times-you-should-not-use-it\/\">became a standard<\/a> because it is the smallest number that can be divided by 2, 3, 4, 6, and 8 at the same time.<\/p><p>This has significantly simplified the video editing process. When a video plays at a speed of 24 FPS, you may notice that complicated and fast scenes blur. Such an effect is called <strong>motion blur. <\/strong>The only way to get rid of it is to increase the frame rate.<\/p><p><strong>30 FPS <\/strong>is used in the game industry to create complicated scenes and without the blur effect. Additional six frames allowed to solve the blur issue, plus didn&#8217;t overload the hardware, and the number 30 was selected randomly. In the USA, <a href=\"https:\/\/ec.europa.eu\/health\/scientific_committees\/opinions_layman\/en\/electromagnetic-fields\/glossary\/abc\/alternating-current.htm#:~:text=Current%20flowing%20in%20power%20lines,frequency%20of%2050%20Hz.).\">the AC frequency is 60 Hz<\/a>, and most TV screens and monitors can update the picture 60 times per second. Basically, if you draw every second frame, you get 30 FPS. Even in modern games, you choose between 60 FPS but a worse picture and 30 FPS but better quality.<\/p><p><strong>60 FPS <\/strong>provides a very high-quality motion effect and helps to avoid blur. Today, it&#8217;s standard for animations.<\/p><p>There are higher rates, like 120 FPS, but they are made for specific cases and require particular hardware (at least a monitor supporting such FPS). Mostly it&#8217;s professional gamers who demand high FPS &#8211; they can feel the difference as they&#8217;re playing very dynamic games. For an average user, 60 FPS is more than enough.<\/p><p>You can read more about the frame rate <a href=\"https:\/\/www.techsmith.com\/blog\/frame-rate-beginners-guide\/\">here<\/a>. You can compare pictures with different frame rates <a href=\"https:\/\/frames-per-second.appspot.com\/\">here<\/a>.<\/p><p>In animation for browsers, we use 60 FPS. So one frame takes about 16 ms. You have to agree, that&#8217;s not much. That is why it&#8217;s important not to overdo your animations. When the browser doesn&#8217;t have enough time to calculate 16 ms, the next frame gets skipped, not delayed. The browser will decrease the frame rate, which will affect the quality of the picture.<\/p><h2 class=\"wp-block-heading\" id=\"six\">FPS. Debugging<\/h2><p>You can check the current frame rate in Google Chrome using Chrome DevTools.&nbsp;<\/p><p>One way is to open DevTools and launch the Command Menu (Windows: Ctrl + Shift + P; Mac: Cmd + Shift + P). Then type <em>FPS<\/em> into the search and select <em>Show frames per second (FPS) meter<\/em>.<\/p><p><img decoding=\"async\" width=\"624\" height=\"236\" data-src=\"https:\/\/lh5.googleusercontent.com\/kDmwaumVLH5QkEkz6cmywkigCbm8KdDOry_7ZGEJsQ6Txm7LI4sIGRqX-u3Gwby7NwZZKGhjYwfbq0p_VdrHGcb_Z1yfd1ab8rbn7SspIcJeTyR9N82UvnakWn1h4lC7gPmoomOm\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/236;\"><\/p><p>To hide the FPS meter, press <em>Hide frames per second (FPS) meter<\/em>.<\/p><figure class=\"wp-block-image\"><img decoding=\"async\" data-src=\"https:\/\/lh6.googleusercontent.com\/TaCBdAC4Jms6aTzfMQGuoFsR3HRmVyNkMXMjzpkWL9fe-gRoCU5E-7R5lmpyAT1hBpGUgSFaUeNsTdcyZraKdZEKVqvINrbcwppCNCTC7V4j9C1X71m-e-pHneA3s5JneCk5-iyB\" alt=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/figure><p>Another way is to open the Rendering tab and select <em>Frame Rendering Stats<\/em>:<\/p><figure class=\"wp-block-image\"><img decoding=\"async\" data-src=\"https:\/\/lh6.googleusercontent.com\/PVqgonnoRqoFeqiOBpAb07IAANIuyECjTLKqRmMtFRrJEhosQHWg1ekT1k8jyFFQwhMxOZK_joWllVPgQcgCifVlSHbA1mlSkc8qKUFya647rDBJIzEGtuug5pihjJkWq5dlBNNN\" alt=\"\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" \/><\/figure><p>In the previous version of Google Chrome, the FPS meter was showing the current real frame rate.<\/p><p><img decoding=\"async\" width=\"555\" height=\"573\" data-src=\"https:\/\/lh3.googleusercontent.com\/9RmCxQGCd_enqCQnq-REmSFc8T4jzOJTct2kCbvnHHOeEra5KGMDONxbttIamrnRZoI0N87xR2COwqXo2VsCAIbY7Ht4ZEPbuDF3k3enleuu0N6qk4ipzztz7EOUVSrDncFxYRNO\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 555px; --smush-placeholder-aspect-ratio: 555\/573;\"><\/p><p>After the update, you can find <a href=\"https:\/\/twitter.com\/addyosmani\/status\/1281483292026400768\">more detailed stats<\/a>:<\/p><p><img decoding=\"async\" width=\"624\" height=\"369\" data-src=\"https:\/\/lh4.googleusercontent.com\/gIaaMKR0TNULmTFBQCSmoXPAddf0m1akJWwsIjjCSNqAywJgRtwJZid1gO8nQe0ZpCrZbW9jbA4MgSTT72ooQjroFEA7R99zxROi7zVLTVR3085_stqI925L4Wg9hF8Jn3qCeShI\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/369;\"><\/p><p>The percentage of frames rendered on time (16 ms per frame) informs how well the website performs &#8211; the higher the number, the better.&nbsp;<\/p><p>In my work, I use the <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/fps-extension\/gdkkmimldhefhmmmlalioafomdlahcog\">FPS extension<\/a> built by Yuri Artyukh every day. It allows you to check if the website functions fast enough. I only use Chrome&#8217;s functionality when I find a problem, and I need to debug and see where exactly FPS drops.<\/p><p><img decoding=\"async\" width=\"601\" height=\"237\" data-src=\"https:\/\/lh5.googleusercontent.com\/bipl5X7tODcs9FsPVIlbuFsLTnso99602w7R0XCM42kAEyvjUOAAyI8Rt3BupdYdSkPVuZSZl_CS4DuH4jGuMNYGZm7ZRsjA8-zB2M1JwGT7t6zZlbxhPfJV8GT4lVirDUV8JUVH\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 601px; --smush-placeholder-aspect-ratio: 601\/237;\"><\/p><p>You can find out how CSS animations perform in the <em>animations<\/em> folder. Here you&#8217;ll find timings, delays, and easing curves. You can edit all of that and relaunch animations with corrected values to select the best version.<\/p><p><img decoding=\"async\" width=\"624\" height=\"336\" data-src=\"https:\/\/lh6.googleusercontent.com\/hxSZMJFyRNBrGM1PEa4Bf354Dm2fGgmRsNWfpoy8wjENZ-zNzl80BKVxY_zskM2wWE75DmNfvY5pcEK49oJseXeZGWS3vxLsu1H5duqp8zAuOikwKxe9SMmv61HPR8Rh0juE1Hqr\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/336;\"><\/p><h2 class=\"wp-block-heading\" id=\"seven\">Regarding rendering in browser<\/h2><p>If you read the documentation on <strong>transition<\/strong>, you&#8217;ll see that you can animate all countable properties. So you can animate via <strong>opacity<\/strong> from 0 to 1, but you can&#8217;t do <strong>display: none<\/strong> to <strong>display: block<\/strong>. It&#8217;s technically impossible to split transition values into frames in <strong>display<\/strong>.<\/p><p>By the way, if you need to hide an element and make it unclickable, do <strong>visibility: hidden <\/strong>and delay the animation. You can find a detailed description of the trick in <a href=\"https:\/\/css-tricks.com\/snippets\/css\/toggle-visibility-when-hiding-elements\/\">this article<\/a>. I&#8217;ll be pleased if this helps you to fix an issue with the modal window or burger menu opening\/closing.<\/p><p>Let&#8217;s get back to numbers. In CSS, there are plenty of countable properties. When animated, some move smoothly while others &#8220;jump&#8221;.<\/p><p><img decoding=\"async\" data-src=\"https:\/\/lh6.googleusercontent.com\/32Erg5xCy74pWAadPq53VCvYY9x7DjkMJWN3bRxnOVXJnPk2OapBp8z9HjQ3N9n0UKeyViV1dDRqKLL5LAye02i-T0aAfcsXA7lfsYdNGC9SBkQNFtA3jn7n6RW1sCt-CrjZpXWN\" width=\"402\" height=\"322\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 402px; --smush-placeholder-aspect-ratio: 402\/322;\"><\/p><p>To understand what properties can be animated almost without any additional resources, let&#8217;s try to understand how rendering in a browser works, and what exactly happens when we change styles.<\/p><ul class=\"wp-block-list\"><li><strong>Calculate styles<\/strong> does what it says, and here we use CSS.<\/li><li><strong>Flow<\/strong> is about building the page structure and calculating elements and margin sizes &#8211; for each element to take its designated place on the page.<\/li><li><strong>Paint <\/strong>is about page visualization. There is a rendering of fonts and images, and text or background colors and shadows apply to the content.<\/li><li><strong>Composite layout<\/strong> is about elements being drawn layer by layer in the correct order. It&#8217;s easy to notice when one element overlaps with another, and you need to place them in the right order with the help of z-index. When rendered using <em>transform<\/em> or <em>opacity<\/em>, elements are published to a different layer, and it helps to visually transform them. At the same time, they stick to their order, and it also helps to control opacity.<\/li><\/ul><p>You can read more about this in <a href=\"https:\/\/developers.google.com\/web\/fundamentals\/performance\/rendering\">the article on visualization optimization<\/a> from Google.<\/p><p>Our task is to shorten the number of steps after styles re-calculation. When we change the style, the browser identifies whether it needs to recalculate the position of elements, <strong>repaint <\/strong>colors, or only work with the element within its <strong>composite layout<\/strong>.&nbsp;<\/p><p>A perfectly done animation requires only one step &#8211; the <strong>composite layout<\/strong>. That&#8217;s where <strong>transform<\/strong> and <strong>opacity <\/strong>help. When you use those two, your animations will be smooth and pleasant.<\/p><p>When people learn that it&#8217;s not recommended to animate anything that causes reflow of size and margins, they immediately ask, &#8220;How do I change those then?&#8221;. There were only one or two moments when I had to animate something that caused a reflow in my whole career. <em>Transform <\/em>and <em>opacity <\/em>cover<em> <\/em>99,9% of all needs. Of course, sometimes you may also want to animate colors but it will come more expensive than <em>transform<\/em> and <em>opacity<\/em>.<\/p><p>There is also an optimization trick. Instead of animating the <em>background-color<\/em> feature using <em>transparent<\/em>, we can add a fake element :<em>: before<\/em> with the required font color and animate its opacity.<\/p><pre class=\"wp-block-code\"><code>\/* bad *\/.selector { background-color: transparent; transition: background-color 0.3s;}.selector:hover { background-color: red;}\/* good *\/.selector::before { background-color: red; opacity: 0; transition: opacity 0.3s;}.selector:hover::before { opacity: 1;}<\/code><\/pre><p>The main job is not to cause <strong>reflow<\/strong>. You may read a detailed explanation of how changing the attribute<strong> <\/strong>influences processes in browsers <a href=\"https:\/\/csstriggers.com\/\">here<\/a> on the CSS Triggers website.<\/p><p>However, not only CSS changes can trigger reflow. Beware when using DOM methods through <a  data-ilj-link-preview=\"true\"  data-featured-image=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2019\/09\/top-articles-copy-600x450.png\"  data-excerpt=\"Here is our list of JS articles of 2019. We collected 17 posts with tricks and tips in JavaScript and its frameworks.\" href=\"https:\/\/flatlogic.com\/blog\/17-articles-of-september-2019-to-learn-javascript\/\">JavaScript<\/a><strong>.<\/strong> E.g., estimating the window width or the current position of the scroll has the same effect. If you&#8217;re applying &#8220;expensive&#8221; methods for rendering each animation frame, it will be hard to stick to 60 FPS.<\/p><p>You can read more on what methods have a terrible influence on performance <a href=\"https:\/\/gist.github.com\/paulirish\/5d52fb081b3570c81e3a\">here<\/a>.<\/p><p>The most common approach here is animating during the scroll &#8211; when the content of a page is hidden until the user scrolls down to the section they need, and the content loads. Back in the day, you had to estimate the page&#8217;s scroll, window size, and the distance from the beginning of the document to the required element &#8211; all to understand if the element gets into the current viewport. All the methods that caused reflow were up and running as soon as a user started scrolling down the page.<\/p><p>The system overload is quite significant. The modern browsers&#8217; APIs now include the&nbsp;<\/p><p><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Intersection_Observer_API\">Intersection Observer<\/a><strong>. <\/strong>It helps to define whether the element is contained within the viewport and sends the callback each time the element is in or out of visibility. Since the browser&#8217;s native API is involved, the performance is better than the manual calculation of the element&#8217;s position during the scroll. There is<a href=\"https:\/\/css-tricks.com\/an-explanation-of-how-the-intersection-observer-watches\"> a good article covering this topic on CSS Tricks<\/a>.<\/p><h2 class=\"wp-block-heading\" id=\"eight\">Acceleration<\/h2><p>For an element&#8217;s animation, browsers define its coordinates on the page and how it interacts with other elements. When we animate using properties that cause reflow, browsers must recalculate the element within the whole page&#8217;s limits. This process costs a lot for the browser, especially if we&#8217;re talking about heavy pages rendering many elements.<\/p><p>The cheapest way to deal with the issue is to transfer the element into a separate layer and recalculate its coordinates. That is actually how <em>transform<\/em> or <em>opacity<\/em> animations work. A browser creates a separate layer with the required element and a layer with the page without this element. Then, it recalculates the coordinates of a single element (the one we&#8217;re animating) within the limits of the layer. Then layers are sent to the GPU for rendering.<\/p><p>Today, you can see how a page splits into layers and how each is animated inside a browser. In Chrome, you can find it by opening the <strong>Layers <\/strong>tab.<\/p><p><strong><img decoding=\"async\" width=\"624\" height=\"240\" data-src=\"https:\/\/lh6.googleusercontent.com\/xn-IengEsmOZKLJH8Lzas-FTbJoCkiITYg4SL1oYxg3A1B7qhC6vfNSpCvtx5riLUFbjz0ioyZaQL_R5UVyyzlFYOj4aMOmNRO07IZY7ZD_GiIQBdFtnIFy3-JGJza1WKeEWmmsM\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/240;\"><\/strong><\/p><p>You can even see your page in 3D there.<\/p><p><img decoding=\"async\" width=\"624\" height=\"231\" data-src=\"https:\/\/lh5.googleusercontent.com\/lrgIbWJOzPfyYw2ZXCTtJNMO6_zjHLAT6J4HwIARDCy8BhS6bhpNOKFk6qzaBPMR1eTeHld3uTw6_F1m4WY8NGmgamlHHyIOJUuIdf-pH10kZTUc10sjouwPsnY-SyLqnJSg7z8k\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/231;\"><\/p><p>When the browser animates using <em>transform, <\/em>FPS drops. In such a case, we can utilize the GPU to calculate each animation frame&#8217;s element&#8217;s state. The GPU&#8217;s main advantage is that GPU operates thousands of cores, all built strictly for performing mathematical operations and much more than the CPU with a few cores.<\/p><p><img decoding=\"async\" width=\"624\" height=\"401\" data-src=\"https:\/\/lh4.googleusercontent.com\/AbxtOslgMeig2bUr_aN3iMPJpk5jiRmrHxT9PiKxpiM1BErX6k6sG9FP1QCIpNaYZXMttLowvqh3ddt6DL6FOjhbsFbP9Wfm5cFApPkJf58AHa4aDXuH47Gn5k6Lmh4tP8w0cdg1\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/401;\"><\/p><p>As you remember, the animation is just math, so calculating the state of an element using GPU is a smart move.<\/p><p>There&#8217;re a few ways of making a modern browser calculate the animation using the video card:<\/p><ul class=\"wp-block-list\"><li><strong>translateZ(0), translate3D(x, y, 0)<\/strong>. In general, browsers can work with 3D animation in CSS, and it&#8217;s calculated using GPU. Currently, we don&#8217;t need 3D animation; however, we can say that the element has moved along the z-axis for 0 pixels. The browser will have to calculate the position of the element using GPU.<\/li><li><strong>will-change: transform. <\/strong>Using the will-change function in CSS, we ask our browser to optimize its resources for the animation of a particular element.<\/li><\/ul><p>Here comes a question, why don&#8217;t we just write <strong>* {will-change: transform} <\/strong>or<strong> * {transform: translateZ(0)} <\/strong>and forget about optimization issues? The thing is that the video card is a computer on its own, so the browser has to prepare the data to send it to GPU and then to review the response. So when we create many layers that we do not use, we make the browser utilize the extra resources to communicate with GPU, which harms FPS. Below, you can see an example of using * {transform: translateZ(0)}<\/p><p><img decoding=\"async\" width=\"624\" height=\"327\" data-src=\"https:\/\/lh4.googleusercontent.com\/de9G6y2QKSTHAqOKq0KNRdrpT_bmWD3NfGZ7Yv-yeO6QYaDFpUS7vW0KhRBn4JH2dJ-Xoxm0N49r3IwjlEuw1FwRJsCts1OTllEagnT7lws4GvHO1FHLwDfZ_IYMIh91mW6caV_-\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/327;\"><\/p><p>As you can see, a layer was applied over each element, so the browser got stuck each time I tried to scroll down with the layers tab open.<\/p><p>This is why you should not optimize blindly &#8211;&nbsp;you can make things even worse. An excellent example of smart optimization would be adding <em>will change: transform <\/em>using Javascript before a complicated animation launch and deleting it after the animation was rendered.<\/p><p><img decoding=\"async\" width=\"624\" height=\"347\" data-src=\"https:\/\/lh3.googleusercontent.com\/4l_yd1aOyLStS6_lwFRrxCfr69AMlHqTRHuFc4af5mQkbBXrt6xYb8ChQB055STC6yQsaW2vsRJQRqDLeGoLgdbCZFqmW9KBGiD8FOLpMMU3eeHHMzjSljCJcQtJWSV4abEsJh9T\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/347;\"><\/p><p>Here are a few good articles on animation optimization that you should read:<\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.smashingmagazine.com\/2016\/12\/gpu-animation-doing-it-right\/\">CSS GPU Animation: Doing It Right &#8211; Smashing Magazine<\/a><\/li><li><a href=\"https:\/\/www.smashingmagazine.com\/2012\/06\/play-with-hardware-accelerated-css\/\">Let&#8217;s Play With Hardware-Accelerated CSS &#8211; Smashing Magazine<\/a><\/li><li><a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/CSS\/will-change\">will-change &#8211; CSS | MDN<\/a><\/li><li><a href=\"https:\/\/css-tricks.com\/almanac\/properties\/w\/will-change\/\">will-change &#8211; CSS tricks<\/a><\/li><\/ul><h2 class=\"wp-block-heading\" id=\"nine\">3D in CSS<\/h2><p>I&#8217;ve already mentioned adding translateZ(0) or translate3d(x, y, 0) as an animation optimization hack. However, if you change from 0 to another number. Nothing will change. To turn on 3D animations in a browser, you have to add <em>perspective <\/em>to the parent element, so you&#8217;ll apply 3D animations to elements within the container and see them work.<\/p><pre class=\"wp-block-code\"><code>.box { perspective: 500px; &amp;:hover { span { transform: translateZ(200px) } }}<\/code><\/pre><p><img decoding=\"async\" width=\"328\" height=\"360\" data-src=\"https:\/\/lh3.googleusercontent.com\/2Oj5Qq0HL6BCEVeTOwQh4tQDG0xvwjTcj2bmbBUTRGOWAABsyX9-yUuBVDYHrbt846ychVTDaxrvQeW8X5QlhHpxAn3QIoaQ2GgyRoXnDi4BTZviDEpeR_3YqZ9EVIy49vLWLHnF\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 328px; --smush-placeholder-aspect-ratio: 328\/360;\"><\/p><p>Find an example on codepen <a href=\"https:\/\/codepen.io\/ivadimko\/pen\/PeaQKX\">here<\/a>.<\/p><p>In production, I used this approach for on-load animations.<\/p><p><img decoding=\"async\" width=\"480\" height=\"248\" data-src=\"https:\/\/lh3.googleusercontent.com\/qMw9zbUjd4DMv339ZjFxDhZiU5tcNd-G67NWPOQwvmFE2Mgd3SnJDqFXLiYpQq-wh-Y9PaZ8MCWePLcFSI6idiHKWVEQfd83VLcbUOZmFsNxCwLdIQ4eOONW_xef1hnGnbue8Cp0\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 480px; --smush-placeholder-aspect-ratio: 480\/248;\"><\/p><p>For those who want to understand how 3D animations work in CSS in more detail, I&#8217;m leaving a <a href=\"https:\/\/3dtransforms.desandro.com\/\">link<\/a> to a useful guide. The main idea is that you have to apply <strong>perspective <\/strong>to the parent element. Afterward, you can experiment.<\/p><h2 class=\"wp-block-heading\" id=\"ten\">Where to get inspiration from<\/h2><p>To grow towards understanding motion UI development, you have to develop your <em>vision level<\/em>. I mean that you have to expand your perspective and understand the capabilities of modern browsers. You don&#8217;t have to create all possible animations, but you have to know what&#8217;s possible. Then, the practice will help.<\/p><p>You can get inspiration from visiting dedicated websites:<\/p><ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.awwwards.com\/\">awwwards<\/a> &#8211; here dozens of new websites are published each day, and you vote for the best. You&#8217;ll be able to see implementations of various ideas. If you decide to do the reverse-engineering of the animation that you liked, you&#8217;ll be able to grow your skills fast.<\/li><li><a href=\"https:\/\/tympanus.net\/codrops\/\">codrops<\/a> &#8211; it&#8217;s a list of articles about the most creative website designs. You can find code samples and guides to creating different animations. I recommend following this website both for professional development in your job and inspiration.<\/li><li><a href=\"https:\/\/www.youtube.com\/user\/flintyara\">Yuri Artyukh&#8217;s YouTube channel<\/a> &#8211; here you can find videos covering very different front-end development and animation aspects, with detailed explanations and code samples.<\/li><\/ul><h2 class=\"wp-block-heading\" id=\"eleven\">To sum up<\/h2><p>In the end, I&#8217;d like to give you a few recommendations that will help you become a better web developer:<\/p><ul class=\"wp-block-list\"><li>Dig deeper. Always try to understand why one thing works this way and not another way. Knowing small details and utilizing that knowledge is what makes you stand out among other developers. This isn&#8217;t only about animations but also development in general.<\/li><li>Apply knowledge<strong> <\/strong>to practice. When you see some animation you like, learn how it&#8217;s been done and create your own version. When watching a live coding session, repeat after it. Knowledge is best absorbed when put into practice, not into the bookmarks folder.<\/li><li>Expand your perspective. Study different resources, check how other websites are built. To put it shortly, stay open-minded.<\/li><li>Do not blindly optimize. Follow the metrics and learn to debug the problem first.<\/li><li>Become better in Maths. You don&#8217;t have to become a Ph.D., but you have to understand geometry and trigonometry basics to understand animations better. For example, once I had a task to create pagination in a slider, where dots would spread around in a circle, and the circle was being painted (depending on the number of the slide):<\/li><\/ul><p><img decoding=\"async\" width=\"624\" height=\"665\" data-src=\"https:\/\/lh4.googleusercontent.com\/JJZNZW6CkqCrCv98i0O_usTseVsZ69v8fa48j2GIxa9eivZsEnphMQvXFv45QJqhOB4u7_j1lqMqqIaRgs2X14FWxmEtc-gGEAOcDIVhOsu_towfvWKI3KICJK6Cw6TiMJUlXiPi\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 624px; --smush-placeholder-aspect-ratio: 624\/665;\"><\/p><p>At the same time, the number of dots could change depending on the number of slides, and their coordinates had to be calculated on the go. If I didn&#8217;t know the basic formulas, e.g. a formula for finding the coordinate of a specific place in the circle, I wouldn&#8217;t have completed the task.<\/p><h2 class=\"wp-block-heading\" id=\"twelve\"><strong>Afterword<\/strong><\/h2><p>My commercial experience of front-end development began when I joined a company specializing in web animation. There, I learned and implemented many different approaches to creating a high-quality UI &#8211; from simple animations in CSS to drawing in Canvas and using a magical technology called <a href=\"https:\/\/g.co\/kgs\/RwxjM9\">WebGL<\/a>. I was actually the first person in the company to start using WebGL in production, which provided me with some sort of perks at work. Thanks to nice animations, my websites were getting into <a href=\"https:\/\/www.awwwards.com\/\">awwwards<\/a>, which was an admirable achievement for a front-end developer.<\/p><p>To help people enjoy the results of their work was my primary motivation for writing this article.<\/p><h2 class=\"wp-block-heading\">Related Articles<\/h2><ul class=\"wp-block-list\"><li><a href=\"https:\/\/flatlogic.com\/blog\/etl-extract-transform-load-best-practices-etl-process-and-lifehacks\/\">ETL (Extract, Transform, Load). Best Practices ETL Process And Lifehacks<\/a><\/li><li><a href=\"https:\/\/flatlogic.com\/blog\/using-html-and-javascript-to-manipulate-videos\/\">Using HTML And JavaScript To Manipulate Videos<\/a><\/li><li><a href=\"https:\/\/flatlogic.com\/blog\/javascript-ui-frameworks-and-libraries-for-web-development\/\">JavaScript UI Frameworks And Libraries For Web Development<\/a><\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p>With website animations sites are getting really vivid look. Dive in to check this all-encompassing guide to CSS animations.<\/p>\n","protected":false},"author":20,"featured_media":7367,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"flatlogic_tldr":"Animations should suit, stabilize, unify, and enhance usability\u00e2\u20ac\u201dnever distract.\nFavor CSS transitions reacting to user input; use staggered delays for natural motion.\nOptimize for 60 FPS (~16 ms\/frame); debug with Chrome\u00e2\u20ac\u2122s FPS tools before tuning.\nAnimate with transform and opacity; use GPU hints (will-change, translateZ) sparingly.","flatlogic_facts":[{"text":"In browsers, 60 FPS is standard for animations; one frame is about 16 ms.","source":""},{"text":"Staggered lists: set transition-delay per item as i*0.1s based on sibling index.","source":""},{"text":"Chrome DevTools shows % of frames rendered on time (16 ms) to assess performance.","source":""},{"text":"Animating transform or opacity uses compositor layers, avoiding reflow and repaint.","source":""},{"text":"translateZ(0) or will-change: transform can trigger GPU; overuse of layers can reduce FPS.","source":""}],"footnotes":""},"categories":[28],"tags":[476,265,409,79],"class_list":["post-7359","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-guides","tag-css-animations","tag-user-experience","tag-web-app-development","tag-web-development"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Spicing Up the UI: a Guide for Approaching CSS Animations - Flatlogic Blog<\/title>\n<meta name=\"description\" content=\"CSS-animations guide to upgrade your web development experience. How to animate properties, FPS calculation and many other important things.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spicing Up the UI: a Guide for Approaching CSS Animations\" \/>\n<meta property=\"og:description\" content=\"CSS-animations guide to upgrade your web development experience. How to animate properties, FPS calculation and many other important things.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/\" \/>\n<meta property=\"og:site_name\" content=\"Flatlogic Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/flatlogic\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-03T14:38:11+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-13T15:23:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/razmer-fb-i-tvittera-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2000\" \/>\n\t<meta property=\"og:image:height\" content=\"1044\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Vadim Ilchenko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/razmer-fb-i-tvittera-2.png\" \/>\n<meta name=\"twitter:creator\" content=\"@flatlogic\" \/>\n<meta name=\"twitter:site\" content=\"@flatlogic\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vadim Ilchenko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spicing Up the UI: a Guide for Approaching CSS Animations - Flatlogic Blog","description":"CSS-animations guide to upgrade your web development experience. How to animate properties, FPS calculation and many other important things.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/","og_locale":"en_US","og_type":"article","og_title":"Spicing Up the UI: a Guide for Approaching CSS Animations","og_description":"CSS-animations guide to upgrade your web development experience. How to animate properties, FPS calculation and many other important things.","og_url":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/","og_site_name":"Flatlogic Blog","article_publisher":"https:\/\/www.facebook.com\/flatlogic","article_published_time":"2021-08-03T14:38:11+00:00","article_modified_time":"2022-04-13T15:23:38+00:00","og_image":[{"width":2000,"height":1044,"url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/razmer-fb-i-tvittera-2.png","type":"image\/png"}],"author":"Vadim Ilchenko","twitter_card":"summary_large_image","twitter_image":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/razmer-fb-i-tvittera-2.png","twitter_creator":"@flatlogic","twitter_site":"@flatlogic","twitter_misc":{"Written by":"Vadim Ilchenko","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#article","isPartOf":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/"},"author":{"name":"Vadim Ilchenko","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/person\/de9eafb17e3334e75404cff4f77c4eff"},"headline":"Spicing Up the UI: a Guide for Approaching CSS Animations","datePublished":"2021-08-03T14:38:11+00:00","dateModified":"2022-04-13T15:23:38+00:00","mainEntityOfPage":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/"},"wordCount":3566,"commentCount":0,"publisher":{"@id":"https:\/\/flatlogic.com\/blog\/#organization"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#primaryimage"},"thumbnailUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/Frame-2387-1.png","keywords":["CSS Animations","User Experience","Web App Development","Web Development"],"articleSection":["Guides"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/","url":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/","name":"Spicing Up the UI: a Guide for Approaching CSS Animations - Flatlogic Blog","isPartOf":{"@id":"https:\/\/flatlogic.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#primaryimage"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#primaryimage"},"thumbnailUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/Frame-2387-1.png","datePublished":"2021-08-03T14:38:11+00:00","dateModified":"2022-04-13T15:23:38+00:00","description":"CSS-animations guide to upgrade your web development experience. How to animate properties, FPS calculation and many other important things.","breadcrumb":{"@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#primaryimage","url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/Frame-2387-1.png","contentUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/08\/Frame-2387-1.png","width":1600,"height":1200,"caption":"css animation"},{"@type":"BreadcrumbList","@id":"https:\/\/flatlogic.com\/blog\/spicing-up-the-ui-a-guide-for-approaching-css-animations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/flatlogic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Spicing Up the UI: a Guide for Approaching CSS Animations"}]},{"@type":"WebSite","@id":"https:\/\/flatlogic.com\/blog\/#website","url":"https:\/\/flatlogic.com\/blog\/","name":"Flatlogic Blog","description":"Vibe-coding, AI Agents, Professional Software Development Services, Case Studies and More","publisher":{"@id":"https:\/\/flatlogic.com\/blog\/#organization"},"alternateName":"Flatlogic Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/flatlogic.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/flatlogic.com\/blog\/#organization","name":"Flatlogic","url":"https:\/\/flatlogic.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/62ea6de0b3469aa3d6ebb528-1.png","contentUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/62ea6de0b3469aa3d6ebb528-1.png","width":970,"height":257,"caption":"Flatlogic"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/flatlogic","https:\/\/x.com\/flatlogic","https:\/\/www.instagram.com\/flatlogiccom\/","https:\/\/www.linkedin.com\/company\/flatlogic\/"]},{"@type":"Person","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/person\/de9eafb17e3334e75404cff4f77c4eff","name":"Vadim Ilchenko","description":"Highly experienced software engineer at Mate academy who keeps promoting the importance of high-quality and dynamic UI.","url":"https:\/\/flatlogic.com\/blog\/author\/vadim-ilchenko\/"}]}},"_links":{"self":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/7359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/comments?post=7359"}],"version-history":[{"count":23,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/7359\/revisions"}],"predecessor-version":[{"id":11232,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/7359\/revisions\/11232"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/media\/7367"}],"wp:attachment":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/media?parent=7359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/categories?post=7359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/tags?post=7359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}