<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[<CodeByShantanu />]]></title><description><![CDATA[<CodeByShantanu />]]></description><link>https://shantanupawar.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 31 Oct 2026 13:53:37 GMT</lastBuildDate><atom:link href="https://shantanupawar.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[From Static to Cinematic: 
The Magic of Framer Motion]]></title><description><![CDATA[If you’ve spent anytime making some applications with React, you might’ve explored your way around adding animations to your app. But were those ways…]]></description><link>https://shantanupawar.hashnode.dev/from-static-to-cinematic-the-magic-of-framer-motion</link><guid isPermaLink="true">https://shantanupawar.hashnode.dev/from-static-to-cinematic-the-magic-of-framer-motion</guid><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[React]]></category><category><![CDATA[framer-motion]]></category><category><![CDATA[UI]]></category><category><![CDATA[Developer]]></category><category><![CDATA[technology]]></category><dc:creator><![CDATA[Shantanu Pawar]]></dc:creator><pubDate>Wed, 06 Aug 2025 10:54:22 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1754478749653/55d4cc5b-082f-4343-b800-ba12a0fe1b83.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754466971398/cdf5f921-6748-402f-b156-3e6830180cb1.gif" alt class="image--center mx-auto" /></p>
<p>If you’ve spent anytime making some applications with React, you might’ve explored your way around adding animations to your app. But were those ways efficient and simple?</p>
<h1 id="heading-your-ui-deserves-better-gliding-capabilities">Your UI deserves better gliding capabilities.</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754470765057/07f66ac4-7931-4124-b3e3-9eda2d264b7b.gif" alt class="image--center mx-auto" /></p>
<p>Developing an application as a bare skeleton is as easy as it gets, but today, we are not here for the minimum viable product are we? Whenever I visit any website, the first thing I notice is the general flow of the components, to be honest, I just checkout the <em>vibe.</em></p>
<p>And the <em>vibe</em> of any application is generally determined by the feel of things as we interact with them, be it clicking or just hovering over. The components that form the whole should integrate with each other quite <strong>seamless</strong>-ly to give the users a smooth feel which is comfortable for their eyes (yeah).</p>
<p>The best way to emboss that smoothness on your canvas is to add <strong>animations</strong> which are <strong>subtle</strong> but also very <strong>significant</strong> if you look at the whole picture.</p>
<p>This is where <strong>Framer Motion</strong> comes in.</p>
<h1 id="heading-framer-motion-is-a-complete-gamechanger">Framer motion is a complete gamechanger</h1>
<p><img src="https://framerusercontent.com/images/0MHMgyzBybzn2UuLltHc7lcsOIc.png" alt class="image--center mx-auto" /></p>
<p>Framer motion (now known as <em>motion</em>) is an animation library at its core. But, it’s <strong>lightweight</strong> and <strong>blends</strong> right in with your <strong>React</strong> application.</p>
<p>With motion, you are not busy writing 287 lines of keyframes or rather stuck with weird transitions for a simple animation which doesn’t suite the <em>vibe</em>. This library will give you complete <strong>freedom</strong> over your <strong>animation</strong> choices but with the advantage of minimal code which equals less time being wasted so you can focus on <strong>getting more things done with less</strong> effort.</p>
<h1 id="heading-how-is-motion-a-gamechanger-though">how is motion a <em>gamechanger</em> though?</h1>
<p>because it simplifies your code and makes it 10x more readable and all that is inline with the component so you are not managing different files for animations.</p>
<h3 id="heading-getting-started-with-motion">Getting started with motion</h3>
<p>Using motion is simple,</p>
<ol>
<li><p>To install motion as a dependency,</p>
<pre><code class="lang-powershell"> npm install motion
</code></pre>
</li>
<li><p>Then import motion to your app,</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> { motion } <span class="hljs-keyword">from</span> <span class="hljs-string">"motion/react"</span>
</code></pre>
</li>
</ol>
<p>and you are set to use motion in your code, as easy as that!</p>
<p><strong>Example</strong> of a motion div for a button animation</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">motion.button</span>
  <span class="hljs-attr">whileHover</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">scale:</span> <span class="hljs-attr">1.1</span> }}
  <span class="hljs-attr">whileTap</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">scale:</span> <span class="hljs-attr">0.95</span> }}
/&gt;</span>
</code></pre>
<p><strong>&lt;motion.button&gt;</strong> replaces the normal tag. It behaves exactly like a regular button but now supports Framer Motion animations.</p>
<p>The <strong>whileHover</strong> scales the component to 110% of its size, when you hover on the button.</p>
<p>The <strong>whileTap</strong> scales it down to 95% of its size, when you tap on the button.</p>
<p>I bet that I didn’t even need to give you that explanation for the code as its already pretty much self explanatory and highly readable.</p>
<p>You can tap on the link below to check out the button animation yourself.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://examples.motion.dev/react/gestures">https://examples.motion.dev/react/gestures</a></div>
<p> </p>
<p>Now, I’m not here to give you the full tutorial for using the library, because duh, we have the official <a target="_blank" href="https://motion.dev/docs/react">motion.dev</a> website where you can go and read the documentation if you want to learn about this.</p>
<h1 id="heading-choosing-framermotion-over-vanillacss">Choosing FramerMotion over VanillaCSS</h1>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Aspect</strong></td><td><strong>Framer Motion</strong></td><td><strong>Vanilla CSS</strong></td></tr>
</thead>
<tbody>
<tr>
<td><strong>Ease of Use</strong></td><td>Uses clean, declarative syntax with JSX-friendly <code>motion</code> components</td><td>Requires separate CSS code and complex keyframes for dynamic effects</td></tr>
<tr>
<td><strong>Hover &amp; Tap Animations</strong></td><td>Comes with built-in props like <code>whileHover</code>, <code>whileTap</code> for interactive effects</td><td>Relies on <code>:hover</code>, <code>:active</code>, and sometimes JavaScript for tap gestures</td></tr>
<tr>
<td><strong>Gesture Support</strong></td><td>Native support for gestures like drag, tap, and pan</td><td>No built-in gesture support — needs JavaScript or external libraries</td></tr>
<tr>
<td><strong>Chaining Animations</strong></td><td>Variants and transitions allow easy chaining and sequencing</td><td>Achievable, but requires careful timing and sometimes JS</td></tr>
<tr>
<td><strong>Integration with React</strong></td><td>Designed specifically for React — animations live inside components</td><td>Requires hooks, refs, or external triggers to tie animations to components</td></tr>
</tbody>
</table>
</div><h1 id="heading-bringing-it-all-together">Bringing it all together</h1>
<p>Choosing a different technology for something you have already grown comfortable with can feel unnecessary at times or may even seem tough as the landscape feels completely unknown. So, you have to trust me on this and try it out yourself. This will help you better align your thoughts about choosing something new.</p>
<p>As for my own preference I simply cannot go back to traditional ways of adding animation to my app after experiencing how simple it is to code with this library.</p>
<h2 id="heading-this-is-how-you-go-from-static-to-cinematic">this is how you go from static to cinematic.</h2>
]]></content:encoded></item></channel></rss>