Tuesday, September 11, 2012

Heart Code




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

////////////////////////////////////// start below this line ˇˇˇˇˇˇˇˇˇˇ
var startX = 400
var startY = 250
var controlPointX = 200
var controlPointY = 100
var endX = 150
var endY = 300 
var startX = 400
var startY = 250
var controlPointX = 600
var controlPointY = 100
var endX = 650
var endY = 300 

context.beginPath ();
context.moveTo (400, 250);
context.quadraticCurveTo(200, 100, 150, 300);
context.lineWidth = 10;
context.strokeStyle = "red";
context.stroke (); 


context.beginPath ();
context.moveTo (400, 250);
context.quadraticCurveTo(600, 100, 650, 300);
context.lineWidth = 10;
context.strokeStyle = "red";
context.stroke (); 

context.beginPath();
context.moveTo(150, 300);
context.lineTo(400, 600);
context.stroke();

context.beginPath();
context.moveTo(650, 300);
context.lineTo(400,600);
context.stroke();


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

};

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

No comments:

Post a Comment