<?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: Peter</title>
    <description>The latest articles on DEV Community by Peter (@petrepan_).</description>
    <link>https://dev.to/petrepan_</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%2F171244%2F32f15e5d-351c-48e9-b854-1ecb7ba31d3d.jpg</url>
      <title>DEV Community: Peter</title>
      <link>https://dev.to/petrepan_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/petrepan_"/>
    <language>en</language>
    <item>
      <title>CSS Animation: the basic concept and more..</title>
      <dc:creator>Peter</dc:creator>
      <pubDate>Mon, 15 Jun 2020 19:49:09 +0000</pubDate>
      <link>https://dev.to/petrepan_/css-animation-the-basic-concept-and-more-2aki</link>
      <guid>https://dev.to/petrepan_/css-animation-the-basic-concept-and-more-2aki</guid>
      <description>&lt;p&gt;Css Animation is a great way to improve user experience, add personality to a website. Sensing the movements of objects appears to be a fundamental job for our visual system. We can capitalize on that to build an engaging website. But always remember, animations should enhance the user experience and not be distracting.&lt;/p&gt;

&lt;p&gt;In this post, we'll walk through the basic concept of creating animation with css. We're going to discuss css properties, pseudo-classes, the @keyframes(pronounced at-keyframes) rule and how browsers render css.&lt;/p&gt;

&lt;p&gt;This post is beginner inclined. So if you're new to css, do follow along, there's a lot you can learn. Enough of the intro, let's get to it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/lluj1cauAlO2vQEm8A/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/lluj1cauAlO2vQEm8A/giphy.gif" alt="hyping meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  css properties, pseudo-classes and css transition property
&lt;/h2&gt;

&lt;p&gt;A basic example of css animation could be the use of pseudo-classes to change the state of an element. What are pseudo-classes?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pseudo-classes:&lt;/strong&gt; They are keywords combined with a CSS selector to add an effect to existing elements based on their states. An element will remain in a fixed position unless it is acted upon, which is where pseudo-class comes in. It adds trigger to elements.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Basic css&lt;/th&gt;
&lt;th&gt;Css with pseudo class&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PyM9T8YV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1591875752/carbon_4_g9zgcz.png" alt=""&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cP5J2vyP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1591875697/carbon_3_vcbjjh.png" alt=""&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Pseudo-classes includes &lt;code&gt;:hover&lt;/code&gt;, &lt;code&gt;:visited&lt;/code&gt;, &lt;code&gt;:focus&lt;/code&gt;, &lt;code&gt;:active&lt;/code&gt;, &lt;code&gt;:checked&lt;/code&gt;, &lt;code&gt;:not()&lt;/code&gt;. There are over 40 pseudo-classes, you can check them out on &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes"&gt;MDN&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;With pseudo-classes, we can create simple to advance interface ranging from "changing width of element" to "form validation". Yes form validation, the &lt;code&gt;:valid&lt;/code&gt; pseudo-class can be used to validate forms. We wouldn't be going there though.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/petrepan/embed/ZEQWQRB?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
 &lt;br&gt;
In the pen above, hover, active, focus pseudo-classes were used to change the width, border and color/background of their respective elements. Notice the abrupt change in the state of the element, we will use the transitions properties to create better transformation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CSS Transitions:&lt;/strong&gt; CSS transition allows us to change property values smoothly, over a given duration. It is a shorthand syntax for &lt;strong&gt;transition-property, transition-duration, transition-timing-function(optional), and transition-delay(optional).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Note transition shorthand:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;property&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;timing-function&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;delay&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;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Xlred3vY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1591892534/carbon_5_eachf0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xlred3vY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1591892534/carbon_5_eachf0.png" alt="transition property"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Transition-property:&lt;/strong&gt; This is used to specify the css property we want to change or transform. e.g &lt;code&gt;transition-property: width;&lt;/code&gt;, &lt;code&gt;transition-property: background-color;&lt;/code&gt; or better still &lt;code&gt;transition-property: all;&lt;/code&gt; which will apply to all possible property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transition-duration:&lt;/strong&gt; This is the duration it takes for the transition to occur.&lt;/p&gt;

&lt;p&gt;Before we get to transition-timing-function, let's apply transitions to our previous code.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/petrepan/embed/ExPKyYJ?height=600&amp;amp;default-tab=css,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
 &lt;br&gt;
Now our animation looks much better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The transition-timing-function:&lt;/strong&gt; This is used to define the acceleration curve. The values are grouped into keyword and function values.&lt;/p&gt;

&lt;p&gt;The keyword values include ease (default), ease-out, ease-in, linear, ease-in-out, step-start, step-end.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/petrepan/embed/gOPrWva?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The function values are steps(n, jumpterm) and cubic-bezier(p1, p2, p3, p4).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;steps(n, jumpterm):&lt;/strong&gt; This is more like an extension from the step-start and step-end keyword value. It takes two parameter 'n', 'jumpterm'. The n is the number of times we want the jumpterm to occur. Jumpterm refers to how the jump should take place. Apparently step-start and step-end means steps(1, jump-start) steps(1, jump-end) respectively. There's also jump-both and jump-none;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;cubic-bezier(p1, p2, p3, p4):&lt;/strong&gt; This is used to create advance acceleration curve. We can create our own dynamic acceleration curve with this value. Where the p1 and p3 values must be in the range of 0 to 1. There are tonnes of cubic-bezier generator online to manipulate our acceleration.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  How does browsers render CSS
&lt;/h2&gt;

&lt;p&gt;Okay sorry for the intermission, you might be wondering why we have to talk about this. Understanding how web browsers render CSS is important in creating a smooth and better animation. &lt;/p&gt;

&lt;p&gt;This is a visual example of why this is important. On hover, the red box transition affected the other element on the page while the blue one does not. The blue box which obviously has a better animation uses the css &lt;code&gt;transform&lt;/code&gt; property(full details later).&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/petrepan/embed/yLeOxpY?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;When a webpage is loaded, the browser goes through four steps to render css.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Style: After the browser figures where our CSS file is located in the HTML file, it scans through the CSS and figures out which rules to apply to which element. This is done through the CSS Object Model (CSSOM), it is much like the DOM tree but for CSS rather than HTML. The CSSOM, together with the DOM then builds the &lt;strong&gt;render tree&lt;/strong&gt;, which is in turn used by the browser to &lt;strong&gt;layout&lt;/strong&gt; and &lt;strong&gt;paint&lt;/strong&gt; the web page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Layout: With the render tree created, the browser creates the layout of each element in the render tree. The browser figures out the size and position of each element on the page. Properties such as  width and height are applied during the layout stage&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Paint: With the information about the size and position known, the browser brings on it artistic prowess. It shows the information to the users by applying paints and colours to the screen. Css properties such as border, color, box-shadow, text are applied during the Paint stage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Composite: This is where the elements are combined together and rendered to the screen.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In summary, this means that if you animate a css property in the layout stage, the browser needs to recreate the entire layout, repaint and composite the element for each calculation. Same goes for properties in the paint stage. This ends up creating a poor quality of animation and webpage.&lt;/p&gt;

&lt;p&gt;In other words, it is advisable to try as much to animate properties in the composite stage. Example of that are the &lt;code&gt;transform&lt;/code&gt; and &lt;code&gt;opacity&lt;/code&gt; properties. Properties in the composite stage do not have to recreate layout and repaint which means less calculation and better animation experience.&lt;/p&gt;

&lt;p&gt;Basically, all our previous code has been bad practise since we can just use the &lt;code&gt;transform&lt;/code&gt; property that has lot of perks to it. You can check out which stage css properties are triggered in browser on &lt;a href="https://csstriggers.com/"&gt;css trigger&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transforming and Transitioning
&lt;/h2&gt;

