Monday, October 12, 2015

Heart in HTML5

Here is the heart that I made in TextWrangler 
for the in class assignment!

The code for the image:

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

////////////////////////////////////// start below this line ˇˇˇˇˇˇˇˇˇˇ


//Heart
context.beginPath();
context.moveTo(400, 200);
context.bezierCurveTo(300, 0, 50, 200, 250, 350);
context.lineTo(250, 350);
context.quadraticCurveTo(400, 450, 400, 500);
context.lineTo(400, 500);
context.quadraticCurveTo(400, 450, 550, 350);
context.lineTo(550, 350);
context.bezierCurveTo(700, 200, 500, 0, 400, 200);
context.strokeStyle = 'rgb(255, 0, 100)';
context.stroke();


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

};

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

No comments:

Post a Comment