I am working on animating an arrow and I discovered that CSS keyframes and SVG can help achieve this effect.
My goal is to animate the drawing of an arrow from 0 to 100%. The path I have for this arrow is:
<path class="showUp" fill="#4C9FDC" stroke="#000000" stroke-width= "0" d="M165.15 204.15l-4.49-4.49c-2.13-2.13-5.59-2.14-7.72-.01l-.01.01c-2.13 2.13-2.14 5.59-.01 7.72l.01.01 9.09 9.09a4.418 4.418 0 0 0 6.24 0l50.28-50.28c2.12-2.1 2.13-5.53.03-7.65l-.03-.03c-2.13-2.13-5.59-2.14-7.72-.01l-.01.01-45.66 45.63z"/>
To animate the arrow with a stroke, I have set up the following keyframes:
@keyframes Arrow {
from {
stroke-dashoffset: 1000;
}
to {
stroke-dashoffset: 0;
}
}
.showUp {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
animation: Arrow 5s linear forwards;
}
However, the animation is not working as expected. Any suggestions on what I might be doing wrong? Thank you!