&lt;p&gt;A better way to move or change the position of an element is using the &lt;code&gt;transform property&lt;/code&gt;. Just like in previous practises, we need to apply &lt;code&gt;transition&lt;/code&gt; property to avoid abrupt change. This helps us create nice animation and better user interaction.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;transform&lt;/code&gt; property applies a 2D or 3D transformation to an element but we're only focusing on 2D in this post. &lt;/p&gt;

&lt;p&gt;This property allows us to rotate, scale, move, skew elements. The property has values which takes one or two parameter. They include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scale(x,y): The scale value allows us to increase or decrease the size of an element. It has two parameters which is x and y e.g &lt;code&gt;transform: scale(2,4)&lt;/code&gt; which means it will scale two times on the x-axis and four times on the y-axis. Apart from scaling on the x and y axis, we can also scale on the x or y axis individually. e.g. &lt;code&gt;transform: scaleX(2)&lt;/code&gt;, &lt;code&gt;transform: scaleY(0.5)&lt;/code&gt;. x is horizontal, y is vertical&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rotate(x,y): The rotate value provides the ability to rotate an element from 0 to 360 degrees. Using a positive value will rotate an element clockwise, and using a negative value will rotate the element counterclockwise. You can rotate more than a full rotation with numbers greater than 360, such as 720deg, for two full rotations. Rotation can also be done individually on the X-axis and Y-axis. e.g. &lt;code&gt;transform: rotate(360deg)&lt;/code&gt;, &lt;code&gt;transform: rotate(1turn)&lt;/code&gt;, &lt;code&gt;transform: rotateX(20deg)&lt;/code&gt;, &lt;code&gt;transform: rotateY(30deg)&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Translate(x,y): The translate value moves an element through the x and y axis. Using &lt;code&gt;translateX&lt;/code&gt; value will change the position of an element on the horizontal axis while the &lt;code&gt;translateY&lt;/code&gt; value will change the position of an element on the vertical axis. e.g. &lt;code&gt;transform: translate(20px, 40px)&lt;/code&gt;, &lt;code&gt;transform: translateX(50%)&lt;/code&gt;, &lt;code&gt;transform: translateY(10em)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Skew(x,y): The skew value gives a slant shape to the element based on the values for the x and y axis. e.g. transform: skew(20px, 40px), transform: skewX(50%), transform: skewY(5em).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: When using the properties, always take note of the units.&lt;/p&gt;

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

&lt;p&gt;The &lt;code&gt;transform&lt;/code&gt; properties can be manipulated together to create shapes.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/petrepan/embed/NWxRxYe?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Transform-origin:&lt;/strong&gt; With transform origin, transformation even gets better. The &lt;code&gt;transform-origin&lt;/code&gt; property allows us to change the origin of transformation. By default, transformation starts from the center which translate as &lt;code&gt;transform-orign: 50% 50%;&lt;/code&gt; or &lt;code&gt;transform-origin: center;&lt;/code&gt;. 0% 0% is the same value as top left, 0% 100% is the same as left bottom, and 100% 100% is the same value as bottom right.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CSfzEy9D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1592235462/transform-origin_wae3ty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CSfzEy9D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/petrepan/image/upload/v1592235462/transform-origin_wae3ty.png" alt="transform-origin"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;h2&gt;
  
  
  @Keyframes rule and the animation property
&lt;/h2&gt;

