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
<!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");
}
}
1 Comments
Wonderful content bro
ReplyDelete