<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lokesh</title>
    <description>The latest articles on DEV Community by Lokesh (@lokeshcoder).</description>
    <link>https://dev.to/lokeshcoder</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F89543%2Fdcfe378b-98af-4854-b58a-f966377067b8.png</url>
      <title>DEV Community: Lokesh</title>
      <link>https://dev.to/lokeshcoder</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lokeshcoder"/>
    <language>en</language>
    <item>
      <title>Generate beautiful blob shapes for web and flutter apps</title>
      <dc:creator>Lokesh</dc:creator>
      <pubDate>Thu, 28 May 2020 03:02:44 +0000</pubDate>
      <link>https://dev.to/lokeshcoder/generate-beautiful-blob-shapes-for-web-and-flutter-apps-515l</link>
      <guid>https://dev.to/lokeshcoder/generate-beautiful-blob-shapes-for-web-and-flutter-apps-515l</guid>
      <description>&lt;p&gt;Recently I was trying to convert a dribbble shot to a flutter app, and then quickly realised blob shapes in the design is not something easy to bring it in flutter. Initially I started with SVG's from &lt;a href="https://www.blobmaker.app/" rel="noopener noreferrer"&gt;Blobmaker&lt;/a&gt; but animation and morphing the path became a pain, because I am beginner and I truly hate anything that involves Math.&lt;/p&gt;

&lt;p&gt;So, I decided to create a package that fits to my needs and some common use cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  Blobs for flutter
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/lokesh-coder/flutter_blobs" rel="noopener noreferrer"&gt;flutter_blobs&lt;/a&gt; is a tiny package which helps to create and animate blobs shapes. There are quite a few features in it, like clipping, children widgets, gradient background, outlines and couple more. There is no dependencies and it is flexible, as the path can be manipulated easily to create complex shapes.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1754676%2F82777008-6ebfb180-9e6a-11ea-9b85-fcac09cfca38.gif"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1754676%2F82777157-ef7ead80-9e6a-11ea-9b74-6224cf33d739.png"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1754676%2F82777018-75e6bf80-9e6a-11ea-913d-873e9ba4444c.gif"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lokesh-coder" rel="noopener noreferrer"&gt;
        lokesh-coder
      &lt;/a&gt; / &lt;a href="https://github.com/lokesh-coder/flutter_blobs" rel="noopener noreferrer"&gt;
        flutter_blobs
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Generate Blob shapes for flutter apps
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;
&lt;br&gt;
&lt;/h3&gt;
&lt;p&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1754676/82777559-18537280-9e6c-11ea-9257-0a24645c91b0.png"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1754676%2F82777559-18537280-9e6c-11ea-9257-0a24645c91b0.png" alt="Blobs"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;Create beautiful blob shapes with minimal code. &lt;/h4&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Features&lt;/h3&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Generate blob in any size&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Control the randomness and complexity&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Animate the blob&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set ID for a fixed blob&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Shuffle between the fixed blobs&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Loop animation&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Blob clipper&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Get SVG path&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Debug, Child widget, controller and few more&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div&gt;
&lt;pre&gt;&lt;div&gt;&lt;strong&gt;Blobs App&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="https://lokesh-coder.github.io/blobs.app" rel="nofollow noopener noreferrer"&gt;https://lokesh-coder.github.io/blobs.app&lt;/a&gt;&lt;/div&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Contents&lt;/h3&gt;

&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://github.com/lokesh-coder/flutter_blobs#widgets" rel="noopener noreferrer"&gt;Widgets&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://github.com/lokesh-coder/flutter_blobs#clipper" rel="noopener noreferrer"&gt;Clipper&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://github.com/lokesh-coder/flutter_blobs#service" rel="noopener noreferrer"&gt;Service&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://github.com/lokesh-coder/flutter_blobs#inspirations" rel="noopener noreferrer"&gt;Inspirations&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Widgets&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;There are four widgets,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Blob.random()&lt;/code&gt; - Generate random blobs&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Blob.animatedRandom()&lt;/code&gt; - Generate blobs and animate the shape change&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Blob.fromID()&lt;/code&gt; - Use one or more ID's for fixed blobs&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;Blob.animatedFromID()&lt;/code&gt; - Animate the shape change&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1754676/82777156-eee61700-9e6a-11ea-9834-18882991056b.png"&gt;&lt;img width="200" alt="basic_blobs" src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F1754676%2F82777156-eee61700-9e6a-11ea-9834-18882991056b.png"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;⚙️ Blob Size&lt;/h4&gt;

&lt;/div&gt;
&lt;p&gt;Size of the blob (&lt;em&gt;mandatory&lt;/em&gt;).&lt;/p&gt;
&lt;div class="highlight highlight-source-dart notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c1"&gt;Blob&lt;/span&gt;.&lt;span class="pl-en"&gt;random&lt;/span&gt;(size&lt;span class="pl-k"&gt;:&lt;/span&gt;&lt;span class="pl-c1"&gt;200&lt;/span&gt;),
&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h4 class="heading-element"&gt;⚙️ Customise shape&lt;/h4&gt;

&lt;/div&gt;
&lt;p&gt;&lt;code&gt;edgesCount&lt;/code&gt; is the nodes count. More the value, more the complexity. Minimum is &lt;em&gt;3&lt;/em&gt; and max is &lt;em&gt;300&lt;/em&gt;. But for cool shapes you can stick between &lt;em&gt;3-20&lt;/em&gt;. Default is &lt;em&gt;7&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;minGrowth&lt;/code&gt; is the minimum size of the blob. Smaller…&lt;/p&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/lokesh-coder/flutter_blobs" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Blobs for Web
&lt;/h3&gt;

&lt;p&gt;Random blob shapes are great in some scenarios, but in most cases user always wanted a same blob shape on every render. This is where things got complicated. For that I have to build a web app, where user can generate blob shapes and use it in flutter app with a ID. My first idea was to build a web app with flutter web. But things didn't worked well, as there were lot of challenges like slow initial load, less customisation. So, finally I ported the path generation logic to Javascript and made a simple Blob generation tool using the SVG.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1265664002102824968-974" src="https://platform.twitter.com/embed/Tweet.html?id=1265664002102824968"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1265664002102824968-974');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1265664002102824968&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blobs.app/" rel="noopener noreferrer"&gt;https://blobs.app/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaway
&lt;/h3&gt;

&lt;p&gt;As I mentioned earlier, Math is just a pain for me. But stepping out and learning trigonometry and pseudorandom number generator (PRNG) was a very good experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;p&gt;Web app - &lt;a href="https://blobs.app/" rel="noopener noreferrer"&gt;Blob generator&lt;/a&gt;&lt;br&gt;
Flutter package - &lt;a href="https://pub.dev/packages/blobs" rel="noopener noreferrer"&gt;blobs&lt;/a&gt;&lt;br&gt;
Package repo - &lt;a href="https://github.com/lokesh-coder/flutter_blobs" rel="noopener noreferrer"&gt;flutter_blobs&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Contribution
&lt;/h3&gt;

&lt;p&gt;I would really like any kind of contribution from the community.&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>design</category>
    </item>
  </channel>
</rss>
