<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Abinash Panda on Medium]]></title>
        <description><![CDATA[Stories by Abinash Panda on Medium]]></description>
        <link>https://medium.com/@abinashpanda?source=rss-c12981482cab------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QmS1aGdtNiKWG9To.jpg</url>
            <title>Stories by Abinash Panda on Medium</title>
            <link>https://medium.com/@abinashpanda?source=rss-c12981482cab------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:31:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abinashpanda/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Material Design Motions with React Native — Hello world]]></title>
            <link>https://medium.com/codios/material-design-motions-with-react-native-hello-world-43f54fd0b84c?source=rss-c12981482cab------2</link>
            <guid isPermaLink="false">https://medium.com/p/43f54fd0b84c</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[material-design]]></category>
            <dc:creator><![CDATA[Abinash Panda]]></dc:creator>
            <pubDate>Fri, 29 Dec 2017 08:38:55 GMT</pubDate>
            <atom:updated>2018-01-28T06:20:32.552Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*yOjn5VU2OaqS8OyiGkvdzg.gif" /><figcaption><a href="https://material.io/guidelines/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions">A floating action button transforming into a toolbar</a></figcaption></figure><p>Ever since material design motion guidelines were unveiled in Google I/O, I became a huge fan of it. I always wanted to code these beautiful animations.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F6p3i6H2oGa0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D6p3i6H2oGa0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F6p3i6H2oGa0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d8f46f6e6127d1eac2ddd8d01149378/href">https://medium.com/media/5d8f46f6e6127d1eac2ddd8d01149378/href</a></iframe><p>However, despite the great advantages of using react-native, the first step can be a bit daunting. That’s why I’ve started writing a series of posts (more like a journal) that take you step-by-step through coding almost all the material design motion implementations presented in their <a href="https://material.io/guidelines/motion/material-motion.html">guidelines</a>.</p><ul><li>Chapter 1: Hello World</li></ul><h3>Anatomy of the transition</h3><p>Before we write a single line of code, let’s break down the animation into phases and study each one in detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bzc8bkLaW493j8KC4NMb_g.png" /></figure><ul><li>Scene 1: Initial state when the user presses the FAB button.</li><li>Scene 2: The FAB button moves to the bottom and the icon fades away</li><li>Scene 3: In the next instant the FAB button expands to fill the container and menu buttons slowly starts to fade in</li><li>Scene 4: Once the FAB button has filled up the space and menu buttons have appeared.</li><li>Scene 5: The menu buttons expand slightly to fill up the space to give the reveal effect.</li></ul><p>Thus the entire animation sequence can be defined with the help of just four points in the range of 0 to 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*uy8BVaSvboae3K54KsW1tA.png" /></figure><p><strong>0</strong>: representing the start of the animation sequence</p><p><strong>MOVE_END</strong>: representing animation progress where FAB button has moved to the bottom and icon has faded away</p><p><strong>TRANSFORM_END</strong>: representing animation progress where FAB button has expanded and menu buttons have faded in.</p><p><strong>1</strong>: representing end of animation sequence</p><h3>Talk is cheap. Show me the code</h3><p>Enough with the explanation. Lets get our hands dirty.</p><h4>Creating the FAB</h4><p>To create Floating action button or commonly known as FAB, let’s start by creating a simple view and apply some styles as specified in the <a href="https://material.io/guidelines/components/buttons-floating-action-button.html">material design guidelines</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6477675c9b94b231b8bf42f1a772bcc2/href">https://medium.com/media/6477675c9b94b231b8bf42f1a772bcc2/href</a></iframe><p>To make the FAB button touchable, let’s wrap it up with a <em>TouchableNativeFeedback</em> in case of Android and <em>TouchableOpacity</em> in case of iOS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5e8f1c4dd95f8e1b983288569990c58/href">https://medium.com/media/f5e8f1c4dd95f8e1b983288569990c58/href</a></iframe><h4>Creating animation sequence</h4><p>Lets start with creating an animated value which changes from 0 to 1 (in case of reveal menu transition) and 1 to 0 (in case of hide menu transition). Lets also fix the MOVE_END value to 0.2 and TRANSFORM_END value to 0.6. (These values are arbitrary and you can play with them until you get the perfect animation sequence).</p><h4>Move Phase</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*W1fEWM6mC4N6R3BjhhlmvA.png" /><figcaption>Initial Position (Left) and Final Position (Right) of FAB Button in Move Phase</figcaption></figure><p>In the move phase, the FAB button moves from the bottom right position to the bottom of the screen in a <a href="https://material.io/guidelines/motion/movement.html#movement-movement-within-screen-bounds">curve path</a>.</p><p>To move the FAB from the initial position to the final position, we interpolate the value of animationProgress with inputRange being <em>[0, MOVE_STOP, TRANSFORM_STOP, 1]</em> and outputRange being <em>[INITIAL_FAB_POSITION_RIGHT, FINAL_FAB_POSITION_RIGHT, FINAL_FAB_POSITION_RIGHT, FINAL_FAB_POSITION_RIGHT]</em>. The last three value repeats to make sure that even though the animationProgress value changes greater than MOVE_STOP point, the FAB’s right position never changes. Similarly the FAB’s bottom position and icon’s opacity are also changed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/21ac92d5f3d1bd40d8b471572064aa68/href">https://medium.com/media/21ac92d5f3d1bd40d8b471572064aa68/href</a></iframe><p>To move the FAB in a curvilinear path, we use easing while interpolation. A point moves in straight line if both the vertical and horizontal position changes uniformly. But if we add easing while interpolating the vertical position it would move in a curvilinear path.</p><h4>Transform Phase</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*WD-qVKGDVMDfjUio8K2-sw.png" /><figcaption>Scaling of Fab (Left) and Scaled Fab (Right) in Transform Phase</figcaption></figure><p>In the transform phase, the circular FAB button transform into a rectangular toolbar. This effect can be achieved by wrapping the FAB with a container which has overflow hidden to clip the circular shape of FAB. And instead of moving the FAB button we now need to move the container.</p><p>Initial the container would be enclosing the FAB button (with some additional padding to prevent clipping the button’s shadow). Once the move phase is completed, the FAB button would scale up and the container would change its shape from a square to rectangle, giving the nice and smooth fill effect.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4c6c82d4c15e8ef863b68faee867449/href">https://medium.com/media/c4c6c82d4c15e8ef863b68faee867449/href</a></iframe><h4>Reveal Toolbar Menu</h4><p>Toolbar menu is revealed in two phases. During the transform phase, its opacity is changed from 0 to 1. And once the transform phase is completed its scale is changed from 0.95 to 1.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f838eb3d093a3c660efcb2f963812de/href">https://medium.com/media/6f838eb3d093a3c660efcb2f963812de/href</a></iframe><h3>Last Words</h3><p>The above implementation is just the beginning. It can be obviously optimized and componentized. In the next blog we would looking on how to use improve performance and create reusable components.</p><p>You could check the implementation using <a href="https://snack.expo.io/">Expo</a>.</p><p>Feel free to suggest any changes you think should be added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*SGik9Hntv8sgH5dOeIT5EQ.png" /><figcaption><a href="https://snack.expo.io/@abinashpanda/fab-transition">https://snack.expo.io/@abinashpanda/fab-transition</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43f54fd0b84c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codios/material-design-motions-with-react-native-hello-world-43f54fd0b84c">Material Design Motions with React Native — Hello world</a> was originally published in <a href="https://medium.com/codios">Prodios Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>