What’s the best way to organize your SVG code? If all you want to draw is a line or simple shape there’s not much to organize, but what about SVGs with multiple shapes and lines that combine to form a more complex whole?
What’s the best way to organize your SVG code? If all you want to draw is a line or simple shape there’s not much to organize, but what about SVGs with multiple shapes and lines that combine to form a more complex whole?
For the last few weeks we’ve been looking at SVG coordinate systems, the SVG canvas, the viewport through which we can see a part of the canvas, and the viewBox that lets us map a region of the canvas into the viewport.
The SVG canvas and the SVG viewport, through which you see the canvas operate on independent coordinate systems. The systems are aligned by default, but you can change the default to move and scale the canvas.
When you see SVG images on the screen you’re viewing only part of the canvas on which they’re drawn and you view the canvas through the SVG viewport. Canvas and viewport are both independent and connected and their relationship can be confusing and lead to unexpected results at times. That is until you understand the relationship and how to control the connection.
Last week I began a discussion about paths, mainly focusing on the different line commands you can use to draw lines and shapes. Today I want to continue the path discussion and talk about the different curve commands at your disposal.