<?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: Aashish Panthi</title>
    <description>The latest articles on DEV Community by Aashish Panthi (@aashishpanthi).</description>
    <link>https://dev.to/aashishpanthi</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%2F515453%2F662797b7-3f1f-4aad-829c-694410d96d0c.jpg</url>
      <title>DEV Community: Aashish Panthi</title>
      <link>https://dev.to/aashishpanthi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aashishpanthi"/>
    <language>en</language>
    <item>
      <title>SVG path animation in Nextjs using GSAP</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Wed, 29 May 2024 09:21:51 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/svg-path-animation-in-nextjs-using-gsap-4ac0</link>
      <guid>https://dev.to/aashishpanthi/svg-path-animation-in-nextjs-using-gsap-4ac0</guid>
      <description>&lt;p&gt;Before starting out, let me quickly share what we're building today.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/svg-path-animation-4d2k2v"&gt;
&lt;/iframe&gt;
&lt;br&gt;
Open &lt;a href="https://codesandbox.io/p/devbox/svg-path-animation-4d2k2v" rel="noopener noreferrer"&gt;codesandbox.io&lt;/a&gt; or visit &lt;a href="https://gsap-svg-path-animation.netlify.app/" rel="noopener noreferrer"&gt;&lt;strong&gt;gsap-svg-path-animation.netlify.app&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Seems interesting, let's start.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;You might have visited some websites where when you scroll, things move; some elements move up, some sideways, and sometimes move down also. The elements follow a path when they move and often the path they follow is drawn using &amp;lt;path&amp;gt; element in SVG.&lt;/p&gt;
&lt;h3&gt;
  
  
  Brief overview of SVG animation
&lt;/h3&gt;

&lt;p&gt;Unlike raster images, the SVGs don't lose their quality on zooming because SVGs are just a bunch of coordinates to make mathematical polygons. Also, unlike raster images, SVGs can be animated. We can change color, change size, change shape, and do more cooler stuff. That's all about the SVG animation.&lt;/p&gt;

&lt;p&gt;Now let me explain what an SVG path animation means. So, if you've worked with SVGs before, there are different shapes that you can draw. There are ellipses, lines, polygons, rectangles, circles, and many others. You can find the complete list &lt;a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Basic_Shapes" rel="noopener noreferrer"&gt;here&lt;/a&gt;. In particular, there is something called &lt;code&gt;path&lt;/code&gt; that is used to draw lines, irregular lines; as you do with your hands. Unlike hand-drawn lines, the lines drawn with path elements can be animated. The path is used to guide some elements to move in a specific direction, basically a path and sometimes used to animate the line itself.&lt;/p&gt;
&lt;h3&gt;
  
  
  Introduction to Next.js
&lt;/h3&gt;

&lt;p&gt;I assume you know Next.js. If you don't that's ok. You'll get almost everything out of this article. So, for those who don't know what Next.js is, let me quickly share about the most loved framework by lazy developers (I don't know if it's most loved or not; I love it).&lt;/p&gt;

&lt;p&gt;Next.js is a javascript framework, like React.js but better. Next. js supports Server-Side Rendering (SSR), whereas React. js supports client-side rendering. Doesn't sound like a big deal but it is. SSR improves the application performance and speed and that's the reason I love Next.js.&lt;/p&gt;
&lt;h3&gt;
  
  
  Introduction to GSAP (GreenSock Animation Platform)
&lt;/h3&gt;

&lt;p&gt;Unlike Next.js, I don't assume you know GSAP. So, GSAP which stands for GreenSock Animation Platform is another javascript framework &lt;em&gt;(yes, there are millions of javascript frameworks)&lt;/em&gt; that is used to animate elements on websites. Open their website (&lt;a href="https://gsap.com/" rel="noopener noreferrer"&gt;gsap.com&lt;/a&gt;) to explore the type of animations you can make using GSAP.&lt;/p&gt;
&lt;h3&gt;
  
  
  Purpose and scope of the article
&lt;/h3&gt;

&lt;p&gt;The article's purpose is to help you make GSAP animations in your Next.js project. It's the same for React also. In particular, we'll be looking at SVG path animation on scroll. I assume you saw the demo above.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up the Development Environment
&lt;/h2&gt;

&lt;p&gt;Now let's move on to the actually stop so we are going to set up our development environment and we will be using the npm package manager and create our next application, and use the GSAP library.&lt;/p&gt;
&lt;h3&gt;
  
  
  Installing Node.js and npm
&lt;/h3&gt;

&lt;p&gt;I assume you already have nodejs installed. If you don't then head over to not &lt;a href="https://nodejs.org" rel="noopener noreferrer"&gt;nodejs.org&lt;/a&gt; and download the latest version. Remember I want you to download the long-term support (LTS) version. If you're on Linux then this:&lt;/p&gt;

&lt;p&gt;This one: &lt;a href="https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries" rel="noopener noreferrer"&gt;https://blog.aashish-panthi.com.np/install-node-and-npm-using-linux-binaries&lt;/a&gt; or this: &lt;a href="https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4"&gt;https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4&lt;/a&gt; article will help you.&lt;/p&gt;

&lt;p&gt;To confirm you've installed node.js, run this command on your command prompt or terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you should be seeing some numbers on the screen that represent the version of node.js installed on your machine. It looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxt57fbi65k8of09c6jb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxt57fbi65k8of09c6jb9.png" alt="Node version check in mac terminal" width="800" height="140"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that you have installed the node.js, you need to take for the npm. In most of the cases, the npm gets installed automatically but if it does not, you can install it manually. So let's check if the npm is installed or not. Run the following command on your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if the npm is installed then, you'll see the version like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7bcsmvhhv4zdmo4qvuf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp7bcsmvhhv4zdmo4qvuf.png" alt="NPM version check in mac os" width="800" height="113"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The basic setup is complete. Now let's move on to nitty-gritty.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up a new Next.js project
&lt;/h3&gt;

&lt;p&gt;If you would love to read the official documentation on installing nextjs then &lt;a href="https://nextjs.org/docs/pages/api-reference/create-next-app" rel="noopener noreferrer"&gt;&lt;em&gt;here it is&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt; Otherwise, I'm here to help.&lt;/p&gt;

&lt;p&gt;Now, to install next.js we need to run this command on our terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-next-app@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, it'll ask a few questions. These questions are important and carefully answer them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First, you'll be asked to name the project. Please name it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You'll be asked if you want to use typescript or not. I prefer typescript but it's your call. (In the rest of the article, we'll be using typescript but I'll provide the javascript code at the end).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I like to use Eslint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, I'll be using tailwind CSS. If you want to sit and write your custom CSS then you've a right to opt out.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, it will ask if you'd like to have a &lt;code&gt;src&lt;/code&gt; directory or not. It's more of a personal preference and I would say yes here.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And please use the app router. Please...&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The final question asks you about the default import alias. We don't want to do that so select no.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodfwtfg65mj4u4i6ft7u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodfwtfg65mj4u4i6ft7u.png" alt="Nextjs project configuration by Aashish Panthi" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, after a few seconds, your project will be ready and I would love if you open the project on some code editor. I'll be using &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Go inside of the project and open the terminal. Run the start command to start the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And visit &lt;a href="http://localhost:3000/" rel="noopener noreferrer"&gt;http://localhost:3000/&lt;/a&gt; to see your project running.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing GSAP
&lt;/h3&gt;

&lt;p&gt;Let's quickly install the GSAP packages also. Use the following command to install &lt;code&gt;gsap&lt;/code&gt; and &lt;code&gt;@gsap/react&lt;/code&gt; packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i @gsap/react gsap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all. First, let's have our SVG ready and then we'll animate. Alright?&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating SVG Graphics
&lt;/h2&gt;

&lt;p&gt;I assume you already have your SVG element ready. If you have it on your figma, export it as SVG. If you don't have you can make one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Designing SVG graphics
&lt;/h3&gt;

