-->

HTML with SVG to animate object

<html>

<head>

    <head>
        <title>
            html with SVG tag. It stands for scalable vector graphics. It is used for vector based graphics in XML. We use this tag for graphics on web/page.
        </title>
    </head>

    <body>
        <svg viewbox="0 0 200 200"><!--</svg><svg width="100" height="100">-->
            <!--we always use svg for image size. If we donot, it takes 0,0 by default-->

            
        <rect width="100" height="100">
            <animate attributeName="rx" values="0;100;3" dur="5s" repeatCount="indefinite"/>
        </rect>
        <!--since we are going to put text, we use attributes-->
        <!-- 
           ->rx is the attribute name
           ->values=o is starting time
                    =100 is the speed of animation 
                    =0 is start that animation from 0
            ->dur=5s is the time for which animation will be in effect and then it repeats
           ->repeatcount:-It repeats the animation indefinite times
        </svg>
    </body>


</html>

HTML with SVG to animate the circle.

<html>

<head>

    <head>
        <title>
            html with SVG tag. It stands for scalable vector graphics. It is used for vector based graphics in XML. We use this tag for graphics on web/page.
        </title>
    </head>

    <body>
        <svg viewbox="0 0 200 200"><!--</svg><svg width="100" height="100">-->
            <!--we always use svg for image size. If we donot, it takes 0,0 by default-->

            
        <circle cx="10" cy="10" r="20">
            <animateMotion dur="10s" repeatCount="indefinite" path="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />
        </circle>
        <!--since we are going to animate our text , we use attributes-->
        <!-- 
           ->path attribute creates path using different co-ordinates. We have already discussed about this
            ->dur=10s is the time for which animation will be in effect and then it repeats
           ->repeatcount:-It repeats the animation indefinite times
        </svg>
    </body>


</html>

HTML with CANVAS to draw rectangle.

<html>

<head>

    <head>
        <title>
            html with canvas tag.  We use this tag for graphics on web/page.
        </title>
    </head>

    <body>
        <canvas id="size" width="500" height="600" style="border:4px solid;border-color:  purple;">
            <!--we always use canvas id for script-->
            <!--since we are going to draw rectangle, we use attribute width and height with style/css-->
            <!-- here the width and height defines canvas size-->
            <!--since it has no border so-->
            <!--we can use different color with the help of css-->
        
        
        </canvas>




    </body>


</html>

HTML with CANVAS to draw square.

<html>

<head>

    <head>
        <title>
            html with canvas tag. It is used to draw graphics on HTML page. With this canvas tag, we use javascript to draw it.
        </title>
    </head>

    <body>
        <canvas id="square" width="200" height="200" style="border:7px dotted #000089;">
            <!--we always use canvas id for script-->
            <!--since we are going to draw square, we use attribute width and height with style/css-->
            <!-- here the width and height defines canvas size-->
            <!--since it has no border so-->
            <!--we can use different color with the help of css-->
        </canvas>


    </body>


</html>

HTML with canvas to draw straight line.

<html>

<head>

    <head>
        <title>
            html with canvas tag. It is used to draw graphics on HTML page. With this canvas tag, we use javascript to draw it.
        </title>
    </head>

    <body>
        <canvas id="straightline" width="200" height="200" style="border:7px dotted #000089;">
            <!--we always use canvas id for script-->
            <!--since we are going to draw square, we use attribute width and height with style/css-->
            <!-- here the width and height defines canvas size-->
            <!--since it has no border so-->
            <!--we can use different color with the help of css-->

        </canvas>
        <script>
            var ele = document.getElementById("straightline"); //this code finds the canvas Element using getElementbyID
            var object = ele.getContext("2d"); //it creates an object for given canvas using getcontext. Then stores in variable
            object.moveTo(0, 0); //it is the starting point of line.
            object.lineTo(200, 200); //it is the ending part of line
            object.stroke(); //it draws or connects both the co-ordinates
        </script>
    </body>


</html>

HTML with canvas to draw circle.

<html>

<head>

    <head>
        <title>
            html with canvas tag. It is used to draw graphics on HTML page. With this canvas tag, we use javascript to draw it.
        </title>
    </head>

    <body>
        <canvas id="straightline" width="500" height="500" style="border:7px dotted #000089;">
            <!--we always use canvas id for script-->
            <!--since we are going to draw circle, we use attribute width and height with style/css-->
            <!-- here the width and height defines canvas size-->
            <!--since it has no border so-->
            <!--we can use different color with the help of css-->

        </canvas>
        <script>
            var ele = document.getElementById("straightline"); //this code finds the canvas Element using getElementbyID
            var object = ele.getContext("2d"); //it creates an object for given canvas using getcontext. Then stores in variable
            object.beginPath(); //it begins the path
            object.arc(100, 100, 100, 0,  2*Math.PI); //it creates the arc/curve with
            //first value is x-co-ordinate
            //second value is y-co-ordinate
            //third value is radius
            //forth value is starting angle 
            //last value is for one complete rotation/360
            object.stroke(); //it draws the circle
        </script>
    </body>


</html>

HTML with canvas to draw arc.

<html>

<head>

    <head>
        <title>
            html with canvas tag. It is used to draw graphics on HTML page. With this canvas tag, we use javascript to draw it.
        </title>
    </head>

    <body>
        <canvas id="straightline" width="500" height="500" style="border:7px dotted #000089;">
            <!--we always use canvas id for script-->
            <!--since we are going to draw arc, we use attribute width and height with style/css-->
            <!-- here the width and height defines canvas size-->
            <!--since it has no border so-->
            <!--we can use different color with the help of css-->

        </canvas>
        <script>
            var ele = document.getElementById("straightline"); //this code finds the canvas Element using getElementbyID
            var object = ele.getContext("2d"); //it creates an object for given canvas using getcontext. Then stores in variable
            object.beginPath(); //it begins the path
            object.arc(100, 100, 100, 0, Math.PI); //it creates the arc/curve (half circle). We can also use Math.PI/2
            //first value is x-co-ordinate
            //second value is y-co-ordinate
            //third value is radius
            //forth value is starting angle 
            //last value is for one complete rotation/360
            object.stroke(); //it draws the circle
        </script>
    </body>


</html>