Creating a Panning Effect for SVG

Earlier this month on the Animation at Work Slack, we had a discussion about finding a way to let users pan inside an SVG.

I made this demo below to show how I’d approach this question:
See the Pen Demo – SVG Panning by Louis Hoebregts (@Mamboleoo) on CodePen.
Here are the four steps to make the above demo work:

Get mouse and touch events from the user
Calculate the mouse offsets from its origin

The post Creating a Panning Effect for SVG appeared first on CSS-Tricks.