&lt;p&gt;I quickly made this shape in Figma using pen tool. It is basically the path over which we'll be moving stuff on the scroll event. I still don't know what I'll be moving.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F484b5hspib818uoppzf3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F484b5hspib818uoppzf3.png" alt="Path image for GSAP animation on Nextjs" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To export your SVG from Figma, select the shape you want to export. If you have more than one shape, select the shapes and group them then export them as SVG. You'll see the export option at the right end of the screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsxtdvk1b43w8uy7qiq2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpsxtdvk1b43w8uy7qiq2.png" alt="Export figma design" width="800" height="514"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Well, if you would like to use mine then here is the SVG code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"462"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"829"&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 462 829"&lt;/span&gt; &lt;span class="na"&gt;fill=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;d=&lt;/span&gt;&lt;span class="s"&gt;"M36.4996 4L429.5 238C449.666 250 479 284.9 435 328.5C391 372.1 151 480.333 36.4996 529C12.1662 545.167 -21.9004 587.7 36.4996 628.5C94.8996 669.3 326.5 776.167 435 824.5"&lt;/span&gt; &lt;span class="na"&gt;stroke=&lt;/span&gt;&lt;span class="s"&gt;"#0000FF"&lt;/span&gt; &lt;span class="na"&gt;stroke-width=&lt;/span&gt;&lt;span class="s"&gt;"8"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ok, that's the path and let's move a card along that path. Sound great? I've made a car. I'm not a designer. Please don't judge me:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5asuylzaqls4g4r807e1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5asuylzaqls4g4r807e1.png" alt="Car icon in Figma for animation with GSAP" width="800" height="618"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've grouped the two items and exported them as SVG. If you want the code, here it is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;
&lt;span class="nt"&gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"462"&lt;/span&gt; &lt;span class="na"&gt;height=&lt;/span&gt;&lt;span class="s"&gt;"844"&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 462 844"&lt;/span&gt; &lt;span class="na"&gt;fill=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;d=&lt;/span&gt;&lt;span class="s"&gt;"M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5"&lt;/span&gt; &lt;span class="na"&gt;stroke=&lt;/span&gt;&lt;span class="s"&gt;"#0000FF"&lt;/span&gt; &lt;span class="na"&gt;stroke-width=&lt;/span&gt;&lt;span class="s"&gt;"8"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;path&lt;/span&gt; &lt;span class="na"&gt;d=&lt;/span&gt;&lt;span class="s"&gt;"M37.7316 37.3941L46.4471 37.0985C46.7214 37.0872 46.9392 36.9896 47.1001 36.8317L60.2671 45.3825C62.7497 46.9947 65.6719 46.8955 66.7971 45.163L73.9314 34.1771C75.0579 32.4425 73.9598 29.7326 71.4773 28.1204L58.3102 19.5696C58.3877 19.3605 58.3896 19.1198 58.2883 18.8645L55.0122 10.7844C54.706 10.0288 53.6614 9.44663 52.673 9.47815C51.6862 9.51362 51.134 10.152 51.4373 10.9057L53.7501 16.6082L41.4135 8.59676C38.9339 6.98646 36.0087 7.08368 34.8822 8.81829L27.7479 19.8042C26.6228 21.5367 27.7237 24.2485 30.2034 25.8588L42.5399 33.8703L36.387 34.081C35.5765 34.1085 35.2193 34.8705 35.5882 35.7864C35.9614 36.7022 36.9182 37.4197 37.7316 37.3941ZM56.9649 23.0482L56.3711 23.9626L46.2266 17.3747L46.8204 16.4603L56.9649 23.0482ZM40.0447 12.0601L43.6442 15.6977L37.5977 25.0085L32.8092 23.2018L40.0447 12.0601ZM39.5849 27.602L40.1801 26.6855L50.3246 33.2734L49.7294 34.1899L39.5849 27.602ZM52.8688 34.9256L58.9153 25.6149L63.7025 27.4236L56.467 38.5653L52.8688 34.9256Z"&lt;/span&gt; &lt;span class="na"&gt;fill=&lt;/span&gt;&lt;span class="s"&gt;"#E52A2D"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/svg&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Importing SVG files into the Next.js project
&lt;/h3&gt;

&lt;p&gt;No, we are not going to import the SVG file. Rather we will have SVG inside our JSX file with other react neety-greety.&lt;/p&gt;

&lt;p&gt;Let's create a separate component for the Animation thing and we'll import it inside of our page.tsx file. And the root &lt;code&gt;page.tsx&lt;/code&gt; file should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PathAnimation&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/PathAnimation&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;flex-col min-h-screen w-full dark:text-white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h-screen w-full flex flex-col items-center justify-center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-[#432826] text-[24px] leading-[36px] font-[400] text-center dark:text-white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;SVG&lt;/span&gt; &lt;span class="nx"&gt;Path&lt;/span&gt; &lt;span class="nx"&gt;Animation&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-[16px] leading-[27px] text-[#432826] font-[400] text-center dark:text-white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;simple&lt;/span&gt; &lt;span class="nx"&gt;animation&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;bee&lt;/span&gt; &lt;span class="nx"&gt;following&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="nx"&gt;using&lt;/span&gt; &lt;span class="nx"&gt;GSAP&lt;/span&gt;
          &lt;span class="nx"&gt;MotionPath&lt;/span&gt; &lt;span class="nx"&gt;plugin&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;PathAnimation&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h-screen w-full flex flex-col items-center justify-center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-[#432826] text-[24px] leading-[36px] font-[400] dark:text-white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;You&lt;/span&gt; &lt;span class="nx"&gt;saw&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text-[16px] leading-[27px] text-[#432826] font-[400] dark:text-white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;The&lt;/span&gt; &lt;span class="nx"&gt;bee&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;following&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Isn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;t that cool?
        &amp;lt;/p&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/main&amp;gt;
  );
}
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And let's have our &lt;code&gt;PathAnimation.jsx&lt;/code&gt; file separately (create a components folder and place it there). The component looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PathAnimation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt;
      &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;py-16 px-4 md:px-2 bg-secondary w-full&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`max-w-[1250px] w-full mx-auto relative mt-16 mb-20`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;
          &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;462&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;viewBox&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0 0 462 844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://www.w3.org/2000/svg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;w-full h-full&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0000FF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;strokeWidth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M37.7316 37.3941L46.4471 37.0985C46.7214 37.0872 46.9392 36.9896 47.1001 36.8317L60.2671 45.3825C62.7497 46.9947 65.6719 46.8955 66.7971 45.163L73.9314 34.1771C75.0579 32.4425 73.9598 29.7326 71.4773 28.1204L58.3102 19.5696C58.3877 19.3605 58.3896 19.1198 58.2883 18.8645L55.0122 10.7844C54.706 10.0288 53.6614 9.44663 52.673 9.47815C51.6862 9.51362 51.134 10.152 51.4373 10.9057L53.7501 16.6082L41.4135 8.59676C38.9339 6.98646 36.0087 7.08368 34.8822 8.81829L27.7479 19.8042C26.6228 21.5367 27.7237 24.2485 30.2034 25.8588L42.5399 33.8703L36.387 34.081C35.5765 34.1085 35.2193 34.8705 35.5882 35.7864C35.9614 36.7022 36.9182 37.4197 37.7316 37.3941ZM56.9649 23.0482L56.3711 23.9626L46.2266 17.3747L46.8204 16.4603L56.9649 23.0482ZM40.0447 12.0601L43.6442 15.6977L37.5977 25.0085L32.8092 23.2018L40.0447 12.0601ZM39.5849 27.602L40.1801 26.6855L50.3246 33.2734L49.7294 34.1899L39.5849 27.602ZM52.8688 34.9256L58.9153 25.6149L63.7025 27.4236L56.467 38.5653L52.8688 34.9256Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#E52A2D&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/svg&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;PathAnimation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you save and look at the browser, you should be able to see the SVG covering up the whole screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Integrating GSAP with Next.js
&lt;/h2&gt;

&lt;p&gt;Oh the juicy part, let's start with the animation. We got to move that car along the path, right? Let's do that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importing GSAP into Next.js components
&lt;/h3&gt;

&lt;p&gt;First we need to import the gsap and then import the useGSAP hook. The useGSAP hook is fairly new release and you don't find it around the internet (as of early 2024).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useGSAP&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@gsap/react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, we need to import the plugins and register those plugins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MotionPathHelper&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap/MotionPathPlugin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScrollTrigger&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap/ScrollTrigger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;useGSAP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ScrollTrigger&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MotionPathHelper&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all about importing and registering stuffs related to GSAP. Now, let's move on to the next part.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using useRef to handle events
&lt;/h3&gt;

