WEEK2
WEEK2
AIM : Develop the Different basic Graphical Shapes using HTM5 SVG
DESCRIPTION:
SVG, i.e., Scalable Vector Graphics, which is an image format, but they are different from
raster images such as .png, .jpg, and .gif, which use a grid of tiny pixels to create an image.
When .png and .jpg images are zoomed in, then the pixels become larger, and the image
becomes blurry. Still, the vector image can be scaled to any size without losing its resolution
because its appearance is based on geometry instead of fixed pixels.
HTML SVG is a modularized language for describing graphics in XML format. It describes
two-dimensional vector and mixed vector/raster graphics. The W3C recommends it.
SVG is mostly used for vector-type diagrams, such as pie charts and 2-dimensional graphs in
an X and Y coordinate system.
Four programs by using the canvas.
<html >
<body>
<svg width="500" height="500">
/* where G is the container and multiple elements can be used together */
<g>
<rect height="140" width="300" x="50" y="50" style="fill: white stroke: black stroke-width:1;"/>
<rect height="100" width="260" x="70" y="70" style="fill: black;" />
</g>
</svg>
</body>
</html>
OUTPUT
OUTPUT
3. Face( )
<html>
<body>
<svg width="500" height="500">
<g>
<circle cx="200" cy="200" r="70" fill="#E8BEAC" stroke="black" stroke-width="2" />
<circle cx="170" cy="175" r="15" fill="white" stroke="black" stroke-width="7" />
<circle cx="230" cy="175" r="15" fill="white" stroke="black" stroke-width="7" />
<circle cx="112" cy="190" r="20" fill="#E8BEAC" stroke="black" stroke-width="2" />
<circle cx="285" cy="190" r="20" fill="#E8BEAC" stroke="black" stroke-width="2" />
<line x1="200" y1="230" x2="200" y2="200" stroke="black" stroke-width="3" />
<path d="M 165 215 a1,0.9 0 0,0 70,0" fill="none" stroke="black" stroke-width="3" />
</g>
</svg>
</body>
</html>
OUTPUT
OUTPUT