<?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: Kamal</title>
    <description>The latest articles on DEV Community by Kamal (@kamalsamaila).</description>
    <link>https://dev.to/kamalsamaila</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%2F924077%2F6ef9d1cb-12bf-407a-b4b6-ac62c80df84c.jpg</url>
      <title>DEV Community: Kamal</title>
      <link>https://dev.to/kamalsamaila</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kamalsamaila"/>
    <language>en</language>
    <item>
      <title>Animate a Math Object With a Trace Path Using Python Manim Library</title>
      <dc:creator>Kamal</dc:creator>
      <pubDate>Fri, 23 Sep 2022 16:52:49 +0000</pubDate>
      <link>https://dev.to/kamalsamaila/animate-a-math-object-with-a-trace-path-using-python-manim-library-f9p</link>
      <guid>https://dev.to/kamalsamaila/animate-a-math-object-with-a-trace-path-using-python-manim-library-f9p</guid>
      <description>&lt;h3&gt;
  
  
  Learn the basics of manim library to create beautiful animation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f2tWJ3ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AgMchhxA5Cazbs6GtBkQxXw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f2tWJ3ot--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2AgMchhxA5Cazbs6GtBkQxXw.png" alt="" width="792" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Manim is a python library used to create beautiful animation, especially if you want to visualize a mathematical concept. it was invented by &lt;a href="https://www.youtube.com/c/3blue1brown"&gt;3blue1brown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Unfortunately, the explanation in the &lt;a href="https://docs.manim.community/en/stable/index.html"&gt;**documentation&lt;/a&gt;** of manim is challenging to grasp especially for beginners. Since understanding the basics of any technology is key to building a mental framework and how you can reinvent the wheel, this article will try to explain some simple basic concepts that will explain some code in the documentation.&lt;/p&gt;

&lt;p&gt;I have a pdf copy where I explain all the classes and methods we will use in detail through this &lt;a href="https://payhip.com/b/ao1BJ"&gt;link&lt;/a&gt;. It simplifies the classes for a beginner to grasp&lt;/p&gt;

&lt;h3&gt;
  
  
  One of the basics is to understand the manim coordinate system.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXt9vno1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2560/1%2AC_RcZf68lz3Ug5xQaZ8iAQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZXt9vno1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2560/1%2AC_RcZf68lz3Ug5xQaZ8iAQ.png" alt="source: author" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is very important when positioning your objects in the scene canvas.&lt;/p&gt;

&lt;p&gt;In manim, maths object (mobject) is the basic object that we add to our scene canvas and also animate.&lt;/p&gt;

&lt;p&gt;All mobjects are positioned at the centre of the canvas i.e. (0,0) coordinate by default. every cell represents one &lt;strong&gt;Munit&lt;/strong&gt; (manim unit)&lt;/p&gt;

&lt;p&gt;When you count the cell in the &lt;strong&gt;height&lt;/strong&gt;, you get 8 &lt;strong&gt;Munit&lt;/strong&gt; and the &lt;strong&gt;width&lt;/strong&gt; will give you around 14.22 **Munit. **I will be creating a cheat sheet in positioning manim mobjects soon.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Let's use the TracedPath class from the manim library to animate a moving dot leaving a trace&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We will be using google colab to run the code. just run the following code to install the manim library and its dependencies.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;!sudo apt update

!sudo apt install libcairo2-dev ffmpeg \n
texlive texlive-latex-extra texlive-fonts-extra \n
texlive-latex-recommended texlive-science \n
tipa libpango1.0-dev

!pip install manim

!pip install IPython — upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The next step is to all classes, methods and functions from the library.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;**from** manim **import** *****
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This is the complete code and I will be explaining what each line does use the python comment&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jZfnfl4W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6dobio7rlqvuysshtho.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jZfnfl4W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6dobio7rlqvuysshtho.gif" alt="result of animation" width="880" height="880"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  conclusion
&lt;/h3&gt;

&lt;p&gt;Experimenting with python and manim library can be a fun way to learn programming, especially objected-oriented concepts. you will be able to see the result of code through animating mathematical objects(mobjects) and concepts. my next article will be on animating functions and plotting the results.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published at https://&lt;a href="https://www.instructables.com/Animate-a-Math-Object-With-a-Trace-Path-Using-Pyth/"&gt;www&lt;/a&gt;.instructables.com.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