&lt;p&gt;You know in react and next.js, we cannot directly manipulate the elements. So, we need to use useRef hook. We're going to have four refs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGPathElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;carRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGPathElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGSVGElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sectionRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you might have already guessed where you need to place these refs. Well, here it is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt;
      &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;py-16 px-4 md:px-2 bg-secondary w-full&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;sectionRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`max-w-[1250px] w-full mx-auto relative mt-16 mb-20`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;
          &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;462&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;viewBox&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0 0 462 844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://www.w3.org/2000/svg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;w-full h-full overflow-visible&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0000FF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;strokeWidth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M45.5126 32.8551L52.6609 27.8605C52.8849 27.7015 53.0143 27.5011 53.0633 27.281L68.7632 27.281C71.7233 27.281 74.1201 25.6064 74.1201 23.5405V10.4414C74.1201 8.37307 71.7233 6.69838 68.7632 6.69838L53.0633 6.69838C53.0143 6.4808 52.8849 6.27788 52.6609 6.11897L45.5126 1.12674C44.8442 0.659786 43.6511 0.740459 42.8393 1.3052C42.0311 1.87239 41.9156 2.70852 42.5804 3.17547L47.6259 6.69838L32.9163 6.69838C29.9596 6.69838 27.5593 8.37307 27.5593 10.4414L27.5593 23.5405C27.5593 25.6064 29.9596 27.281 32.9163 27.281L47.6259 27.281L42.5804 30.8088C41.9156 31.2734 42.0311 32.107 42.8393 32.6742C43.6511 33.239 44.8442 33.3196 45.5126 32.8551ZM53.8296 10.3485V11.4388L41.7337 11.4388V10.3485L53.8296 10.3485ZM33.6545 10.3485L38.6546 11.4388L38.6546 22.5406L33.6545 23.6334L33.6545 10.3485ZM41.7337 23.6334V22.5406L53.8296 22.5406L53.8296 23.6334L41.7337 23.6334ZM56.8632 22.5406V11.4388L61.8632 10.3485L61.8632 23.6334L56.8632 22.5406Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#E52A2D&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/svg&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;The svg code for car has been changed. Basically, I rotated the card. That's all.&lt;br&gt;&lt;br&gt;
So, after changing the path element, import the useEffect hook from react and we are going to set the position of the car.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;yPercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;xPercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code positions the car at &lt;code&gt;y=0%&lt;/code&gt;, &lt;code&gt;x=20%&lt;/code&gt; and &lt;code&gt;rotation=30deg&lt;/code&gt; (property names aren't exactly the same, it's used to just explain)&lt;/p&gt;

&lt;p&gt;So, our path is there, car is there. And our code looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;//gsap&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useGSAP&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@gsap/react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MotionPathHelper&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap/MotionPathPlugin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ScrollTrigger&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;gsap/ScrollTrigger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;useGSAP&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ScrollTrigger&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;registerPlugin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MotionPathHelper&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;PathAnimation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGPathElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;carRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGPathElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SVGSVGElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sectionRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useRef&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;yPercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;xPercent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;section&lt;/span&gt;
      &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;py-16 px-4 md:px-2 bg-secondary w-full&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;sectionRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`max-w-[1250px] w-full mx-auto relative mt-16 mb-20`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;svg&lt;/span&gt;
          &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;462&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;viewBox&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0 0 462 844&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;xmlns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://www.w3.org/2000/svg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;w-full h-full overflow-visible&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M36.4996 18.9999L429.5 253C449.666 265 479 299.9 435 343.5C391 387.1 151 495.333 36.4996 544C12.1662 560.167 -21.9004 602.7 36.4996 643.5C94.8996 684.3 326.5 791.167 435 839.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;stroke&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0000FF&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;strokeWidth&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;
            &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;M45.5126 32.8551L52.6609 27.8605C52.8849 27.7015 53.0143 27.5011 53.0633 27.281L68.7632 27.281C71.7233 27.281 74.1201 25.6064 74.1201 23.5405V10.4414C74.1201 8.37307 71.7233 6.69838 68.7632 6.69838L53.0633 6.69838C53.0143 6.4808 52.8849 6.27788 52.6609 6.11897L45.5126 1.12674C44.8442 0.659786 43.6511 0.740459 42.8393 1.3052C42.0311 1.87239 41.9156 2.70852 42.5804 3.17547L47.6259 6.69838L32.9163 6.69838C29.9596 6.69838 27.5593 8.37307 27.5593 10.4414L27.5593 23.5405C27.5593 25.6064 29.9596 27.281 32.9163 27.281L47.6259 27.281L42.5804 30.8088C41.9156 31.2734 42.0311 32.107 42.8393 32.6742C43.6511 33.239 44.8442 33.3196 45.5126 32.8551ZM53.8296 10.3485V11.4388L41.7337 11.4388V10.3485L53.8296 10.3485ZM33.6545 10.3485L38.6546 11.4388L38.6546 22.5406L33.6545 23.6334L33.6545 10.3485ZM41.7337 23.6334V22.5406L53.8296 22.5406L53.8296 23.6334L41.7337 23.6334ZM56.8632 22.5406V11.4388L61.8632 10.3485L61.8632 23.6334L56.8632 22.5406Z&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="nx"&gt;fill&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#E52A2D&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/svg&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/section&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;PathAnimation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, the only thing remaining is the ignition of the engine and letting the car move.&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating animation timelines
&lt;/h3&gt;

&lt;p&gt;It's time to use &lt;code&gt;useGSAP&lt;/code&gt; hook provided by gsap to create an animation timeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useGSAP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;contextSafe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;tl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeline&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;

      &lt;span class="nx"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;motionPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;power1.inOut&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above timeline is a basic timeline. If you want to dive deep into the &lt;code&gt;useGSAP&lt;/code&gt; hook then I recommend this &lt;a href="https://gsap.com/resources/React/" rel="noopener noreferrer"&gt;official documentation&lt;/a&gt;. Allow me to simplify further.&lt;/p&gt;

&lt;p&gt;First, we are creating a timeline with &lt;code&gt;gsap.timeline({})&lt;/code&gt; and we're passing empty object because we don't want to pass anything right now (we'll do in a few seconds). Then the timeline is stored in &lt;code&gt;tl&lt;/code&gt; variable, tl is short for the timeline. We're storing the timeline on a variable to easily access the timeline in the future.&lt;/p&gt;

&lt;p&gt;Then, we're passing the actual props to animate the stuff. The animation is targeted to the car path, we're using &lt;code&gt;carRef&lt;/code&gt; to point to our car. Then, we're proving motionPath, inside of the motionPath, we can provide the path (along which the car moves) and another path (along which the car aligns).&lt;/p&gt;

&lt;p&gt;At the end, we're providing the scope also. It's helpful when you've multiple animations and you don't want to mess up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now, let's make a final timeline.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useGSAP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;contextSafe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;tl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;gsap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timeline&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;scrollTrigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;sectionRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;scrub&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;top center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;bottom center&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;

      &lt;span class="nx"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;carRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;motionPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;lineRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;alignOrigin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
          &lt;span class="na"&gt;autoRotate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;power1.inOut&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;});&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;tl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we're triggering the animation on scroll with &lt;code&gt;scrollTrigger&lt;/code&gt;. Inside scrollTrigger, we're passing a trigger prop; trigger prop is used to identify by with element the animation is going to trigger. Here we're triggering or starting the animation when the section is scrolled halfway to the screen from the top and stops when the bottom end of the section goes halfway through the screen. &lt;code&gt;scrub&lt;/code&gt; is set true to allow animation to take place both forward and backward.&lt;/p&gt;

&lt;p&gt;Next, we're aligning the car to perfectly center in that path and also allowing the car to &lt;code&gt;autoRotate&lt;/code&gt; so that the car makes a smooth turn. And, you can add a lot of transitions. Choose the one that suits you best.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, you learned how to create SVG path animations using GSAP in a Next.js project. We covered setting up the development environment, installing necessary packages, creating and importing SVG graphics, and integrating GSAP for smooth animations triggered by scroll events. By the end, you have a car following a path on your webpage, showcasing the power of SVG and GSAP animations.&lt;/p&gt;

