Game Development Reference
In-Depth Information
ativity to create the drawing, and let the computer figure out how to represent that
using SVG.
Note
The description attributes for paths can be specified using either a lowercase or
an uppercase letter. The difference is that an uppercase letter means that the
point is absolute, and a lowercase letter means that the point is relative. This
concept of relative and absolute points is not quite the same as in HTML, where
a relative offset means that the destination point is relative to its own original loc-
ation, and an absolute point is one that's completely relative to the element's par-
ent.
In SVG world, an absolute point is relative to the canvas' origin, and a relative
point is relative to the last point defined. For example, if you move the pointer to
location (10, 10), then do a relative move with values of 10 15, the pointer will
end up, not at location (10, 15), but 10 units away from the x position, and 15
units away from the y position. The new position of the pointer would then be loc-
ation (20, 25).
Finally, SVG is capable of rendering text to the screen. Imagine how time consuming
it would be to render each letter by hand using lines and paths. Thankfully, the SVG
API specifies a very simple interface for text rendering.
<svg xmlns="http://www.w3.org/2000/svg"
version="1.1" width="1000" height="1000">
<text
x="100"
y="300"
fill="#c00"
stroke="#333"
stroke-width="2"
style="font-size: 175px">I Love
HTML5!</text>
</svg>
Search WWH ::




Custom Search