<?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 Toufic Batache on Medium]]></title>
        <description><![CDATA[Stories by Toufic Batache on Medium]]></description>
        <link>https://medium.com/@touficbatache?source=rss-6db72d3951b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y2_oE1SydRRU0FdCy8aqNQ.jpeg</url>
            <title>Stories by Toufic Batache on Medium</title>
            <link>https://medium.com/@touficbatache?source=rss-6db72d3951b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:44:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@touficbatache/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[How I coded the search reveal animation for the web]]></title>
            <link>https://touficbatache.medium.com/how-i-coded-the-search-reveal-animation-for-the-web-85b8048091fc?source=rss-6db72d3951b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/85b8048091fc</guid>
            <category><![CDATA[circular]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[animation]]></category>
            <category><![CDATA[search]]></category>
            <dc:creator><![CDATA[Toufic Batache]]></dc:creator>
            <pubDate>Tue, 06 Nov 2018 19:28:03 GMT</pubDate>
            <atom:updated>2021-04-24T22:01:29.470Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naWftQ5h_g9wYwLU-HcOdg.png" /><figcaption>Search Reveal Animation demo</figcaption></figure><p>I’ve always been interested in animations, and I never fail to notice the small details that distinguish them from each other. I actually really appreciate the effort the designers put into them, that’s why I’ve always enjoyed the Material Design animations on my Android phone — and it’s no secret to anyone.</p><p>Recently, a really beautiful animation caught my eye while using apps like Play Store and Whatsapp after tapping the search icon: the <em>circular reveal</em> animation.</p><p>Knowing my passion for coding and my interest in design, I couldn’t resist the temptation to recreate that animation for the web.</p><h3>Umm.. what exactly are you talking about?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*vPkz5lf0hXUImMd1vXieZw.gif" /><figcaption>Search circular reveal animation in the Google Play Store app</figcaption></figure><p>Yes. The circular reveal animation.</p><p>I’m sure you’ve seen it before. It’s used in many apps, and it’s quite unique &amp; recognizable. It simply consists of a circle expanding and transforming into a view.</p><p>You can see it in action on the left. Here, it’s used in the Play Store app to reveal a floating search box.</p><h3>And how are you going to code it?</h3><p>Wanting to do things the right way, I looked for documentation on the <a href="https://www.material.io/design/">Material Design Guidelines website</a>, but I couldn’t find any guidelines regarding this. And since there was nothing mentioning it, I resorted to taking a look at how Google brings the search into view in the Play Store app. After taking a closer look and slowing it down to catch the smallest details, I had a clearer idea on how it worked.</p><p>Now, I had the tackle the issue of coding it, and the best way to do it wasn’t very obvious at first.</p><p>I sat down and I went through the many different ways this could be pulled off with CSS and Javascript. Different ideas came to mind and I had to test them to see which one was the most efficient in terms of code and performance.</p><h3>Alright, let’s see how you did it!</h3><h4>1st approach: Scale</h4><p>The first thing that came to mind was the basic CSS property scale. At first, I wanted to create a small circle and to scale it from 1 to 300, filling the whole toolbar.</p><p>However, this technique had several issues:</p><ol><li>The circle looked too blurry while animating</li><li>On mobile, the circle doesn’t grow from the same point as on PC</li></ol><p>I thought a bit more and came up with a slightly better idea, still using scale, but this time, the scaling was from 0.003 to 1.</p><p>Now the circle wasn’t blurry anymore. Yayyy!</p><p>On the other hand though, a very important issue still needed to be addressed: the content was scaling with the circle too.</p><p>I had to find something else that could do the job and hopefully perfect it.</p><h4>2nd approach: Clip-path</h4><p>After the scale CSS property turned out to be a failure, I searched for different ways to animate shapes with CSS. That’s when I came across clip-path.</p><p>Spoiler alert: it turned out great! Using clip-path with a bit of Javascript (and <strong>a lot</strong> of adjustments), I got it to the point where I was happy about it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*soMwfvfjKtm7x1tzjCtQhA.gif" /><figcaption>Demo on <a href="https://www.batache.com/">www.batache.com</a></figcaption></figure><p>See it in action on <a href="https://www.batache.com/">my website</a>!</p><h4>Some smaller additions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*X2lZY2SJUErXQCx5hIdtRA.gif" /><figcaption>Circular reveal animation on Whatsapp with Tab Bar retraction</figcaption></figure><p>At this point, I was very happy with what I had achieved, but I wasn’t fully satisfied.</p><p>You might say: “Well, it works quite well!”.</p><p>I agree. It was quite satisfying at this point, but not perfect yet. Whatsapp does a better job by retracting the tab bar. So I decided I was going to do the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*IseTKSIHw3q2C4XtcF6U0g.gif" /><figcaption>Demo on <a href="http://toufic.000webhostapp.com/">toufic.000webhostapp.com</a></figcaption></figure><p>See it in action at <a href="http://toufic.000webhostapp.com/">toufic.000webhostapp.com</a>!</p><h3>Wrapping up</h3><p>So that’s gonna be it for my first story on Medium. I really hope you enjoyed reading it as much as I did writing it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=85b8048091fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>