&lt;p&gt;I would like to end this article with a few resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GitHub repository -&amp;gt; &lt;a href="https://github.com/aashishpanthi/svg-path-animation" rel="noopener noreferrer"&gt;https://github.com/aashishpanthi/svg-path-animation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CodeSandBox -&amp;gt; &lt;a href="https://codesandbox.io/p/devbox/svg-path-animation-4d2k2v" rel="noopener noreferrer"&gt;https://codesandbox.io/p/github/aashishpanthi/svg-path-animation/main&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gsap</category>
      <category>nextjs</category>
      <category>animation</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Introducing Lootle - for MongoDB Atlas Hackathon</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Thu, 08 Dec 2022 16:42:47 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/introducing-lootle-for-mongodb-atlas-hackathon-5f9n</link>
      <guid>https://dev.to/aashishpanthi/introducing-lootle-for-mongodb-atlas-hackathon-5f9n</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;Lootle -&amp;gt; (loot-le) is a website and MIT license open source project where you can keep track of the price of your MacBook or of your favorite Raspberry Pi or the stock price of Microsoft. You just enter the URL of the product/stock then the website keeps the history of the price fluctuation, presents it to you, and even notifies via email you when the price drops down that you specified.&lt;/p&gt;

&lt;h3&gt;
  
  
  Category Submission:
&lt;/h3&gt;

&lt;p&gt;Choose Your Own Adventure&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

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

&lt;h2&gt;
  
  
  Video Overview
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/R_GvQFZ8CIc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Home page
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2jh3tmxpxnzk7yy1v0cx.png" alt="Landing page lootle.live" width="800" height="439"&gt;
&lt;/li&gt;
&lt;li&gt;Dashboard
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F277ds1l5giilgfo1dbn5.png" alt="Lootle.live dashboard tracks" width="800" height="439"&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Product detailed view with graph&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylsp0ynr88690hyb0g01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fylsp0ynr88690hyb0g01.png" alt="Product detailed view lootle.live" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Email notification for stock price&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd65f7potsnvmb4xygu0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd65f7potsnvmb4xygu0v.png" alt="Email notification for lootle.live" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Email notification for product price drop&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx07fp388oc1iq5bwpfis.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx07fp388oc1iq5bwpfis.png" alt="Email notification of lootle.live" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;MongoDB Atlas Stats&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1i25heca0q150tgja6ld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1i25heca0q150tgja6ld.png" alt="Mongodb Atlas" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;The app checks the price of the product specified. Not only it checks the price, it extracts the name and information of the product from the website. It gathers information on a regular interval of fiveteen minutes and stores inside of the database. If the current price is found to be less than the specified price by the user then, the user will be updated with an email. And the user can also check the history of the price fluctuation through the nice little dashboard.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tech stack 👩‍💻
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reactjs&lt;/strong&gt; -&amp;gt; For frontend&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MongoDB Atlas&lt;/strong&gt; -&amp;gt; For mongoDB database&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Express.js&lt;/strong&gt; -&amp;gt; For API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Digital Ocean&lt;/strong&gt; -&amp;gt; Deployment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Puppeteer/Cheerio&lt;/strong&gt; -&amp;gt; Getting Price&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nodemailer&lt;/strong&gt; -&amp;gt; To send email&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;All source code of frontend, backend and bot in same repository:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/aashishpanthi" rel="noopener noreferrer"&gt;
        aashishpanthi
      &lt;/a&gt; / &lt;a href="https://github.com/aashishpanthi/lootle.live" rel="noopener noreferrer"&gt;
        lootle.live
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Amazon, Flipkart, and Daraz product's price tracker and Stock price on CNBC tracker
    &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;h1 class="heading-element"&gt;lootle&lt;/h1&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Project introduction&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Lootle&lt;/strong&gt; -&amp;gt; &lt;em&gt;(loot-le)&lt;/em&gt; is a website and MIT license open source project where you can keep track of the price of your MacBook or of your favorite Raspberry Pi or the stock price of Microsoft. You just enter the URL of the product/stock then the website keeps the history of the price fluctuation, presents it to you, and even notifies you when the price drops down that you specified.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Functions ⚒&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Oh, we haven't discussed much on the functions of the website 😅. It checks the price of the product specified. Not only it checks the price, it extracts the name and information of the product from the website. It gathers information on a regular interval of fiveteen minutes and stores inside of the database. If the current price is found to be less than the specified price by the user then, the user will be updated…&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/aashishpanthi/lootle.live" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Permissive License
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/aashishpanthi/lootle.live/blob/main/LICENSE" rel="noopener noreferrer"&gt;MIT&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;The irretation of checking the price constanly in ecommerce store is the motivation behind this project. To eliminate this process and rather automate the process, I built this web app. And further I am planning to release it as browser extension.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I built it
&lt;/h3&gt;

&lt;p&gt;It is not my first time using mongoDB. I have already built few projects using mongoDB (MongoDB Atlas to be more specific). But learning never stops. I didn't know that mongoDB provides change streams but when I come to know I had to try it once. I have tried it in the app to send push notification whenever price drops. But I felt like sending notification may look spammy so I choose the option to mail where I can send a detail description of the product with the interactive elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Currently supported sites:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://flipkart.com" rel="noopener noreferrer"&gt;Flipkart.com&lt;/a&gt; for available products only&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://amazon.com" rel="noopener noreferrer"&gt;Amazon.com&lt;/a&gt; for available products only&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://amazon.co.uk" rel="noopener noreferrer"&gt;Amazon.co.uk&lt;/a&gt; for available products only&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://amazon.in" rel="noopener noreferrer"&gt;Amazon.in&lt;/a&gt; for available products only&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://cnbc.com" rel="noopener noreferrer"&gt;cnbc.com&lt;/a&gt; for stock price&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://daraz.com.np" rel="noopener noreferrer"&gt;daraz.com.np&lt;/a&gt; for available products only&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Important links 🔗
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://github.com/aashishpanthi/lootle.live" rel="noopener noreferrer"&gt;GitHub repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://lootle.live" rel="noopener noreferrer"&gt;Website&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Introducing juhu - an open source search engine</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Mon, 29 Aug 2022 17:10:29 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/introducing-juhu-an-open-source-search-engine-268i</link>
      <guid>https://dev.to/aashishpanthi/introducing-juhu-an-open-source-search-engine-268i</guid>
      <description>&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;Juhu is an open-source search engine that is built using Nodejs and Redis database. As you have already guessed the use case scenario of the website. Why not try on your own, &lt;a href="http://143.198.136.81/search?q=elon%20musk" rel="noopener noreferrer"&gt;Search for Elon Musk&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was always curious to know about how search engine are built and most importantly how SEO is done. Throught the journey of building the new search engine, I have learnt a lot of things about how the data should be displayed on the website, what are the HTML tags needed to make the crawler understand what your website is all about. Also, using a pre-styled HTML elements (built for the specific purpose) are better than using a CSS to style the elements later.&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;MEAN/MERN Mavericks &lt;em&gt;Yes, I have used MERN, also replaced M with R, I mean I have used redis as a primary database&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Video Explainer of My Project
&lt;/h3&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/a2KDXRHfrqA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Used:
&lt;/h3&gt;

&lt;p&gt;I have used Javascript as a primary language and Nodejs as a runtime environment. I have used different libraries/packages to build this application. Some of them are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Puppetter&lt;/strong&gt; -&amp;gt; I have used this automation tool to scrape the websie&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redis OM&lt;/strong&gt; -&amp;gt; Used to interact with redis services (Redis search/ JSON database)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Express&lt;/strong&gt; -&amp;gt; To create server&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React&lt;/strong&gt; -&amp;gt; To create client side (frontend)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mongoose&lt;/strong&gt; -&amp;gt; To use secondary database (MongoDB)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;

&lt;p&gt;The MERN application repository:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/aashishpanthi" rel="noopener noreferrer"&gt;
        aashishpanthi
      &lt;/a&gt; / &lt;a href="https://github.com/aashishpanthi/search-engine" rel="noopener noreferrer"&gt;
        search-engine
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      This is an open source search engine built using redis and puppeteer
    &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;h1 class="heading-element"&gt;Juhu - search engine&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Juhu is an open source search engine that doesn't track users and id fully customizable.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/60884239/187238474-58389c1e-0a40-44ef-a9c6-cc973298f4cc.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F60884239%2F187238474-58389c1e-0a40-44ef-a9c6-cc973298f4cc.png" alt="home page"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/60884239/187239207-8bf91d3f-97f7-4720-822f-14178c69ed44.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F60884239%2F187239207-8bf91d3f-97f7-4720-822f-14178c69ed44.png" alt="juhu search result"&gt;&lt;/a&gt;
