<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
#myownCanvas {
border: 1px solid #9C9898;
}
</style>
<script>
window.onload = function () {
var canvas = document.getElementById("myownCanvas");
var context = canvas.getContext("2d");
var a = canvas.width / 2;
var b = canvas.height / 2;
var radius = 85;
var offset = 60;
context.save();
context.beginPath();
context.arc(a, b, radius, 0, 2 * Math.PI, false);
context.clip();
context.beginPath();
context.arc(a - offset, b - offset, radius, 0, 2 * Math.PI, false);
context.fillStyle = "Black";
context.fill();
context.beginPath();
context.arc(a + offset, b, radius, 0, 2 * Math.PI, false);
context.fillStyle = "pink";
context.fill();
context.beginPath();
context.arc(a, b + offset, radius, 0, 2 * Math.PI, false);
context.fillStyle = "Brown";
context.fill();
context.restore();
context.beginPath();
context.arc(a, b, radius, 0, 2 * Math.PI, false);
context.lineWidth = 3;
context.strokeStyle = "Red";
context.stroke();
};
</script>
</head>
<body>
<canvas id="myownCanvas" width="578" height="200"></canvas>
</body>
</html>
|