Wednesday, 18 October 2017

NIIT HTML Q3 ACTIVITY BOOK CHAPTER 6 Smiley face ~ niit post

Q3) You have been assigned a task to create a smiley on canvas. the face of the smiley
     should be colored in yellow, with eye balls colored in blue, and month outline in red, as shown in the following  figure. How will you perform this task?

Ans3)

<!Doctype HTML><html>
<head>
</head>
<body>
<canvas id="canvas" width='500' height="500"></canvas>
<script>
var ctc=document.getElementById("canvas");
var ctx=ctc.getContext("2d");
ctx.beginPath();
ctx.arc(150, 150, 100, 0, 2 * Math.PI, false);
ctx.closePath();
ctx.fillStyle="gold";
ctx.stroke();
ctx.fill();

ctx.beginPath();
ctx.arc(120, 130, 20, 0, 2 * Math.PI, false);
ctx.closePath();
ctx.fillStyle = "white";
ctx.stroke();
ctx.fill();


ctx.beginPath();
ctx.arc(123, 133, 4, 0, 2 * Math.PI, false);
ctx.closePath();
ctx.fillStyle="blue";
ctx.stroke();
ctx.fill();


ctx.beginPath();
ctx.arc(180, 130, 20, 0, 2 * Math.PI, false);
ctx.closePath();
ctx.fillStyle = "white";
ctx.stroke();
ctx.fill();


ctx.beginPath();
ctx.arc(183, 133, 4, 0, 2 * Math.PI, true);
ctx.closePath();
ctx.fillStyle = "blue";
ctx.stroke();
ctx.fill();

ctx.beginPath();
ctx.arc(155, 165, 60, 0, 3, false);
ctx.closePath();
ctx.lineWidth = 5;
ctx.strokeStyle = "red";
ctx.fillStyle = "white";
ctx.stroke();
ctx.fill();

</script>
</body>
</html>

1 comment:

  1. The Betway Group - JT Hub
    The Betway Group, a company principally engaged in the 영천 출장마사지 acquisition 시흥 출장마사지 of a number of segments of 익산 출장안마 online gambling the Betway Group 동두천 출장안마 in a deal 의왕 출장샵 with online gambling sites

    ReplyDelete