<?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: Sergey Borovikov</title>
    <description>The latest articles on DEV Community by Sergey Borovikov (@foretoo).</description>
    <link>https://dev.to/foretoo</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%2F896215%2Ff9bb9490-4d55-4a2e-8d2b-d122bb9c40b4.jpeg</url>
      <title>DEV Community: Sergey Borovikov</title>
      <link>https://dev.to/foretoo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/foretoo"/>
    <language>en</language>
    <item>
      <title>Meet react-cloud-letter, a React component to wrap your text in cloud-like shapes ☁️</title>
      <dc:creator>Sergey Borovikov</dc:creator>
      <pubDate>Tue, 26 Jul 2022 18:33:00 +0000</pubDate>
      <link>https://dev.to/foretoo/meet-react-cloud-letter-a-react-component-to-wrap-your-text-in-cloud-like-shapes-1nko</link>
      <guid>https://dev.to/foretoo/meet-react-cloud-letter-a-react-component-to-wrap-your-text-in-cloud-like-shapes-1nko</guid>
      <description>&lt;p&gt;I made &lt;a href="https://github.com/foretoo/react-cloud-letter"&gt;react-cloud-letter&lt;/a&gt; — a customizable, easy-to-use React component. It turns your content into auto-merged clouds that are super stylish and attractive to read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.npmjs.com/package/react-cloud-letter"&gt;npm link&lt;/a&gt;, unpacked size — 37 kB only&lt;/p&gt;

&lt;p&gt;You can wrap the whole text, certain parts of it, just spaces (see examples below!), or customize your variant on &lt;a href="https://foretoo.github.io/react-cloud-letter"&gt;Demo page&lt;/a&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Partial mode
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--12KtmQl---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ti50m3imco7t8unickc.png" alt="example of react-cloud-letter applying" width="880" height="264"&gt;
&lt;/li&gt;
&lt;li&gt;Word mode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YbAbd1a2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abkw0jnhrio91oy6g7cu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YbAbd1a2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abkw0jnhrio91oy6g7cu.png" alt="example of react-cloud-letter applying" width="880" height="246"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Space mode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dUPEpK70--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcv5zv73zwjdqaxxvgq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dUPEpK70--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hcv5zv73zwjdqaxxvgq3.png" alt="example of react-cloud-letter applying" width="880" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know what you think. Any feedback would be appreciated! ✌️&lt;/p&gt;

</description>
      <category>react</category>
      <category>component</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I made a tool to round corners of a polygon in a proper way</title>
      <dc:creator>Sergey Borovikov</dc:creator>
      <pubDate>Sun, 24 Jul 2022 20:51:33 +0000</pubDate>
      <link>https://dev.to/foretoo/i-made-a-tool-to-round-corners-of-a-polygon-in-a-proper-way-27fg</link>
      <guid>https://dev.to/foretoo/i-made-a-tool-to-round-corners-of-a-polygon-in-a-proper-way-27fg</guid>
      <description>&lt;p&gt;If you ever needed to round corners of a polygon — not a rectangle, in which case at least you have a CSS rule "border-radius," but an n-polygon like star or a triangle — you probably googled for such an algorithm, an npm package, or a git repo. In my case, I found a few (lib &lt;a href="https://github.com/BrunoFenzl/svg-round-corners"&gt;svg-round-corners&lt;/a&gt;, stackoverflow &lt;a href="https://stackoverflow.com/questions/19269622/applying-rounded-corners-to-paths-polygons"&gt;discussion&lt;/a&gt;, &lt;a href="https://riptutorial.com/html5-canvas/example/18766/render-a-rounded-polygon-"&gt;algo1&lt;/a&gt;, &lt;a href="https://gorillasun.de/blog/an-algorithm-for-polygons-with-rounded-corners"&gt;algo2&lt;/a&gt;), but all of these algos did a half of the work, literally: they would stop rounding the corner when the arc gets to a half of its shortest side. It's a trick to prevent arcs overlapping, but it also provides the lack of a naturally expected result.&lt;/p&gt;

&lt;p&gt;Let's take an arbitrary triangle. Every triangle has an incircle. You will always get this incircle as the result of rounding triangle corners, so I had the same expectations from an algorithm / tool / library.&lt;/p&gt;

&lt;p&gt;In the example below, the red dots are the centers of the edges, in other words, halfs. The expected behaviour is in the middle; the right part shows the result of the "unnatural" solutions mentioned above. See how in the example on the right, rounding stops on the bottom corners even if there is still room to go.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dj3kTk_O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rqnohruq1wmov8hqqfo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dj3kTk_O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rqnohruq1wmov8hqqfo.gif" alt="Two ways of rounding corners of a polygon: 1. natural, 2. formal" width="700" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another example. See how polygon gets rounded nicely and naturally in the middle, and how awkwardly (in my opinion) it looks in the next picture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F5oXH5gT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikwsxdr3ndvm3koha1uo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F5oXH5gT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ikwsxdr3ndvm3koha1uo.gif" alt="Two ways of rounding corners of a polygon: 1. natural, 2. formal" width="700" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, since I never found the solution that gives me a rounded polygon with a prescribed result... I implemented my own: &lt;a href="https://github.com/foretoo/round-polygon"&gt;round-polygon&lt;/a&gt;. Check it out and feel free to play with it! Also check out a crazy &lt;a href="https://foretoo.github.io/round-polygon"&gt;Demo&lt;/a&gt; that I created with this tool. =)&lt;/p&gt;

&lt;p&gt;P.S. I took a few steps further: added an option to pass certain radius to a certain point of the polygon, and provided utility to get segments of arcs of rounded corners.&lt;/p&gt;

&lt;p&gt;What do you folks think?&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>algorithms</category>
      <category>tooling</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
