I'm generating an image using canvas. I would like to use that image to fill an SVG path background. Only part of the SVG.
I have tried:
<path id="path1" class="st1" d="M80.2,43.1C74,37.8,67.9,32.5,61.7,27.2c1.6-3.6,3.2-7.1,4.8-10.7C71,25.3,75.6,34.2,80.2,43.1z"/>
document.getElementById("path1").setAttribute('fill', "url('" + myCanvas.toDataURL() + "')");
also:
<pattern id="img1" patternUnits="userSpaceOnUse" width="100" height="100">
<image id="bg1" href="" x="0" y="0" width="100" height="100" />
<path id="path1" class="st1" d="M80.2,43.1C74,37.8,67.9,32.5,61.7,27.2c1.6-3.6,3.2-7.1,4.8-10.7C71,25.3,75.6,34.2,80.2,43.1z"fill="url(#img)/>
document.getElementById("bg1").setAttribute('href', "url('" + myCanvas.toDataURL() + "')");
I have tried with and without URL() and with and without quotes.