FINALS ACTIVITY2 DRAWING CANVA
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="800" height="400" style="border:1px solid #d3d3d3;">
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.fillStyle="orange";
ctx.fillRect(300,50,350,200);
ctx.fill();
ctx.stroke();
ctx.beginPath();
ctx.fillStyle="white";
ctx.arc(400,150,50,0,2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="black";
ctx.arc(400,150,20,0,2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="black";
ctx.arc(570,150,50,0,2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="white";
ctx.arc(570,150,20,0,2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="black";
ctx.fillRect(550,250,20,60,30);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="black";
ctx.fillRect(400,250,20,60,30);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.fillStyle="red";
ctx.arc(485,200,30,75,1*Math.PI);
ctx.stroke();
ctx.fill();
</script>
</body>
Comments
Post a Comment