Wednesday, September 12, 2012

Heart in class



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

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

var controlX1 = 300;
var controlY1 = 0;
var controlX2 = 100;
var controlY2 = 200;
var endX = 250;
var endY = 325;
var controlX = 380;
var controlY = 400;
var endX1 = 400;
var endY1 = 500;
var controlX3 = 435;
var controlY3 = 400;
var endX2 = 550;
var endY2 = 325;
var controlX4 = 700;
var controlY4 = 200;
var controlX5 = 500;
var controlY5 = 0;
var endX3 = 400;
var endY3 = 200;

context.beginPath();
context.rect(0, 0, 800, 600);
var grd=context.createRadialGradient(0, 0, 100, 800, 600, 200);
  grd.addColorStop(0, 'rgb(100,80,255)');
  grd.addColorStop(1, 'rgb(250,45,67)');
context.fillStyle = grd;
context.fill();
context.lineWidth = 15;
context.stroke();

context.beginPath();
context.moveTo(400,200);
context.bezierCurveTo(controlX1, controlY1, controlX2, controlY2, endX, endY);
context.quadraticCurveTo(controlX, controlY, endX1, endY1);
context.quadraticCurveTo(controlX3, controlY3, endX2, endY2);
context.bezierCurveTo(controlX4, controlY4, controlX5, controlY5, endX3, endY3);
var grd = context.createLinearGradient(0, 0, 800, 600);
  grd.addColorStop(0, 'rgb(0150,69,0)');
  grd.addColorStop(1, 'rgb(96,96,96)');
context.fillStyle = grd;
context.fill();
context.lineCap = 'round';
context.lineWidth = 10;
context.stroke();










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

};

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

No comments:

Post a Comment