&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/60884239/187238929-203137d1-0146-4ba7-9caa-d5b3c89f54b0.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F60884239%2F187238929-203137d1-0146-4ba7-9caa-d5b3c89f54b0.png" alt="juhu image search"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Overview video&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;Here's a short video that explains the project and how it uses Redis:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=a2KDXRHfrqA" rel="nofollow noopener noreferrer"&gt;My submission video&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How it works&lt;/h2&gt;
&lt;/div&gt;
&lt;p&gt;Firstly of all a bot is used to run through different websites and that bot checks if the url is allowed to crawl or not. If able to crawl, it means it is able to be indexed. So, the bot scrapes the data from that website. Filters the data and stores in a form that it will be easier to search and index the scraped data. I want to attach a little architecture diagram here to clear out the things I said:
&lt;a rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/60884239/187257511-a66aa549-1f74-4d56-87fe-8302a618b4ad.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuser-images.githubusercontent.com%2F60884239%2F187257511-a66aa549-1f74-4d56-87fe-8302a618b4ad.png" alt="Juhu architecture"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;How the data is stored:&lt;/h3&gt;

&lt;/div&gt;
&lt;p&gt;First of all, our server needs to be connected with the redis database. This is a long code but it works :).&lt;/p&gt;
&lt;div class="highlight highlight-source-js notranslate position-relative overflow-auto js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-k"&gt;import&lt;/span&gt;&lt;/pre&gt;…
&lt;/div&gt;
&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/aashishpanthi/search-engine" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;The bot repository:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/aashishpanthi" rel="noopener noreferrer"&gt;
        aashishpanthi
      &lt;/a&gt; / &lt;a href="https://github.com/aashishpanthi/web-crawler" rel="noopener noreferrer"&gt;
        web-crawler
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &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;h1 class="heading-element"&gt;Web-crawler&lt;/h1&gt;

&lt;/div&gt;
&lt;p&gt;This is a web crawler made using puppeteer library in javascript. It visists different websites, scrapes the information and stores the information inside of a database which can be accessed by the search engine.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/aashishpanthi/web-crawler" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h3&gt;
  
  
  Architecture:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqfqs2xtwe4j8xop8era.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqfqs2xtwe4j8xop8era.png" alt="Juhu architecture" width="800" height="335"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/aashishpanthi/web-crawler" rel="noopener noreferrer"&gt;Web crawler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/aashishpanthi/search-engine" rel="noopener noreferrer"&gt;MERN app&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://143.198.136.81/" rel="noopener noreferrer"&gt;Website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Some Screenshots of the website
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Home page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0su25mcg3i7s04jkj2rk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0su25mcg3i7s04jkj2rk.png" alt="Home juhu" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Text Result (Search result) page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuct9l9vazzcmz3pcwoi2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuct9l9vazzcmz3pcwoi2.png" alt="Search result" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image result (Search result) page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6di0byujk1ghfxdb31z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz6di0byujk1ghfxdb31z.png" alt="Image search result" width="800" height="441"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/roshanacharya"&gt;@roshanacharya&lt;/a&gt; and me &lt;a class="mentioned-user" href="https://dev.to/aashishpanthi"&gt;@aashishpanthi&lt;/a&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries" rel="noopener noreferrer"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight" rel="noopener noreferrer"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to" rel="noopener noreferrer"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
      <category>javascript</category>
      <category>bot</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The YouTube learning trap</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Tue, 17 May 2022 17:01:00 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/the-youtube-learning-trap-57np</link>
      <guid>https://dev.to/aashishpanthi/the-youtube-learning-trap-57np</guid>
      <description>&lt;p&gt;Ok, quick questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;What was the educational video you searched for?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;How many educational videos you've watched after finishing that video?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What is the ratio of educational and entertainment videos shown on your home feed?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The answer to the first question varies from person to person. But for the second and third questions, there should be an exact number. I have noticed for a while and found out I get boar after watching 2-3 educational videos in a row, which means I've only watched 2 or 3 educational videos after searching for an educational video. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Here, the educational video maybe a tutorial on how to make a todo app or a complete course on java, or perhaps it is a video explaining a physics concept.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Suppose I have to answer the third question. In that case, the ratio for an educational video to the entertainment or other form of content is 1:4 which basically means youtube recommends only 25% of videos from which I can gain knowledge and leave youtube with satisfaction. &lt;/p&gt;

&lt;p&gt;Maybe you don't see the problem with the above segment and think that after all YouTube is there to generate a lot of profit and it is going to push content that keeps viewers to their platform, I think Google is that clever. Yes, it is a fact and we are also familiar that YouTube does this. &lt;strong&gt;But at the same time, content on YouTube is free&lt;/strong&gt; and many people made their six-figure income after learning mostly from YouTube if not all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why YouTube is free? 💸
&lt;/h2&gt;

&lt;p&gt;If you don't have a youtube premium account then you need to watch a lot of ads. And YouTube Premium is not also available in most countries. So, one thing I want to clear out from your mind is that &lt;strong&gt;YouTube isn't free&lt;/strong&gt;. YouTube will eventually squeeze out all of its revenue from its viewers. And &lt;strong&gt;YouTube costs your time&lt;/strong&gt;, YouTube is free when you look at it from the perspective of money but if you really value your time then you know YouTube costs time, a lot of time.&lt;/p&gt;

&lt;p&gt;Let me share with you my personal statistics, YouTube is opened in at least one of my tabs when I use a laptop no matter if I am learning a new programming language or just a new concept. It is there to help me and to be fair, it does its job quite well. And I also have a habit of listening to songs while coding, and I prefer to use YouTube. Again, not many subscription services are available in my country, so I cannot pay for Spotify even if I wish. So I am totally inside of a YouTube ecosystem. Learning a new thing, listening to music, getting some entertainment, and sometimes getting news(from some independent creators) in all these cases, YouTube is there with me every second.&lt;/p&gt;

&lt;p&gt;Things could be different for you but a thing that I learned from my own experiences it that if YouTube is there for me to help me with every task then I am spending almost all my day on YouTube. That's where YouTube gets an opportunity. When I am watching some knowledgeable content, it recommends me 7-8 videos at the side, some are related to the content I am consuming while others have no relation to the content I am watching right now. Usually, these contents are entertainment contents and we tend to be satisfied with the time we spent on YouTube but inner us knows what we were there for and what we received from there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Satisfaction trap🎃
&lt;/h2&gt;

&lt;p&gt;You are watching a video on &lt;strong&gt;how to make a responsive navbar using HTML and CSS&lt;/strong&gt;, you see on the right side of the video there are a lot of videos related to either the same topic or a totally different topic. In most of the cases, you'll be recommended with a video titled &lt;strong&gt;how I got into FAANG without a degree&lt;/strong&gt; or &lt;strong&gt;how I earn millions of dollars freelancing&lt;/strong&gt; or a video talking about &lt;strong&gt;the best way to learn programming&lt;/strong&gt;. Sometimes YouTube also recommends &lt;strong&gt;why coding is not for everyone&lt;/strong&gt;, even if you are learning how to code.&lt;/p&gt;

&lt;p&gt;90% of the time, you will click these videos. I can guarantee you that you haven't still finished making that navbar, but you have watched that distracting video for more than half of its length. Now you fall into the trap, the trap of satisfaction. You think that you knew about &lt;strong&gt;a developer's life in silicon valley&lt;/strong&gt; or &lt;strong&gt;how a developer made millions of dollars after learning on his own&lt;/strong&gt;. You feel like you gained much the value out of your invested time on YouTube but now is the time to reflect back on you and your plan of opening YouTube. You find that you were there to learn about how to make a navbar but at the end of the day you have watched 20 videos and still, your navbar is incomplete. That is what I call a satisfaction trap. &lt;/p&gt;

&lt;p&gt;And I admit that I fell into this trap when I was very new to code. I used to watch a lot of these videos and start comparing myself with these developers. That is where you start procrastinating.&lt;/p&gt;

&lt;h2&gt;
  
  
  YouTube's algorithm 👨‍💻
&lt;/h2&gt;

&lt;p&gt;Why YouTube was initially developed? Of course to share videos. Starting from just a video-sharing platform to the second most popular search engine, YouTube has come a long way. And I am sure in this long journey, the business strategy of YouTube must have been changed. The algorithm is designed in such a way that if a video keeps viewers on its platform, push it further to more audiences. And in the middle of this, educational videos suffer to gain enough views.&lt;/p&gt;