&lt;p&gt;So far we've created some animation that requires pseudo-classes. With the keyframes function and animations property, we don't have to specify the state of an element. All we have to do is apply the animation properties on our element, then define @keyframes rules that specify our css style at different stage. Alright let's start with the animation properties.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;animation&lt;/code&gt; property just like transform and transition has sub-properties. The animation properties are added to the CSS selectors (or elements) we want to animate.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-name&lt;/code&gt;: The name of the animation. This is used as the @keyframes name when we define it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-duration&lt;/code&gt;: The duration of the animation, in seconds (e.g. 3s) or milliseconds (e.g. 500ms).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-timing-function&lt;/code&gt;: specifies the speed curve of an animation. It works just the same as the transition-timing-function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-delay&lt;/code&gt;: It specifies a delay before an animation starts, in seconds or milliseconds.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-iteration-count&lt;/code&gt;: This specifies the number of times an animation should repeat. e.g &lt;code&gt;animation-iteration-count: 2;&lt;/code&gt;, &lt;code&gt;animation-iteration-count: infinite;&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-direction&lt;/code&gt;: This property defines whether the animation should play forward, backward, or in alternate cycles. e.g &lt;code&gt;animation-direction: reverse;&lt;/code&gt;, &lt;code&gt;animation-direction: normal;&lt;/code&gt; (the default value which is forward direction), &lt;code&gt;animation-direction: alternate&lt;/code&gt; (it alternates between the forward and reverse direction).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-fill-mode&lt;/code&gt;: This property is used to specify the state or mode of the element after animating. e.g &lt;code&gt;animation-fill-mode: forwards;&lt;/code&gt; which means the element should remain in the final stage or state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;animation-play-state&lt;/code&gt;: This property allows us to pause and resume the animation sequence. e.g &lt;code&gt;animation-play-state: pause;&lt;/code&gt;, &lt;code&gt;animation-play-state: play;&lt;/code&gt;. This property is defined on a pseudo-class or in javascript.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/*Shorthand syntax*/&lt;/span&gt;
&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-duration&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-timing-function&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
           &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-delay&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-iteration-count&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;animation-direction&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c"&gt;/*Individual syntax*/&lt;/span&gt;
&lt;span class="n"&gt;animation-name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;myAnimation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;animation-duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;animation-timing-function&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt; &lt;span class="c"&gt;/*options: linear, ease-in, ease-out, 
ease-in-out, cubic-bezier */&lt;/span&gt;
&lt;span class="n"&gt;animation-delay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;animation-iteration-count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;animation-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;normal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*options: alternate, reverse, alternate-reverse */&lt;/span&gt;
&lt;span class="nl"&gt;animation-fill-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;forwards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*options: none, backwards */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now that we've specified our animation properties, we'll have to define the stages and css to complement the animation. This is done with the &lt;code&gt;@keyframes&lt;/code&gt; rule.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;@Keyframes rule:&lt;/strong&gt; The @keyframes defines the css of the animation at different stages. Each stages can be specified with percentage(%) or using "from" and "to" which represent 0% and 100% respectively. The @keyframes rule is also given a name which is the value of the &lt;code&gt;animation-name&lt;/code&gt; property specified on the element we want to animate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;myAnimation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
 &lt;span class="err"&gt;css&lt;/span&gt; &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; 
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="err"&gt;css&lt;/span&gt; &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; 
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="err"&gt;css&lt;/span&gt; &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;anotherAnimation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nt"&gt;from&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
 &lt;span class="err"&gt;css&lt;/span&gt; &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;to&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="err"&gt;css&lt;/span&gt; &lt;span class="py"&gt;property&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;value&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;&lt;iframe height="600" src="https://codepen.io/petrepan/embed/RwrRKRr?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;bounceAnimation&lt;/span&gt; &lt;span class="m"&gt;1s&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt; &lt;span class="n"&gt;alternate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c"&gt;/*animation: [animation-name] [animation duration] [animation-timing-function]
 [animation-iteration-count] [animation-direction]*/&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;bounceAnimation&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; 
  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;300px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;scale&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2&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;With the @keyframes rule and &lt;code&gt;animation&lt;/code&gt; properties, we can create simple to complex animation without javascript or pseudo-class.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project
&lt;/h2&gt;

