Creating a 3-layered CSS animation featuring a mesmerizing wave effect

I am currently working on creating a wave animation using three layers. However, the animation does not appear smooth and the waves do not appear endless as intended. Additionally, I am having trouble achieving the wave structure depicted in the image.

My goal is to have the waves flow without any interruptions. Currently, it is obvious when the animation comes to an end, which is not the desired effect. [![

.w1 {
  stroke: none;
  fill: #b3696c;
  opacity: 55%;
  animation: move1 4.5s linear infinite;
}
.w2 {
  stroke: none;
  fill: #b3696c;
  opacity: 35%;
  transform: translate3d(0, 0, 0);
  animation: move2 4.5s linear infinite;
}
.w3 {
  stroke: none;
  fill: #cf2127;
  opacity: 30%;
  transform: translate3d(0, 0, 0);
  animation: move3 2s linear infinite;
}
@keyframes move1 {
  0% {
    transform: translateX(-500px) scaleX(2.5);
  }
  50% {
    transform: translateX(-100) scaleX(2.5);
  }
  100% {
    transform: translateX(0) scaleX(2.5);
  }
}
@keyframes move2 {
  0% {
    transform: translateX(-600px) scaleX(3);
  }
  50% {
    transform: translateX(-100) scaleX(2.5);
  }
  100% {
    transform: translateX(0) scaleX(3);
  }
}
@keyframes move3 {
  0% {
    transform: translateX(-800px) scaleX(4);
  }
  50% {
    transform: translateX(-100) scaleX(2.5);
  }
  100% {
    transform: translateX(0) scaleX(4);
  }
}
<div class="waveAnimation">
      <svg viewBox="0 0 500 150" preserveAspectRatio="none">
        <path
          class="w1 waveTop"
          d="M-8.74,71.55 C289.78,255.11 349.60,4.47 505.36,34.05 L500.00,150.00 L0.00,150.00 Z"
        />
        <path
          class="w2 waveMiddle"
          d="M-23.42,125.83 C187.63,45.89 299.38,57.73 526.80,123.86 L500.00,150.00 L0.00,150.00 Z"
        />
        <path
          class="w3 waveBottom"
          d="M-23.42,125.83 C172.96,-152.44 217.55,183.06 504.22,55.77 L500.00,150.00 L0.00,150.00 Z"
        />
      </svg>
    </div>

Answer №1

For smoother wave animations, we can utilize the ease-in-out attribute instead of linear.

.wave1 {
    stroke: none;
    fill: #b3696c;
    opacity: 55%;
    animation: move1 5s ease-in-out infinite;
  }
  .wave2 {
    stroke: none;
    fill: #b3696c;
    opacity: 35%;
    transform: translate3d(0, 0, 0);
    animation: move2 4s ease-in-out infinite;
  }
  .wave3 {
    stroke: none;
    fill: #cf2127;
    opacity: 30%;
    transform: translate3d(0, 0, 0);
    animation: move3 6s ease-in-out infinite;
  }
  @keyframes move1 {
    0% {
      transform: translateY(-500px) scaleX(2.5);
    }
    25% {
      transform: translateY(-100) scaleX(2.5);
    }
    50% {
      transform: translateY(0) scaleX(2.5);
    }
    75% {
      transform: translateY(-100) scaleX(2.5);
    }
    100% {
      transform: translateY(-500px) scaleX(2.5);
    }
  }
  @keyframes move2 {
    0% {
      transform: translateY(-600px) scaleX(3);
    }
    25% {
      transform: translateY(-100) scaleX(2.5);
    }
    50% {
      transform: translateY(0) scaleX(3);
    }
    75% {
      transform: translateY(-100) scaleX(2.5);
    }
    100% {
      transform: translateY(-600px) scaleX(3);
    }
  }
  @keyframes move3 {
    0% {
      transform: translateY(-800px) scaleX(3);
    }
    25% {
      transform: translateY(-100) scaleX(2.5);
    }
    50% {
      transform: translateY(0) scaleX(3);
    }
    75% {
      transform: translateY(-100) scaleX(2.5);
    }
    100% {
      transform: translateY(-800px) scaleX(3);
    }
  }
<div class="waveEffect">
  <svg viewBox="0 0 500 150" preserveAspectRatio="none">
    <path
    class="wave1 topWave"
    d="M-8.74,71.55 C289.78,255.11 349.60,4.47 505.36,34.05 L500.00,150.00 L0.00,150.00 Z"
    />
    <path
    class="wave2 middleWave"
    d="M-23.42,125.83 C187.63,45.89 299.38,57.73 526.80,123.86 L500.00,150.00 L0.00,150.00 Z"
    />
    <path
    class="wave3 bottomWave"
    d="M-23.42,125.83 C172.96,-152.44 217.55,183.06 504.22,55.77 L500.00,150.00 L0.00,150.00 Z"
    />
  </svg>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I'm puzzled as to why there is a blank space in the false element statements

Hey there! I'm noticing a blank space on the page, and when I inspect it, I see this bindings={ "ng-reflect-ng-if": "false" }. It seems like I am getting some blank cards displayed. Here is an image showing what I mean: https://i. ...

Having issues with Inline-Block functionality?

I am facing alignment issues with an image and a container placed next to each other. The rest of my website uses inline-block without any problems. If someone could provide guidance on how to resolve this, it would be greatly appreciated. Below is the s ...

The jQuery script at version 3.4.1 encountered an error because it could not recognize the 'filter' function

I have integrated jsGrid with a local json file as the data source. I have set up a local json-server running on port 4000 to serve dynamic data. When I access http://localhost:4000/networks, the json data is displayed correctly. To view my web page, I hav ...

Creating a dynamic material search bar with algolia autocomplete feature

I've implemented algolia autocomplete in my application and I'm trying to create a search bar that expands similar to the example on this page. My app's layout includes a header bar with a search input for larger screens, while smaller scree ...

I've encountered an issue with adjusting certain property values for an SVG component within my React project

I'm experiencing an issue where the pointer property is working, but the fill property isn't having any effect. When I inspect the elements in the browser console, I can manually change the element.style to affect the styling of the SVG component ...

Utilizing jQuery in combination with HTML and CSS

I'm having an issue with implementing jQuery animations for adding a new row on form submit. Additionally, I need to dynamically add and remove classes with animation effects without altering the HTML or CSS files (as this project is for school). Her ...

Tips for redirecting to the index page instead of the login form after pressing the back button on the navigation

Hey everyone! I've been struggling with a problem for the past 4 hours and could really use some help. After logging in, the page redirects to a certain page, but when I press the back button in my browser, I want it to redirect back to that specific ...

Get notified about the number of cells you've selected by simply dragging on a table

Is there a way to display the number of selected cells in a table when dragging with the mouse? I have a table set up, and I'd like to create an alert that shows how many cells are selected while dragging. Here is the link to my fiddle: http://jsfiddl ...

Delete the unauthorized number located before the doctype declaration

Currently, I am implementing codeigniter with a layout view as a standard page. Within this layout, I include elements such as the menu bar and content. Oddly enough, all pages display without issues except for one. This particular page displays a random ...

Creative Solution for Nested Forms

I am currently facing a challenge with nested forms in my PHP project. I need to include a form for AJAX image upload within another form so that I can pass the file path to the main form. The example code snippet is provided below; <form> <f ...

Troubles with implementing child routes in Angular 6

I'm having trouble getting the routing and child routing to work in my simple navigation for an angular 6 app. I've configured everything correctly, but it just doesn't seem to be working. Here is the structure of my app: └───src ...

Looking for assistance with my website's navigation bar and logo

Looking for assistance in moving my navigation buttons to each side of the logo. As a beginner in web design and CSS, I've been struggling with this task. Essentially, I want the "home" and "about" buttons on the left side of the logo, 16px apart from ...

Issue with Bootstrap dropdown functionality when used in conjunction with typical JS and CSS implementations

When it comes to front-end development, I feel lost and confused. Recently, I tried to create a Bootstrap dropdown menu that appears upon clicking an anchor tag using the following HTML: <div class="dropdown"> <a data-target="#" class="dropdo ...

Convert the menu items into a multi-select using Bootstrap 4

Referencing the example provided in the Bootstrap documentation at http://getbootstrap.com/docs/4.0/components/dropdowns/#menu-dividers I am interested in creating a custom toggle effect for the menu items, where clicking on an item changes its color to b ...

What is the best way to align two div elements side by side within a parent div inside a list item?

I have been working on this code for hours. Here is the CSS I am currently using: <ul class="slider"> <li style="display: block;"> <a href="#" style="clear:both;> <div class="slider_blog" style="width: 680px; height: 300p ...

Using jQuery to display one sibling element at a time, closing any other open sibling element

My FAQ is set up so that when a question is clicked, the corresponding answer (`.sibling`) toggles to appear. This functionality works well and clicking on the same question again closes the answer. However, I now want to modify my JavaScript code to ens ...

Tips on customizing image borders/masks with hover effects

Is there a React library or a simple CSS trick to create an image's canvas cropping effect on hover? For example, similar to this: Thanks in advance! ...

Using the flex:1 property does not automatically make my elements the same size and cover the entire height of the container

I have 2 containers and I want the elements in each container to fill the entire container. My goal is to make one container appear larger than the other. https://i.stack.imgur.com/73yoR.jpg Even though I am using the flex: 1 property, it does not seem t ...

Using Javascript to replace elements with input fields and text areas

I'm currently working on a unique project for my Wordpress blog, where I am developing a custom block editor using JavaScript on the frontend. The goal is to convert all elements from the post content into a series of inputs and textareas. To begin, ...

In the Firefox browser, tables are shown with left alignment

I recently designed a responsive HTML newsletter with all images neatly wrapped in tables. My goal was to ensure that on smaller screens, the tables stack on top of each other for better readability, while on wider displays, they appear side by side in a r ...