Sunday, September 8, 2013

Drawing a Heart

<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");

////////////////////////////////////// start below this line ˇˇˇˇˇˇˇˇˇˇ
context.beginPath();
context.lineCap = "round";
context.lineWidth = 8;
context.strokeStyle = 'rgb(200, 0, 0)';
context.fillStyle = 'pink';
context.moveTo(100, 90);
context.quadraticCurveTo(105, 150, 200, 215);
context.quadraticCurveTo(290, 150, 310, 100);
context.quadraticCurveTo(260, 5, 200, 80);
context.quadraticCurveTo(140, 5, 100, 90);
context.stroke();
context.fill();


////////////////////////////////////// end above this line ˆˆˆˆˆˆˆˆˆˆˆˆˆˆˆ

};

</script>
</head>
<body>
<canvas id="myCanvas" width="800" height="600"></canvas>
</body>
</html>





No comments:

Post a Comment