What is a
path? A path can be defined as the representation of outline of shapes which
can be filled, stroked and can also be used as clipping path. Without the
concept of a current point path’s description cannot be given, now in SVG a path
is defined by the element called 'path'. Path in SVG is used to represent the
outline of a shape and also it is used
for representation the geometry of the
outline of object.
Below is the detailed example for SVVG Path.
Example:
<!DOCTYPE html>
<html>
<head lang="EN">
<title>Nirajan Ghmirey’s Workshop</title>
</head>
<body>
<h4>SVG Path Examples</h4>
<svg height="400" width="450">
<path id="lineAB" d="M 100 350 l 150 -300" stroke="black" stroke-width="3" fill="none" />
<path id="lineBC" d="M 250 50 l 150 300" stroke="black" stroke-width="3" fill="none" />
<path d="M 175 200 l 150 0" stroke="yellow" stroke-width="3" fill="none" />
<path d="M 100 350 q 150 -300 300 0" stroke="green" stroke-width="5" fill="none" />
<!-- Mark relevant points -->
<g stroke="black" stroke-width="3" fill="black">
<circle id="pointA" cx="100" cy="350" r="3" />
<circle id="pointB" cx="250" cy="50" r="3" />
<circle id="pointC" cx="400" cy="350" r="3" />
</g>
<!-- Label the points -->
<g font-size="30" font="sans-serif" fill="black" stroke="none" text-anchor="middle">
<text x="100" y="350" dx="-30">A</text>
<text x="250" y="50" dy="-10">B</text>
<text x="400" y="350" dx="30">C</text>
</g>
Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>
No comments:
Post a Comment