&lt;p&gt;In this section, we're going to apply the &lt;code&gt;@keyframes&lt;/code&gt; and &lt;code&gt;animation&lt;/code&gt; property to build a simple animated website. Just to illustrate "how-to apply animation to a website".&lt;/p&gt;

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

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.paragraph1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;paragraph1&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.paragraph2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;paragraph2&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt; &lt;span class="n"&gt;ease-out&lt;/span&gt; &lt;span class="n"&gt;forwards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;anchor&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt; &lt;span class="n"&gt;linear&lt;/span&gt; &lt;span class="m"&gt;2s&lt;/span&gt; &lt;span class="n"&gt;forwards&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-100px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&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;@keyframes&lt;/span&gt; &lt;span class="n"&gt;paragraph1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-200px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&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;@keyframes&lt;/span&gt; &lt;span class="n"&gt;paragraph2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&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;On the page, there are four animated element, two paragraphs, a header and a button. At 0% and 100%, &lt;code&gt;transform&lt;/code&gt; property was added to the paragraph's @keyframes to slide them to their original position. The button also faded in with &lt;code&gt;opacity&lt;/code&gt; property.&lt;/p&gt;

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

&lt;p&gt;Yeah that's it, the basics of css animation. The &lt;code&gt;animation&lt;/code&gt; property and &lt;code&gt;@keyframes&lt;/code&gt; is very resourceful, the possible animations you can create are endless but always remember to put the users interest at heart.&lt;/p&gt;

&lt;p&gt;If you will be having a lot or complex animation on your website, you can check out &lt;a href="https://animate.style/"&gt;animate.style&lt;/a&gt; which is a css library for building efficient animation.&lt;/p&gt;




&lt;p&gt;You can check out all the css on my &lt;a href="https://codepen.io/collection/DYYpMa"&gt;codepen collection&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read this post.  If you've found this useful, please give it a ❤️ or 🦄, share and comment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Animations/Using_CSS_animations"&gt;MDN&lt;/a&gt;&lt;br&gt;
&lt;a href="https://animate.style/"&gt;Css library&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.smashingmagazine.com/2016/12/gpu-animation-doing-it-right/"&gt;CSS GPU Animation: Doing It Right&lt;/a&gt;&lt;br&gt;
&lt;a href="https://thoughtbot.com/blog/css-animation-for-beginners"&gt;Css animation for beginners&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>codenewbie</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Learn about the command line.</title>
      <dc:creator>Peter</dc:creator>
      <pubDate>Mon, 16 Mar 2020 00:24:09 +0000</pubDate>
      <link>https://dev.to/petrepan_/learn-about-the-command-line-1j35</link>
      <guid>https://dev.to/petrepan_/learn-about-the-command-line-1j35</guid>
      <description>&lt;p&gt;If you've ever been intimidated by the command line or curious about it and how to use the command line, this article will help you get started and comfortable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you will learn.
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is the command line?&lt;/li&gt;
&lt;li&gt;Why is the command line important?&lt;/li&gt;
&lt;li&gt;Basic command and navigation.&lt;/li&gt;
&lt;li&gt;Integration with git and github.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What is the command line?
&lt;/h3&gt;

&lt;p&gt;The command line (commonly also referred to as CLI, Terminal, bash, or shell) is an application for typing commands directly to a computer's operating system.It lets you interact and give instructions to your computer&lt;/p&gt;

&lt;p&gt;According to wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A command-line interface processes commands to a computer program in the form of lines of text&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is basically a tool that takes a command in form of normal text and processes the instruction. You can use it in place of GUI(the normal interface we use everyday on our computer). Don't worry, you will understand more when will get to its basic command. Every operating system comes with a pre-install command line.&lt;br&gt;
You can navigate or open the command line on your PC by:&lt;br&gt;
-Using the search bar on Windows, input "cmd" then open the command prompt app&lt;br&gt;
-On Mac PC, click on the spotlight icon(looks like a search bar) then search for terminal&lt;br&gt;
-If on Linux then you will probably find it in &lt;strong&gt;Applications -&amp;gt; System or Applications -&amp;gt; Utilities&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;However, the command line i personally use is &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;Git Bash&lt;/a&gt; which i prefer to the pre-installed ones.&lt;/p&gt;
&lt;h3&gt;
  
  
  Why is the command line important?
&lt;/h3&gt;

