How to make an animation of the border at the button?

That's the animation it turns out, please tell me method of implementation
April 7th 20 at 15:24
2 answers
April 7th 20 at 15:26
SVG + js a bit, ready here you can find
April 7th 20 at 15:28
Crutches of course, but like it. Probably it is possible and to do differently, but the principle is clear I think.
But this is only if the background is solid. With transparent it won't work, I guess.

Find more questions by tags CSSJavaScript