SVG Notes: Line & Rect Reference

Just a guy who loves to write code and watch anime.
Search for a command to run...

Just a guy who loves to write code and watch anime.
No comments yet. Be the first to comment.
Qualities that make outstanding builders.

Bipedal vs quadrupedal: how many legs This is about the number of legs the creature walks on. Bipedal. Two legs. Humans, ostriches, T-rex, kangaroos, most fantasy humanoids. Quadrupedal. Four legs. Do

Intro You hear "lerp" and "smoothstep" everywhere in game dev. They sound like math jargon. They're not. Both are small tools that do the same job: smoothly move from one value to another. The problem

What is Kinematics Kinematics is the math field. It's the study of how things move without worrying about forces (which would be dynamics). FK and IK are the two branches: forward kinematics and inver

Intro Textures are usually the biggest cost in a 3D scene. Memory, bandwidth, and load time all get eaten by them. Resizing them is the obvious lever. There's more. This post is about the less obvious

<rect x="10" y="10" width="50" height="30" />
x, y = top-left corner position
width, height = dimensions
<rect x="10" y="10" width="50" height="30" rx="5" ry="5" />
rx = horizontal corner radius
ry = vertical corner radius
If only rx specified, ry matches automatically
<rect x="10" y="10" width="50" height="30" fill="blue" stroke="red" stroke-width="2" />
<line x1="10" y1="10" x2="90" y2="50" />
x1, y1 = start point
x2, y2 = end point
Important: Lines need stroke to be visible (no area to fill)
<line x1="10" y1="10" x2="90" y2="10" stroke="black" stroke-linecap="round" />
stroke-linecap options:
"butt" (default) -> flat ends
"round" -> rounded ends
"square" -> extends past endpoints
<line x1="10" y1="10" x2="90" y2="10" stroke="black" stroke-dasharray="5,5" />
stroke-dasharray="5,5" = 5 units dash, 5 units gap
stroke-dasharray="10,3,2,3" = complex patterns
Lines have no area, so fill does nothing
Rectangles can have both fill and stroke
Both work with transform for rotation/scaling
Both use viewBox coordinates