&lt;p&gt;You probably thinking right now!&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpetrepan%2Fimage%2Fupload%2Fv1583882205%2Fgiphy_pqiyv9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpetrepan%2Fimage%2Fupload%2Fv1583882205%2Fgiphy_pqiyv9.gif" title="I don't need this" alt="alt text"&gt;&lt;/a&gt;&lt;br&gt;
The command line is one of the most important applications on your computer, It helps us automate our tasks very easily. If you ever want to be a coder or work in a tech team as a designer, product manager, or other tech role, you'll have a big advantage if you're already comfortable with basic commands. But anyone who uses a computer will benefit from becoming comfortable with this essential tool!&lt;br&gt;
It helps us to perform many tasks quicker and can be much easier to automate and do remotely.&lt;br&gt;
Now let's get to the work!.&lt;/p&gt;
&lt;h3&gt;
  
  
  Basic command
&lt;/h3&gt;

&lt;p&gt;You don't need to know all the commands to start using the command line. Let's get started with some basic ones.&lt;/p&gt;
&lt;h4&gt;
  
  
  print working directory
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;print working directory represented by 'pwd' returns the directory or folder or current path you're working on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pwd
/c/Users/petrepan
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows that i'm currently in &lt;code&gt;petrepan&lt;/code&gt; folder which also is in the &lt;code&gt;Users&lt;/code&gt; folder on my computer.&lt;/p&gt;

&lt;h4&gt;
  
  
  make directory
&lt;/h4&gt;

&lt;p&gt;Make directory is used to create a new folder. So you make use of &lt;code&gt;mkdir&lt;/code&gt; coupled with the 'name of the folder'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir terminaltips
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So i just created a folder called terminaltips&lt;/p&gt;

&lt;h4&gt;
  
  
  change directory
&lt;/h4&gt;

&lt;p&gt;Change directory is used to switch into a directory, you can use the “cd” command (where "cd" stands for "change directory"). So, i created (&lt;code&gt;mkdir&lt;/code&gt;) a directory called terminaltips. I can navigate into the directory by using 'cd'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd terminaltips
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  cd ..
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To move up one directory or to go to a previous one, use &lt;code&gt;cd ..&lt;/code&gt;. make sure there's a space between the keyword &lt;code&gt;cd&lt;/code&gt; and the two dots.&lt;/p&gt;

&lt;h4&gt;
  
  
  touch
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch project.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;touch&lt;/code&gt; creates a new file inside a folder. It takes in a file name as an argument, and then creates a new empty file in the current working directory. Here we used touch to create a new file named index.html.&lt;/p&gt;

&lt;h4&gt;
  
  
  Move files
&lt;/h4&gt;

&lt;p&gt;This is used to move a file into another folder, use &lt;code&gt;mv&lt;/code&gt; with the name of the file and then the name of the folder. Here we move the file 'project.txt' into another folder called project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mv project.txt project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Copy files
&lt;/h4&gt;

&lt;p&gt;You might want to copy your file instead of moving it, you can follow the same process with the &lt;code&gt;mv&lt;/code&gt; command. But this time, you make use of the &lt;code&gt;cp&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cp project.txt project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  RM -R
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;rm -r&lt;/code&gt; is used to delete a folder, &lt;code&gt;rm&lt;/code&gt;(remove). To delete a folder, you need to be in its parent directory, not inside the folder itself. Here we deleted a folder called terminaltips.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rm -r terminaltips
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  RM
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;rm&lt;/code&gt;(remove) command deletes files. Here we remove the file project.txt. The above one is used for deleting folders while this one is used for deleting files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ rm project.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  List
&lt;/h4&gt;

&lt;p&gt;The command &lt;code&gt;ls&lt;/code&gt; lists all files and folders in the working directory. working directory means your current directory. You can check your current with the command &lt;code&gt;pwd&lt;/code&gt; we learnt above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ls
projects   terminaltips   index.html   words.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ls -a&lt;/code&gt; command can be used to list all contents including hidden files and directory.&lt;/p&gt;

