Circle Wave Animation using CSS

Circle Wave Animation using CSS
Code Snippet:Circle waves
Author: Ofthedead
Published: January 11, 2024
Last Updated: January 22, 2024
Downloads: 13,837
License: MIT
Edit Code online: View on CodePen
Read More

This code snippet helps you to create circle wave animation using CSS keyframes. You can integrate these waves to any circular element and show waves animation on hover events. Basically, this CSS code provides a basic concept of creating wave animation around a circle. Anyhow, you can further customize it to get the desired output.

How to Create CSS Circle Animation

1. First of all, create the div element with a class name "container". Place 4 div elements inside it with the class name "circle" and "delay1" to "delay4" for waves. You can create these divs inside your existing circular element on which you want to apply these waves animation.

<div class="container">
    <div class="circle delay1"></div>
    <div class="circle delay2"></div>
    <div class="circle delay3"></div>
    <div class="circle delay4"></div>
</div>

2. After that, create basic CSS styles for the container and circle as follows:

.container {
  position: relative;
  display: block;
  width: 80px;
  margin: 60px auto;
}
.container:hover .delay1 {
  -webkit-animation: waves 2.5s linear;
          animation: waves 2.5s linear;
  -webkit-animation-delay: 0.1s;
          animation-delay: 0.1s;
}
.container:hover .delay2 {
  -webkit-animation: waves 2.5s linear 0.7s forwards;
          animation: waves 2.5s linear 0.7s forwards;
}
.container:hover .delay3 {
  -webkit-animation: waves 2.5s linear 1.3s forwards;
          animation: waves 2.5s linear 1.3s forwards;
}
.container:hover .delay4 {
  -webkit-animation: waves 2.5s linear 1.9s forwards;
          animation: waves 2.5s linear 1.9s forwards;
}

.svg-box {
  position: relative;
  z-index: 10;
}

.svg-box:hover {
  -webkit-animation: bloop 1s linear;
          animation: bloop 1s linear;
}

.circle {
  display: block;
  height: 60px;
  width: 60px;
  border-radius: 50%;
  background: #0194c7;
  margin: 10px;
  transition: 5s ease;
  position: absolute;
  top: 0px;
}

3. Finally, define the CSS animation keyframes for waves and done.

@-webkit-keyframes waves {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}
@-webkit-keyframes bloop {
  0% {
    transform: scale3d(1, 1, 1);
  }
  30% {
    transform: scale3d(1.25, 0.75, 1);
  }
  40% {
    transform: scale3d(0.75, 1.25, 1);
  }
  50% {
    transform: scale3d(1.15, 0.85, 1);
  }
  65% {
    transform: scale3d(0.95, 1.05, 1);
  }
  75% {
    transform: scale3d(1.05, 0.95, 1);
  }
  100% {
    transform: scale3d(1, 1, 1);
  }
}
@keyframes bloop {
  0% {
    transform: scale3d(1, 1, 1);
  }
  30% {
    transform: scale3d(1.25, 0.75, 1);
  }
  40% {
    transform: scale3d(0.75, 1.25, 1);
  }
  50% {
    transform: scale3d(1.15, 0.85, 1);
  }
  65% {
    transform: scale3d(0.95, 1.05, 1);
  }
  75% {
    transform: scale3d(1.05, 0.95, 1);
  }
  100% {
    transform: scale3d(1, 1, 1);
  }
}

That’s all! hopefully, you have successfully integrated this circular waves animation into your project. If you have any questions or suggestions, let me know by comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X