DEV Community

netsi1964 πŸ™πŸ»
netsi1964 πŸ™πŸ»

Posted on

Screen coordinates to SVG coordinates

If you want to use mouse coordinates over an SVG element you need to use some code to convert screen coordinates to SVG coordinates. Here is an example of how to do it. Check the CTM transform checkbox to see it in action. The pulse animation on the unselected checkbox is from another pen: https://codepen.io/olam/pen/zcqea

2020-10-16: Cleaned up code and refactored UI

Top comments (0)