SVG ECG Animation

HTML

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 70 70">
  <title>SVG ECG Animation</title>
 
  <path d="m0,50
    l20,0 l5,-5 l5,15 l5,-40
    l5,40 l5,-15 l5,5 l20, 0"
    class='path1'/>


  <path d="m0,50
    l18,0 l5,-5 l5,15 l5,-40
    l5,40 l5,-15 l5,5 l22, 0"
    class='path2'/>


<svg>

CSS

svg{
    background-color: black;
    width: 200px;
}
path {
    stroke: #16FF43;
    fill: none;
    stroke-width: 1;
}
.path1 {
  stroke-dasharray: 170, 180;
  animation: pulse 2s infinite linear;
}

@keyframes pulse {
  0% {
    stroke-dashoffset: 350;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.path2 {
  stroke-dasharray: 170, 180;
  animation: pulse2 2s infinite linear;
}

@keyframes pulse2 {
  0% {
    stroke-dashoffset: 525;
  }
  100% {
    stroke-dashoffset: 175;
  }
}