Exercise 10 : Drawing in canvass (IMD)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Exercise 010 Drawing in Canvas</title>
</head>
<body>
<canvas id="myCanvas" width="1350" height="700"
style="border:56px solid #302f2f;">
</canvas>
<script>
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");
ctx.globalAlpha = 0.9
ctx.fillStyle = "#d4172d";
ctx.fillRect(65,75,125,125);
ctx.fillStyle = "#ba9565";
ctx.fillRect(85,95,125,125);
ctx.fillStyle = "#11a882";
ctx.fillRect(100,110,125,125);
ctx.fillStyle = "#8f396e";
ctx.fillRect(120,128,125,125);
ctx.fillStyle = "#00aeff";
ctx.beginPath();
ctx.arc(180,190,50,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#fffde3";
ctx.beginPath();
ctx.arc(180,190,40,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#513896";
ctx.beginPath();
ctx.arc(180,190,30,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#1f1e1d";
ctx.beginPath();
ctx.arc(842,106,75,0,2*Math.PI); ctx.arc(480,106,75,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#e3e0dc";
ctx.beginPath();
ctx.arc(650,375,269,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#141414";
ctx.beginPath();
ctx.arc(752,245,56,0,2*Math.PI); ctx.arc(545,245,56,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#141414";
ctx.beginPath();
ctx.arc(752,600,56,0,2*Math.PI); ctx.arc(545,600,56,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#2a2b2a";
ctx.beginPath();
ctx.arc(704,589,25,0,2*Math.PI); ctx.arc(601,589,25,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#2a2b2a";
ctx.beginPath();
ctx.arc(739,549,25,0,2*Math.PI); ctx.arc(565,549,25,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#2a2b2a";
ctx.beginPath();
ctx.arc(790,558,25,0,2*Math.PI); ctx.arc(510,558,25,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#525252";
ctx.beginPath();
ctx.arc(764,254,15,0,2*Math.PI); ctx.arc(565,254,15,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#141414";
ctx.beginPath();
ctx.arc(652,425,32,0,2*Math.PI);
ctx.arc(669,435,25,0,2*Math.PI);
ctx.arc(634,435,25,0,2*Math.PI);
ctx.fill();
ctx.fillStyle = "#0a6e0a";
ctx.fillRect(925,0,35,815);
ctx.fillRect(1005,0,35,815);
ctx.fillRect(1094,0,32,815);
ctx.fillRect(1200,0,35,815);
</script>
</body>
</html>

Comments
Post a Comment