&lt;p&gt;If there are fewer views, or if viewers are leaving the video in the middle of it, why would YouTube's algorithm push that video? That is the reason why my home feed is filled with entertainment-related videos, not educational videos. And I say &lt;strong&gt;YouTube's algorithm is not made for educational videos&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If you have come this far, I want you to ask yourself some more questions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Why did you choose YouTube for learning?&lt;/li&gt;
&lt;li&gt;How much time on average do you spend on YouTube and how much you are satisfied with your time investment? If you haven't thought of it, it is the best time to consider this question.&lt;/li&gt;
&lt;li&gt;Do you really need YouTube videos to learn that thing or can you get the same level of knowledge from blogs or other documentation?&lt;/li&gt;
&lt;li&gt;Why YouTube would care about you?&lt;/li&gt;
&lt;li&gt;Can't you watch the same video in its embedded form from other websites?&lt;/li&gt;
&lt;li&gt;Is your learning passive or active?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Recently, I don't depend upon YouTube videos. Mainly because I don't find my exact requirement. But I find that on official documentation or a blog written by some random guy. Embedded youtube videos are helpful as we cannot find dozens of videos on its side. And while I am reading blogs, I am actively learning, it's not like I am sitting on a sofa and watching a tutorial and grabbing a handful of popcorn. While reading, I need to interact with the website, I need to scroll and I need to test the code myself. When I am learning the same thing outside from YouTube, I tend to lose 20% less time on things that I don't want and don't like.&lt;/p&gt;

&lt;p&gt;If you have got any solutions that can help anyone in this trap to get out it, I would be more than happy to hear about that.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>discuss</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Is Microsoft getting evil ?</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Sun, 06 Feb 2022 04:59:51 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/is-microsoft-getting-evil--2dag</link>
      <guid>https://dev.to/aashishpanthi/is-microsoft-getting-evil--2dag</guid>
      <description>&lt;p&gt;I don't know how many of you are gonna agree with me. It's fine if you don't agree with what I say, leave your personal opinion in comment below and its time to discuss dear folks.&lt;/p&gt;

&lt;p&gt;Miscrosoft is releasing differnt tools that are making lifes of developer slightly better, if not better. So, what are the tools ?&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub Copilot
&lt;/h2&gt;

&lt;p&gt;I don't know where do you live if you haven't heard about GitHub copilot. It is your AI pair programmer(at least, that is what I saw on the &lt;a href="https://copilot.github.com/" rel="noopener noreferrer"&gt;homepage&lt;/a&gt; of it).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhefv5zfj2muau7u4uu26.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhefv5zfj2muau7u4uu26.png" alt="GitHub coplilot" width="800" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have tested this myself and it recommends pretty good suggests(most of the time). And it isn't still released to all.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub
&lt;/h2&gt;

&lt;p&gt;Why GitHub is being so nice to all of us? We can create as many repositories in our GitHub, make them public or private. And that is all for free. And now we hear the news, the company is training copilot with the code available in public repositories. And we know what GitHub did with 'color' and 'faker' libraries. But I think GitHub is a really good product, what do think ?&lt;/p&gt;

&lt;h2&gt;
  
  
  Sketch2code
&lt;/h2&gt;

&lt;p&gt;Ok, this is fairly the new one (I heard a month ago) and most of you don't have any idea about what it is. &lt;a href="https://sketch2code.azurewebsites.net/" rel="noopener noreferrer"&gt;Sketch2code&lt;/a&gt; converts your handsdrawn diagram into code (I am not saying that, &lt;a href="https://docs.microsoft.com/en-us/shows/ai-show/sketch2code" rel="noopener noreferrer"&gt;Microsoft itself&lt;/a&gt; said that). But I have tested it and all I was left with is "what!". I mean how microsoft misebrely failed to convert my drawing into code. But it worked perfectly fine with the example provided in the website itself.&lt;/p&gt;

&lt;p&gt;Feel free to leave your own opinion.....&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>microsoft</category>
      <category>github</category>
      <category>programming</category>
    </item>
    <item>
      <title>What if you get access to GutHub copilot</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Tue, 01 Feb 2022 08:52:40 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/what-if-you-get-access-to-guthub-copilot-21hp</link>
      <guid>https://dev.to/aashishpanthi/what-if-you-get-access-to-guthub-copilot-21hp</guid>
      <description>&lt;p&gt;GitHub copilot is only available to some peoples as it is not released completely. If you haven't signed up, you should do it now because you get access after a month. Visit &lt;a href="https://github.com/features/copilot/signup" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I want to ask you all guys a question. What will you ask GitHub copilot to do if you get access to it?&lt;/p&gt;

&lt;p&gt;Funny, serious, any type of idea is accepted in comment section👇.&lt;/p&gt;

</description>
      <category>github</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Please suggest me an idea</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Tue, 11 Jan 2022 15:01:21 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/please-suggest-me-an-idea-1ghi</link>
      <guid>https://dev.to/aashishpanthi/please-suggest-me-an-idea-1ghi</guid>
      <description>&lt;p&gt;I want to start a startup with my friends but lacking ideas. Any suggestions will be accepted. Please comment below:&lt;/p&gt;

</description>
      <category>help</category>
      <category>mobile</category>
      <category>startup</category>
      <category>career</category>
    </item>
    <item>
      <title>Zorin - The best OS for students</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Thu, 30 Dec 2021 06:16:29 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/zorin-the-best-os-for-students-5eel</link>
      <guid>https://dev.to/aashishpanthi/zorin-the-best-os-for-students-5eel</guid>
      <description>&lt;p&gt;&lt;strong&gt;The best Linux distribution for students is Zorin.&lt;/strong&gt; I know this is a bold statement but I've come to this conclusion after using it. Let me tell you why I'm saying such.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Zorin OS
&lt;/h3&gt;

&lt;p&gt;Zorin OS is a ubuntu-based Linux distribution. According to the &lt;a href="https://zorin.com/" rel="noopener noreferrer"&gt;official website of Zorin&lt;/a&gt;, "It is the alternative to Windows and macOS designed to make your computer faster, more powerful, secure, and privacy-respecting."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are these all claims worth saying?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I have divided it into different categories and here they are:&lt;/p&gt;

&lt;h3&gt;
  
  
  Looks (UI):
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodstlksf6yrbekdokduv.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fodstlksf6yrbekdokduv.JPG" alt="Zorin OS desktop look" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Talking about the user interface, Zorin is gorgeous. Just look at the desktop, it is clean and so superior. When you use it, you get quite the same experience as Windows 7 but better. If you are a windows user then you will be pretty familiar with this OS in a day. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F162im8p6n5qmrb93jijf.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F162im8p6n5qmrb93jijf.JPG" alt="File manager of Zorin OS" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It has a really polished file manager to organize your school or work projects. It makes us easy to organize the files in just a right way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdoxmpnj7177v24x28h7.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdoxmpnj7177v24x28h7.JPG" alt="Zorin appereances" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Customization has been a great part of Linux distributions. But Zorin takes it to next level with excellent customization options. Using Zorin appearance, you can change the layout, themes, fonts, panels and you name it. Zorin OS absolutely kills it in the looks department.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hardware requirements:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faznkh845wim7d0j4gu90.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faznkh845wim7d0j4gu90.png" alt="Zorin os system requirements" width="800" height="613"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zorin OS is not that resource-hungry when you compare it with pop os or other similar operating systems. Actually, they've especially designed a &lt;a href="https://zorin.com/os/download/16/lite" rel="noopener noreferrer"&gt;light version&lt;/a&gt; for the old computers and they claim, it can be run on any devices that were manufactured in the &lt;strong&gt;past 15 years&lt;/strong&gt;. This is a huge claim but I've personally tested the lite version on my old PC. After installing Zorin lite, it works fine for me. You can run the lite version on a PC with 1GB RAM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Education edition:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwjhm5uom3oyek6c3239.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzwjhm5uom3oyek6c3239.JPG" alt="Zorin education" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zorin team has created &lt;a href="https://zorin.com/os/education/" rel="noopener noreferrer"&gt;Zorin OS Education&lt;/a&gt; with a huge library of educational apps and games. Zorin OS Education includes powerful and engaging tools that help you to teach coding and engineering. And if you are a student, you have a huge advantage over thousands of apps specially designed for students. They have very engaging software that helps you to learn anything quite faster and effectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Huge app resources
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fto69zf8tklqetwpk0mo5.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fto69zf8tklqetwpk0mo5.JPG" alt="Zorin Software store" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zorin OS has thousands of apps in its app store. Unlike the Microsoft store, you don't need to download software from untrusted sites, double click and install. Nearly all software is available in the software store of Zorin. There is huge complexity that has been hidden inside the clean and polished UI of the software store. Zorin uses software from three different software providers but keeps them in one place so you don't need to worry about anything.&lt;/p&gt;

