I have created SVG cursor and I would like to dynamically change cursor radius on mouse scroll, zoom in increase radius, zoom out decrease radius.
CSS SVG cursor, this works:
.brushCursor {
cursor: url('data:image/svg+xml;utf8,<svg id="svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32"><circle cx="10" cy="10" r="5" stroke-width="2" style="stroke: black; fill: red;"/></svg>') 10 10, pointer;
}
But I want to change SVG's radius dynamically. Radius should be in the range 1 to 10. So far I made this but the cursor is not updating:
const brush = document.querySelector('.brush');
const radius = 5;
brush.style.cursor = `url('data:image/svg+xml;utf8,<svg id="svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="32" height="32"><circle cx="10" cy="10" r=${radius} stroke-width="2" style="stroke: black; fill: red;"/></svg>')`;