I was looking for something like this just a few weeks ago.
Side note - if there's a brief millisecond where your hero section loads without the SVG, I recommend encoding it and adding it directly to your CSS. You can use something like https://yoksel.github.io/url-encoder/ to get the background-image CSS. It fixed the minor flash of unstyled content I was experiencing.