Here is the fiddle and below is the CSS code (the HTML is just an SVG ellipse). It works in Chrome, Firefox and Opera, but doesn't work in IE and Edge. What to do to see the animation in IE and Edge?
#my-circle {
stroke: blue;
stroke-dasharray: 1100;
stroke-dashoffset: 500;
-moz-animation: draw-first-shape 1s forwards 3;
-webkit-animation: draw-first-shape 1s forwards 3;
animation: draw-first-shape 1s forwards 3;
}
@-moz-keyframes draw-first-shape {
from {
stroke-dashoffset: 1100;
}
to {
stroke-dashoffset: 0;
}
}
@-webkit-keyframes draw-first-shape {
from {
stroke-dashoffset: 1100;
}
to {
stroke-dashoffset: 0;
}
}
@keyframes draw-first-shape {
from {
stroke-dashoffset: 1100;
}
to {
stroke-dashoffset: 0;
}
}
Even though MSDN says that as of MS Edge the stroke-dashoffset property is animatable with CSS animations and transitions, it still doesn't work for some reason. If we re-create this animation using
stroke-dasharray
instead ofstroke-dashoffset
then it works as expected in Edge.But it will still not work in IE11 or lower because again as indicated in MSDN, the
stroke-dasharray
is animatable using CSS animations and transitions only from MS Edge.The modified animation still works in latest versions of Chrome, Firefox and Opera.
As a workaround for MS Edge, you can animate
stroke-width
(making a tiny variation of its value) together withstroke-dashoffset
. For instance, in the case of the question: