<?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: prathamsm7</title>
    <description>The latest articles on DEV Community by prathamsm7 (@prathamsm7).</description>
    <link>https://dev.to/prathamsm7</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%2F587454%2F9924e017-a6b1-44eb-9cb6-4c49c9f92a77.png</url>
      <title>DEV Community: prathamsm7</title>
      <link>https://dev.to/prathamsm7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prathamsm7"/>
    <language>en</language>
    <item>
      <title>Difference Between transition and animation in CSS .</title>
      <dc:creator>prathamsm7</dc:creator>
      <pubDate>Mon, 08 Mar 2021 15:15:59 +0000</pubDate>
      <link>https://dev.to/prathamsm7/difference-between-transition-and-animation-in-css-3701</link>
      <guid>https://dev.to/prathamsm7/difference-between-transition-and-animation-in-css-3701</guid>
      <description>&lt;p&gt;Some people think that transition and animation is similar or both of them working similar, but they aren't . Let's see the what is the difference between both of them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Transition&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcoursework.vschool.io%2Fcontent%2Fimages%2F2016%2F08%2Ftransition_example2.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%2Fcoursework.vschool.io%2Fcontent%2Fimages%2F2016%2F08%2Ftransition_example2.png" alt="transitin"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://coursework.vschool.io/content/images/2016/08/transition_example2.png" rel="noopener noreferrer"&gt;Image From&lt;/a&gt;&lt;br&gt;
        As the above image implies, you can understand that the transition simply means the movement or changing the position. In transition element change its state/position from one. CSS transition are best choice for the from-to movement of the element. Transition element have two states from (actual position) and to(destination on the element).&lt;br&gt;
        Using transition you can add simple action to your site . Transition is the simple way to add animation in CSS .You tell css to change the element with the given duration of time .&lt;/p&gt;

&lt;p&gt;CSS transition have this properties &lt;br&gt;
  Property   --   Description&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;transition-property -- the CSS property that should transition&lt;/li&gt;
&lt;li&gt;transition-duration -- the duration of the transition&lt;/li&gt;
&lt;li&gt;transition-timing-function -- the timing function used by the animation (common values: linear, ease). Default value is ease&lt;/li&gt;
&lt;li&gt;transition-delay -- optional number of seconds to wait before starting the animation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  shorthand property for transition
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.element {
  transition: property duration timing-function delay;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h6&gt;
  
  
  simple example of transition
&lt;/h6&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#element {
  background-color: black;
  transition-property: font-size;
  transition-duration: 6s;
  transition-delay: 3s;
}
#element:hover {
  background-color: blue;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;Above example performs a six-second background color transition with a three-second delay between the time the user mouses over the element and the beginning of the animation effect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;What is Animation&lt;/strong&gt;&lt;/p&gt;

&lt;p&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%2Fpracticaldev%2Fimage%2Ffetch%2Fs--HLCG8XKx--%2Fc_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_720%2Cq_auto%2Cw_1280%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F54ydb37tzyny06ac8xdf.jpg" 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%2Fpracticaldev%2Fimage%2Ffetch%2Fs--HLCG8XKx--%2Fc_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_720%2Cq_auto%2Cw_1280%2Fhttps%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F54ydb37tzyny06ac8xdf.jpg" alt="animation"&gt;&lt;/a&gt;&lt;br&gt;
       An &lt;strong&gt;animation&lt;/strong&gt; gives you the facility to change element state in many movements. You can change as many CSS properties you want, as many times you want . Animation gives you more control over the property values. It is not limited to a single movement like CSS Transitions . &lt;br&gt;
       For using CSS animation, you must first specify some keyframes for the animation. Keyframes hold what styles the element will have at certain times. Each @keyframes at-rule defines what should happen at specific moments during the animation. For example, 0% is the beginning of the animation and 100% is the end. Between 0% to 100% you can add as many as movements you wants .&lt;/p&gt;
&lt;h4&gt;
  
  
  An animation is applied to an element using the animation property.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  animation: rotate 10s linear infinite;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;rotate is the name of the animation, which we need to define separately. We also tell CSS to make the animation last 10 seconds, perform it in a linear way (no acceleration or any difference in its speed) and to repeat it infinitely.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@keyframes rotate {
  0% {
    transform: rotateZ(0);
  }
  100% {
    transform: rotateZ(180deg);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case we instruct CSS to make the transform property to rotate the Z axis from 0 to 100 grades.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Value Description&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;animation-name    Specifies the name of the keyframe you want to bind to the selector&lt;/li&gt;
&lt;li&gt;animation-duration    Specifies how many seconds or milliseconds an animation takes to complete&lt;/li&gt;
&lt;li&gt;animation-timing-function Specifies the speed curve of the animation&lt;/li&gt;
&lt;li&gt;animation-delay   Specifies a delay before the animation will start&lt;/li&gt;
&lt;li&gt;animation-iteration-count Specifies how many times an animation should be played&lt;/li&gt;
&lt;li&gt;animation-direction   Specifies whether or not the animation should play in reverse on alternate cycles&lt;/li&gt;
&lt;li&gt;animation-fill-mode   Specifies what values are applied by the animation outside the time it is executing&lt;/li&gt;
&lt;li&gt;animation-play-state  Specifies whether the animation is running or paused&lt;/li&gt;
&lt;li&gt;initial -Sets this property to its default value.&lt;/li&gt;
&lt;li&gt;inherit -Inherits this property from its parent element. Read about inherit&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  shorthand property for transition
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.element{ animation: name duration timing-function delay iteration-count direction fill-mode play-state; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank You !!!&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>transition</category>
      <category>animation</category>
    </item>
  </channel>
</rss>