&lt;h3&gt;
  
  
  It's free
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsjseifn1uc3ws0mjwy2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frsjseifn1uc3ws0mjwy2.png" alt="Zorin is free" width="800" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yes, the pro edition costs $39 but it's for the support you'll get from the Zorin team. But there are other editions, core, education, and lite that costs nothing. As a student, you may need to use PowerPoint, word, excel, and a bunch of other software which cost a lot. Well, you find many alternatives like &lt;a href="https://www.libreoffice.org/" rel="noopener noreferrer"&gt;libre office&lt;/a&gt;, &lt;a href="http://www.openoffice.org/" rel="noopener noreferrer"&gt;OpenOffice&lt;/a&gt; which are completely free. And of course, there is a major one &lt;a href="https://docs.google.com/document/u/0/" rel="noopener noreferrer"&gt;google docs&lt;/a&gt; which is like a gem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Other features
&lt;/h3&gt;

&lt;p&gt;With Zorin, you get Zorin connect which helps you to connect with your mobile phone easily and securely and get all of your notifications right into your desktop. And you have the advantage of controlling your computer remotely with your phone. With Zorin 16, you can run windows files with .exe and .msi extension directly on your computer. Yes, it is possible to run Windows apps in Linux with wine but the process is very frustrating. But Zorin handles it so perfectly that Linux newcomers don't need to get overwhelmed with the complicated process.&lt;/p&gt;

&lt;p&gt;There are a lot of other gorgeous and powerful Linux distros. But if you are a student, you may now know why to choose Zorin. The last message I want to give you is &lt;strong&gt;TRY ZORIN ONCE&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>productivity</category>
      <category>news</category>
    </item>
    <item>
      <title>3 easy ways to install nodejs in linux</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Tue, 23 Nov 2021 16:40:40 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4</link>
      <guid>https://dev.to/aashishpanthi/3-easy-ways-to-install-nodejs-in-linux-lc4</guid>
      <description>&lt;p&gt;Installing node in linux is quite challenging sometimes, especially if you are a beginner and don't have any idea on how to do that.&lt;/p&gt;

&lt;p&gt;In this article, I will show you three different ways of installing Nodejs in linux. You can feel comfortable following the same process in any ubuntu-baseds distro you use.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Installation using apt package manager
&lt;/h2&gt;

&lt;p&gt;Installation of Nodejs is insanely easy with apt package manager in linux. To install nodejs with apt package manager, just open up your terminal. Copy this command &lt;code&gt;sudo apt update  &amp;amp;&amp;amp; sudo apt upgrade&lt;/code&gt; and paste here, hit enter, and type your password. Then we use the command &lt;code&gt;sudo apt install nodejs&lt;/code&gt;, press enter, wait few seconds and you find your nodejs is successfully installed. To check the version just type the command &lt;code&gt;node —version&lt;/code&gt; and you get the version. &lt;/p&gt;

&lt;h2&gt;
  
  
  2. Installation with Linux Binaries
&lt;/h2&gt;

&lt;p&gt;To install linux binaries, just open up your browser and head over to &lt;a href="https://nodejs.org/" rel="noopener noreferrer"&gt;nodejs.org&lt;/a&gt;. Click on &lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;downloads tab&lt;/a&gt; then choose linux binaries. After the download is completed, go to the directory where you've downloaded your nodejs. Then extract the tar file by right-clicking on it and click on extract here.&lt;/p&gt;

&lt;p&gt;You'll have all the necessary folders here. Now, right-click and open the terminal here. Here we have to copy some folders from this directory(downloads) to our user(/user) directory. Copy this command &lt;code&gt;sudo cp -r ./{lib,share,include,bin} /usr&lt;/code&gt;, paste it here, and hit enter. Then type your password and your nodejs is installed. If you verify if it’s actually installed or not. You can use the same command &lt;code&gt;node --version&lt;/code&gt; and you get the nodejs version and &lt;code&gt;npm --version&lt;/code&gt; returns the npm version.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Installation using NVM
&lt;/h2&gt;

&lt;p&gt;If you’re wondering what this NVM is then it’s a node version manager which helps us to easily install and switch between different versions of node.&lt;br&gt;
Actually installing NVM is also simple. We can directly install NVM using curl but in some cases, you may run into a problem. So, to avoid such problems just create some files with this command &lt;code&gt;touch ~/.bash_profile ~/.bashrc ~/.zshrc ~/.profile&lt;/code&gt;. Again run the following command &lt;code&gt;curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash&lt;/code&gt; or this one &lt;code&gt;wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash&lt;/code&gt;. It's your choice but either of them downloads a script and runs it. Press enter and if it looks like you don't have curl installed. You can simply install the curl with the command &lt;code&gt;sudo apt install curl&lt;/code&gt; and rerun that command again. To check if nvm has been installed or not, you need to restart the terminal so close the active one, and open a new one. Check the version with command &lt;code&gt;nvm --version&lt;/code&gt; and if it returns the version then you have your NVM ready to use. And there are a lot of commands waiting for you to use them. One of them is &lt;code&gt;nvm ls&lt;/code&gt; which lists all of the installed nodejs versions on your system. Then we have &lt;code&gt;nvm ls-remote&lt;/code&gt; which basically lists all of the nodejs versions available till now. There will bw few LTS versions also in there but if we only want to install the latest LTS i.e 14.x (at the time of writing this article). Again to install nodejs, we have the simple command &lt;code&gt;nvm install node&lt;/code&gt; which installs the latest release of nodejs but if we want to install some specific versions then instead of the node we give the version of nodejs that we want to install. In this case, it is &lt;strong&gt;14.18.0&lt;/strong&gt;.  Press enter and it will download and install our desired version of the node. You can verify if it is installed or not by checking the version of nodejs.&lt;/p&gt;

&lt;p&gt;You can install as many versions of the node you want on your computer. If you want to switch to nodejs version n from version m then there is indeed an easy way to switch between them with the command &lt;code&gt;nvm use version_of_node&lt;/code&gt;. In this case, it's v14.18.0, hit enter and you can verify again by checking the version of nodejs. And you can also check the version of npm.&lt;/p&gt;

&lt;p&gt;Those were the ways you can install nodejs with. Watch &lt;a href="https://youtu.be/82xn_-MiVOM" rel="noopener noreferrer"&gt;this video&lt;/a&gt; fully for the detailed information:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/82xn_-MiVOM"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>linux</category>
    </item>
    <item>
      <title>setTimeout is not a part of JavaScipt, why ?</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Tue, 31 Aug 2021 10:38:48 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/settimeout-is-not-a-part-of-javascipt-why-222j</link>
      <guid>https://dev.to/aashishpanthi/settimeout-is-not-a-part-of-javascipt-why-222j</guid>
      <description>&lt;p&gt;Maybe you think setTimeout like this -: &lt;strong&gt;The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.&lt;/strong&gt; it's true, but let's dive deeper.&lt;/p&gt;

&lt;p&gt;There aren't any methods like &lt;code&gt;setTimeout()&lt;/code&gt; or &lt;code&gt;setInterval()&lt;/code&gt; in JavaScript. They are not provided by the JavaScript engine itself but they are provided by browser as part of the window object. Let's break it down: &lt;/p&gt;

&lt;p&gt;If javascript doesn't provide &lt;code&gt;setInterval()&lt;/code&gt; and &lt;code&gt;setTimeout()&lt;/code&gt; but when we run our javascript code which also contains &lt;strong&gt;setTImeout&lt;/strong&gt;  it works perfectly fine. Yes, that's the real problem. Many people know how to use and they don't have any idea about what's going on under the hood. Before knowing about windows object, let's look at web APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web APIs
&lt;/h3&gt;

&lt;p&gt;A browser can perform many tasks like getting user's location, turning on/off bluetooth, storage tasks, timer related tasks and many more. And we as a developers need these things. So, all these things can be accessed by JavaScript via Web APIs. That's it, now we have all these things inside one place and that place is window object.&lt;/p&gt;

