<div>
  <svg xmlns="http://www.w3.org/2000/svg" 
     width="80px" height="60px"
     viewBox="5 0 80 60">
    <path id="wave1" 
        fill="none" 
        stroke="#262626" 
        stroke-width="4"
          stroke-linecap="round">
    </path>
  </svg>
</div>

<div>
  <svg xmlns="http://www.w3.org/2000/svg" 
     width="80px" height="60px"
     viewBox="5 0 80 60">
    <path id="wave2" 
        fill="none" 
        stroke="#262626" 
        stroke-width="4"
        stroke-linecap="round">
    </path>
  </svg>
</div>
html, body { 
  height: 100%;
  margin: 0;
  width: 100%;
}

body { 
  align-items: center; 
  display: flex; 
}

div {
  align-items: center;
  border: 4px solid #262626;
  display: flex;
  height: 110px;
  margin: 0 auto;
  width: 110px;
}

svg { 
  margin: 0 auto; 
  overflow: hidden;
}

#wave1 {
  stroke-dasharray: 0 16 101 16;
  animation: moveTheWaveOnly 2400ms linear infinite;  
}

@keyframes moveTheWaveOnly {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-90px, 0, 0); }
}

#wave2 {
  stroke-dasharray: 0 16 101 16;
  animation: moveTheWaveAndDash 2400ms linear infinite;  
}

@keyframes moveTheWaveAndDash {
  0% { 
    stroke-dashoffset: 0; 
    transform: translate3d(0, 0, 0); 
  }
  100% {
    stroke-dashoffset: -133; 
    transform: translate3d(-90px, 0, 0); 
  }
}
View Compiled
function buildWave(w, h) {
 
  var m = 0.512286623256592433;
  
  var pathData = [
    'M', 0, h * 0.625, 
    'c',  0.25 * h * m, 0,
    0.25 * h * (1 - m), -0.25 * h, 
    0.25 * h, -0.25 * h,
    's', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h,
    's', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h,
    's', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h,
    's', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h,
    's', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h,'s', 0.25 * h * (1 - m), 0.25 * h,
    0.25 * h, 0.25 * h,
    's', 0.25 * h * (1 - m), -0.25 * h,
    0.25 * h, -0.25 * h
  ].join(' ');
  
  wave1.setAttribute('d', pathData);
  wave2.setAttribute('d', pathData);
}

var wave1 = document.querySelector('#wave1');
var wave2 = document.querySelector('#wave2');
buildWave(90, 60);

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.