How To Create Quick SVG Elastic Line Animation Effects Only HTML And CSS

 How To Create Quick SVG Elastic Line Animation Effects Only HTML And CSS

Project Introduction: In this project, we are going to implement a car running on a track using HTML and CSS with sound effects.

File structure:

  • index.html
  • style.css
HTML code:  In the following code,fist time open a index.html file than than create html Structure. we have placed the body tag than  <svg></svg>tag than i second <path></path> after than again <svg></svg>tag and <path> </path >tag and save html file .  We have added the styles using the file style.css 


<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="style.css">
    <!--font awesome filup-->
    <link rel="stylesheet" href="css/all.css">
    <title>Elastic line Animation Effects</title>

  <body>
    <svg>
      <path></path>
    </svg>
    <svg>
      <path></path>
    </svg>

  </body>
</html>
style.css: The following is the code for file “style.css” which is used in the above HTML code.
*{
  margin: 0;
  padding: 0;

}
body{
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #374F4A;
}
svg{
  position: absolute;
  width: 450px;
  fill:none;
}
svg:nth-child(2){
  filter: blur(40px);
}
svg path{
  d:path("M0,25 C150,110 150,-60 300,25");
  stroke:#42b3f5;
  stroke-width:50;
  stroke-linecap:round;
  transform: translate(50px, 50%);
  animation: animate 2s ease-in-out infinite;
}
@keyframes animate {
  0%{
    stroke:#42b3f5;
    d:path("M0,25 C150,110 150,-60 300,25");

  }
  50%{
    stroke:#ff033e;
    d:path("M0,25 C150,-50 140,110 300,25");

  }

}

Output :



My facebook page link:

My YouTube video:




Post a Comment

1 Comments

Ad Code

Responsive Advertisement