Wednesday, February 6, 2013


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

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


var x = 390;
var y = 175;
var controlX1 = 295;
var controlY1 = 25;
var controlX2 = 125;
var controlY2 = 175;
var endX = 300;
var endY = 340;

//Quadratic Curve
var controlX3 = 350;
var controlY3 = 390;
var endX3 = 390;
var endY3 = 470;

var controlX4 = 415;
var controlY4 = 390;
var endX4 = 450;
var endY4 = 350;
var controlX5 = 655;
var controlY5 = 175;
var controlX6 = 325;
var controlY6 = 15;
var endX5 = x;
var endY5 = y;

var rectX = 0;
var rectY = 0;
var rectwidth = 800;
var rectheight = 600;

context.beginPath();
context.rect(rectX, rectY, rectwidth, rectheight);
context.fillStyle = 'rgb(255, 255, 130)';
context.fill();

context.beginPath();
context.moveTo(x,y);
context.bezierCurveTo(controlX1, controlY1, controlX2, controlY2, endX, endY);
context.quadraticCurveTo(controlX3, controlY3, endX3, endY3);
context.quadraticCurveTo(controlX4, controlY4, endX4, endY4);
context.bezierCurveTo(controlX5, controlY5, controlX6, controlY6, endX5, endY5);
context.closePath();
context.fillStyle = 'rgb(255, 100, 150)';
context.fill();
context.lineWidth = 10;
context.strokeStyle = 'rgb(255, 350, 200)';
context.stroke();










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

};

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

No comments:

Post a Comment