Search code examples
animationsvgmicrosoft-edgesvg-animate

SVG Circle not animated in Edge


The below svg animates perfectly in all browsers but Edge (surprise!).

<svg width="80" height="24" viewBox="0 0 120 30" xmlns="http://www.w3.org/2000/svg" fill="#555">
    <circle cx="15" cy="15" r="15">
        <animate attributeName="r" from="15" to="15"
                 begin="0s" dur="0.8s"
                 values="15;9;15" calcMode="linear"
                 repeatCount="indefinite" />
        <animate attributeName="fill-opacity" from="1" to="1"
                 begin="0s" dur="0.8s"
                 values="1;.5;1" calcMode="linear"
                 repeatCount="indefinite" />
    </circle>

</svg>

I tried adding px as units but no luck.

Thanks for your tips!


Solution

  • After reading the comments and answers I decided to go for clear CSS animation, instead of SVG. I grabbed the code from https://projects.lukehaas.me/css-loaders/ and my "solution" looks like this:

    <style>
    .loader,
    .loader:before,
    .loader:after {
      border-radius: 50%;
      width: 2.2em;
      height: 2.2em;
      -webkit-animation-fill-mode: both;
      animation-fill-mode: both;
      -webkit-animation: load7 1.3s infinite ease-in-out;
      animation: load7 1.3s infinite ease-in-out;
    }
    .loader {
      color: #888;
      font-size: 10px;
      margin: 80px auto;
      position: relative;
      text-indent: -9999em;
      -webkit-transform: translateZ(0);
      -ms-transform: translateZ(0);
      transform: translateZ(0);
      -webkit-animation-delay: -0.16s;
      animation-delay: -0.16s;
    }
    .loader:before,
    .loader:after {
      content: '';
      position: absolute;
      top: 0;
    }
    .loader:before {
      left: -3.5em;
      -webkit-animation-delay: -0.32s;
      animation-delay: -0.32s;
    }
    .loader:after {
      left: 3.5em;
    }
    @-webkit-keyframes load7 {
      0%,
      80%,
      100% {
        box-shadow: 0 2.2em 0 -1.3em;
      }
      40% {
        box-shadow: 0 2.2em 0 0;
      }
    }
    @keyframes load7 {
      0%,
      80%,
      100% {
        box-shadow: 0 2.2em 0 -1.3em;
      }
      40% {
        box-shadow: 0 2.2em 0 0;
      }
    }
    </style>
    
    <div class="loader">Loading...</div>