&lt;h4&gt;
  
  
  echo
&lt;/h4&gt;

&lt;p&gt;This command is used to add a text to a file. By using the &lt;code&gt;echo&lt;/code&gt; command followed by the text(in quotation) and then &lt;code&gt;&amp;gt;&lt;/code&gt;, followed by the filename.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo "This is a text. We're adding it to a file." &amp;gt; project.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We added the quotated text to the text file called project.txt&lt;/p&gt;

&lt;h4&gt;
  
  
  grep
&lt;/h4&gt;

&lt;p&gt;Most times this is used in big project cos it lets you look for a certain text within a file. The usage for this is less obvious when you're not working on a big code project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ grep adding project.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We just searched for where the word 'adding' exist in terminaltip.txt. It will return the lines that contain the content you seek for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ grep adding project.txt
We're adding it to a file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this commands, you can easily navigate between files and folders in your computer.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integration with git and github
&lt;/h3&gt;

&lt;p&gt;So this is just going to be a little project on how we can use the command line in conjunction with git and github.&lt;br&gt;
Git is a version control system that helps us keep track of our files on our computer. This can help us to monitor and manage different changes made on our files.whereas&lt;br&gt;
Github is a website that helps us to host our folders or repositories online.&lt;br&gt;
Both git and github are useful tools for developers.&lt;br&gt;
Here we are going to create a folder on github and clone it to our computer. Make sure you install and configure &lt;a href="https://git-scm.com/downloads" rel="noopener noreferrer"&gt;Git&lt;/a&gt;. And also sign up on &lt;a href="//github.com"&gt;github&lt;/a&gt; if you don't have an account.&lt;/p&gt;

&lt;p&gt;*Step one: Create a folder on your computer.&lt;br&gt;
*Step two: Navigate into the folder&lt;br&gt;
*Step three: Create a repository on github.&lt;br&gt;
*Step four: Clone your repository.&lt;br&gt;
*Step five: Create a file&lt;/p&gt;
&lt;h4&gt;
  
  
  Step one: Create a folder on your computer.
&lt;/h4&gt;

&lt;p&gt;Open your command line and make a folder with the &lt;code&gt;mkdir&lt;/code&gt; command. Here we created a folder called 'project'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step two: Navigate into the folder
&lt;/h4&gt;

&lt;p&gt;Let's navigate into the 'project' folder with &lt;code&gt;cd&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step three: Create a repository on github
&lt;/h4&gt;

&lt;p&gt;Login into your github and create a repository, let's call it git-testing. Now you have something like this&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpetrepan%2Fimage%2Fupload%2Fv1584312371%2Fpetrepan_git-testing_il1jqx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fpetrepan%2Fimage%2Fupload%2Fv1584312371%2Fpetrepan_git-testing_il1jqx.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Step four: Clone your repository
&lt;/h4&gt;

&lt;p&gt;Click the green button at the right hand side that says "Clone or download" and copy the link.&lt;br&gt;
Now go back to your terminal and clone the github repository to your computer with &lt;code&gt;git clone&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone https://github.com/petrepan/git-testing.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step five: Create a file
&lt;/h4&gt;

&lt;p&gt;Now that you have the 'git-testing' folder on your computer, we can create a file with the &lt;code&gt;touch&lt;/code&gt; command. Let's create two files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch index.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch app.css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Voila!! That's the basics of using the command line. We can even go further to check the list of files in the 'git-testing' folder with the &lt;code&gt;ls&lt;/code&gt; command.&lt;br&gt;
Lastly, use the &lt;code&gt;clear&lt;/code&gt; command to clean up your command line when the command gets too much.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;There's a lot more we can do with the command line especially when the project gets overwhelming. It makes our life easier.&lt;/p&gt;

&lt;p&gt;So feel free to explore and learn more about the command line, git and github.&lt;/p&gt;

&lt;p&gt;Thanks for reading! Don't forget to leave a comment and a like.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>devtips</category>
      <category>codenewbie</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