&lt;h4&gt;
  
  
  Some web APIs:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;localStorage&lt;/li&gt;
&lt;li&gt;setTimeout()&lt;/li&gt;
&lt;li&gt;console&lt;/li&gt;
&lt;li&gt;DOM APIs&lt;/li&gt;
&lt;li&gt;fetch()&lt;/li&gt;
&lt;li&gt;location&lt;/li&gt;
&lt;li&gt;alert()&lt;/li&gt;
&lt;li&gt;and &lt;a href="https://developer.chrome.com/docs/apps/api_other/" rel="noopener noreferrer"&gt;others&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If &lt;code&gt;setTimeout()&lt;/code&gt; is present inside &lt;code&gt;window&lt;/code&gt; object then why we don't write like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Timer finished&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead we write without &lt;code&gt;window&lt;/code&gt; object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Timer finished&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;window&lt;/code&gt; is a global object and &lt;code&gt;setTimeout()&lt;/code&gt; is present inside global object(at global scope), so we can access &lt;code&gt;setTimeout()&lt;/code&gt; without &lt;code&gt;window&lt;/code&gt; object. Not only with &lt;code&gt;setTimeout()&lt;/code&gt;, we don't need to write &lt;code&gt;window&lt;/code&gt; object to access &lt;code&gt;alert&lt;/code&gt;, &lt;code&gt;localstorage&lt;/code&gt;, and other web APIs.&lt;/p&gt;

&lt;p&gt;Far by we've discussed that the browser provides web APIs, so we can use the things like&lt;code&gt;setTimeout()&lt;/code&gt; but nodejs is not a browser. Then how is it possible to access &lt;code&gt;setTimeout()&lt;/code&gt; in node. Well, we don't have &lt;code&gt;window&lt;/code&gt; object available while working with node. But we can still access &lt;code&gt;setTimeout()&lt;/code&gt;, let me tell you something at this point &lt;code&gt;setTimeout()&lt;/code&gt; function in node works similar to &lt;code&gt;window.setTimeout()&lt;/code&gt;, however they are not exactly same. Read more about this &lt;a href="https://nodejs.org/en/docs/guides/timers-in-node/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Top 5 JavaScript animation libraries 2021</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Sun, 29 Aug 2021 14:47:38 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/top-5-javascript-animation-libraries-2021-17n7</link>
      <guid>https://dev.to/aashishpanthi/top-5-javascript-animation-libraries-2021-17n7</guid>
      <description>&lt;p&gt;Animations are the &lt;strong&gt;game changer&lt;/strong&gt; when it comes to quality user experience. &lt;strong&gt;Everyone wants to use it&lt;/strong&gt; but in a way that website visitors don't want to quit. So I've gathered here best five JavaScript animation libraries. &lt;strong&gt;Let's start:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Anime.js
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://animejs.com/" rel="noopener noreferrer"&gt;Anime.js&lt;/a&gt; is a &lt;strong&gt;lightweight JavaScript animation library&lt;/strong&gt; with a simple, yet powerful API. It works with &lt;strong&gt;CSS properties, SVG, DOM attributes and JavaScript Objects.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Well just look at this example:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/ainalem/embed/jBZxYe?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Vivus
&lt;/h3&gt;

&lt;p&gt;&lt;a href="http://maxwellito.github.io/vivus/" rel="noopener noreferrer"&gt;Vivus&lt;/a&gt; is a lightweight JavaScript library &lt;em&gt;(with no dependencies)&lt;/em&gt; that allows you to animate &lt;strong&gt;SVGs,&lt;/strong&gt; giving them the appearence of being drawn.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Just interact with the example below by clicking and holding:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/mattrothenberg/embed/Ramwvw?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  3. GSAP
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://greensock.com/" rel="noopener noreferrer"&gt;GSAP&lt;/a&gt; is a JavaScript library that is turning &lt;strong&gt;developers into animation superheroes.&lt;/strong&gt; It is one of the most popular javascript libraries out there. You can animate &lt;strong&gt;almost anything&lt;/strong&gt; with the help of this library.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Just use this library to create awesome animation like one given below:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/GreenSock/embed/yhEmn?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Typeit.js
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://typeitjs.com/" rel="noopener noreferrer"&gt;Typeit.js&lt;/a&gt; allows creating &lt;strong&gt;awesome typing animation&lt;/strong&gt; in your website. If you want to add typing animation on your website then go for it.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Just look at this cool story of a programmer&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/alexmacarthur/embed/MOPQvp?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  5. ScrollOut
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://scroll-out.github.io/" rel="noopener noreferrer"&gt;ScrollOut.js&lt;/a&gt; is a javascript library that &lt;strong&gt;detects changes in scroll for reveal, parallax, and CSS Variable effects.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Just scroll down this codepen&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/notoriousb1t/embed/zLbVEW?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;May be I've missed some other cool libraries, &lt;em&gt;just let me know in the comment section down below.&lt;/em&gt; And I can't forget Threejs also.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>codepen</category>
      <category>gsap</category>
    </item>
    <item>
      <title>Step by step instructions to install node and npm using Linux binaries</title>
      <dc:creator>Aashish Panthi</dc:creator>
      <pubDate>Sat, 28 Aug 2021 11:08:29 +0000</pubDate>
      <link>https://dev.to/aashishpanthi/step-by-step-instructions-to-install-node-and-npm-using-linux-binaries-1e0h</link>
      <guid>https://dev.to/aashishpanthi/step-by-step-instructions-to-install-node-and-npm-using-linux-binaries-1e0h</guid>
      <description>&lt;p&gt;Yes, you can install node through &lt;strong&gt;apt package manager&lt;/strong&gt; with the command &lt;code&gt;sudo apt install nodejs&lt;/code&gt; and you get the latest nodejs installed. But many people find it very complicated to &lt;em&gt;install Binaries&lt;/em&gt;. So, I will be breaking down the process into four simple steps. (Note: &lt;strong&gt;I'm using pop os and will be installing node v14.17.3&lt;/strong&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's start:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Get the binary file
&lt;/h3&gt;

&lt;p&gt;So head to &lt;a href="https://www.nodejs.org/download" rel="noopener noreferrer"&gt;nodejs&lt;/a&gt; website and download binary files of latest stable nodejs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faaf5m2ii6hjmucw36bwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faaf5m2ii6hjmucw36bwn.png" alt="Nodejs download website" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Extract the tar file
&lt;/h3&gt;

&lt;p&gt;Go to the directory where you've downloaded your nodejs. &lt;strong&gt;In my case its Downloads directory.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdsrs2h1m8uhf91vsg83.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgdsrs2h1m8uhf91vsg83.png" alt="Downloads directory" width="800" height="536"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, extract the files with this command &lt;code&gt;tar -xf "*your_downloaded_file*"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhirjla0zqt2ciaz8cqg3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhirjla0zqt2ciaz8cqg3.png" alt="Tar extract" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or, go to Downloads folder using file manager, right click on tar file and extract &lt;em&gt;(so simple)&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fice5f4vd7dzh7iamfqw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fice5f4vd7dzh7iamfqw5.png" alt="Extract through file manager" width="800" height="541"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Copy folders to /usr
&lt;/h3&gt;

&lt;p&gt;Now we get these all folders inside our extracted node folder.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdxkunbhkne7zhmi89k9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffdxkunbhkne7zhmi89k9.png" alt="Files and folder" width="800" height="551"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we need to &lt;strong&gt;cd&lt;/strong&gt; inside that folder. Type the command &lt;code&gt;sudo cp -r ./{lib,share,include,bin} /usr&lt;/code&gt; hit enter and type your password. Remember to use &lt;strong&gt;-r&lt;/strong&gt; flag to make sure that all files inside those folders are also copied.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywbdurkwyr4benfv1m28.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywbdurkwyr4benfv1m28.png" alt="Copy to /usr" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Check the node and npm version
&lt;/h3&gt;

&lt;p&gt;You can check nodejs version with the command &lt;code&gt;node --version&lt;/code&gt; or &lt;code&gt;node -v&lt;/code&gt; and check npm version with&lt;code&gt;npm --version&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxo58p00lnh9wpaqe2g2v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxo58p00lnh9wpaqe2g2v.png" alt="Node and npm version check" width="640" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it, &lt;em&gt;you have now installed nodejs and npm in your system.&lt;/em&gt; &lt;strong&gt;Enjoy&lt;/strong&gt; 😎&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>discuss</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
