Basic Shapes
line |
<line x1="start-x" y1="start-y" x2="end-x" y2="end-y"/>
|
rectangle |
<rect x="left-x" y="top-y" width="width" height="height"/>
|
circle |
<circle cx="center-x" cy="center-y" r="radius"/>
|
ellipse |
<ellipse cx="center-x" cy="center-y" rx="x-radius" ry="y-radius"/>
|
polygon |
<polygon points="points-list"/>
|
polyline |
<polyline points="points-list"/>
|
Transformations
|
moves x
horizontally, y
vertically |
|
multiplies by xFactor
and yFactor
|
|
equivalent to scale(factor, factor)
|
rotate(angle, centerX, centerY)
|
rotates by angle
degrees with center of rotation (centerX, centerY)
|
|
equivalent to rotate(angle, 0, 0)
|
|
skews x-coordinates by angle
degrees |
|
skews y-coordinates by angle
degrees |
|
specifies a transformation matrix of six values |
Angle Measurements
Angle measurements increase clockwise, starting from the positive x-axis.
Grouping and Referencing Objects
grouping |
<g id="id" style="attributes"> </g>
|
use a group |
<use xlink:href="#id" x="x1" y="y1"/>
|
defining groups without displaying |
|
symbol |
<symbol id="id" style="attributes" preserveAspectRatio="attributes" viewBox="x1 y1 x2 y2"> </symbol>
|
Gradients
attributes |
|
|
|
|
|
|
|
|
|
|
|
|
<linearGradient>
attributes |
|
|
<radialGradient>
attributes |
|
|
elements |
|
|
|
|
|
|
Clipping and masking
clipping |
|
|
<use xlink:href="#imageid" style="clip-path: url(#pathid);"/>
|
masking |
|
|
clipPathUnits
maskUnits
maskContentUnits
|
objectBoundingBox
, userSpaceOnUse
|
|
|
|
|
|
fill: color
; white specified for opacity only |
Filters
|
|
filterUnits
primitiveUnits
|
objectBoundingBox
, userSpaceOnUse
|
|
can create a drop shadow |
|
SourceAlpha
, SourceGraphic
|
|
|
|
|
Stroke Attributes
|
specify stroke attributes in style
|
|
stroke color; default is none
|
|
width of stroke; default is one
|
|
a value between 0.0
(transparent) and 1.0
(opaque, the default) |
|
a list of the lengths of dashes and gaps; default is none
|
|
specifies shape of endpoints: butt
(default), round
, or square
|
|
specifies shape of corners: miter
(pointed, the default), round
, or bevel
(flat) |
|
maximum ratio of length of the miter point to width of the lines; default is 4
|
Fill Attributes
|
specify fill attributes in style
|
|
fill color; default is black
|
|
a value between 0.0
(transparent) and 1.0
(opaque, the default) |
|
determines whether a point is inside a shape; nonzero
(default) or evenodd
|
Paths
<path d="command arguments"/>
|
uppercase commands: absolute coordinates |
lowercase commands: relative coordinates |
Command |
Arguments |
Effect |
|
|
|
|
|
|
|
|
close path |
|
|
|
|
|
|
|
rx ry x-axis-rotation large-arc sweep x y
|
elliptical arc to ( x
, y
); points lie on ellipse with x-radius rx
, y-radius ry
, rotated x-axis-rotation
degrees; if arc < 180°, large-arc
is 0
; if arc direction is positive, sweep
is 1
|
|
|
quadratic Bézier curve to ( x
, y
) using control point ( x1
, y1
) |
|
|
quadratic Bézier curve to ( x
, y
) using reflection of previous Q
's control pt |
|
|
cubic Bézier curve to ( x
, y
) using control pt 1 ( x1
, y1
) and control pt 2 ( x2
, y2
) |
|
|
cubic Bézier curve to ( x
, y
) using reflection of previous C
's control pt for control pt 1 and ( x2
, y2
) for control pt 2 |
Text
<text x="x" y="y"> displayed</text>
|
|
|
serif, sans-serif, monospace, fantasy, cursive
|
|
|
|
|
|
|
|
none, underline, overline, line-through
|
|
|
|
|
|
|
|
|
|
spacing
(def), spacingAndGlyphs
|
|
|
glyph-orientation-vertical
|
0
( letter-spacing:−#
), 90
(def) |
|
|
|
|
<text> <textPath xlink:href="#path-id">text</textPath> </text>
|
|
|
<tspan style="attributes">spanned text</tspan>
|
|
offset chars by x or y |
|
place chars at x or y |
|
rotate chars by angle |
|
|
|
|
|