Wednesday, September 12, 2012

HEART HTML5 CODE

THIS IS MY CODE FOR THE 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.rect(0, 0, canvas.width, canvas.height);
context.stroke();
var grd = context.createLinearGradient(0, 300, 800, 300);
  grd.addColorStop(0, 'rgb(200,200,250)');
  grd.addColorStop(.5, 'rgb(100,100,255)');
context.fillStyle = grd;
  context.fill();
context.stroke();



context.beginPath();
context.moveTo(400,200);
context.bezierCurveTo(300, 0, 160, 220, 275, 315);
context.quadraticCurveTo(350, 375, 400, 500);
context.quadraticCurveTo(435, 375, 525, 315);
context.bezierCurveTo(650, 200, 520, 0, 400, 200);
context.lineCap = 'round'
context.lineWidth = 14;
context.fillStyle = 'red';
  context.fill();
context.stroke();




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

};

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

No comments:

Post a Comment