<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
//////////////////(radial gradient, linear gradient, 10 other elements)///////////////
///Room///////////
//Carpet//////
context.beginPath();
context.moveTo(0,500);
context.lineTo(0,600);
context.lineTo(800,600);
context.lineTo(600,500);
context.fillStyle = 'red';
context.fill();
//NorthWall///
var grd = context.createLinearGradient(0,500,0,0);
context.beginPath();
context.rect(0,0,600,500);
grd.addColorStop(0, 'rgb(200,200,200)');
grd.addColorStop(.1, 'rgb(250,250,250)');
context.fillStyle = grd;
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'gray';
context.stroke();
//EastWall///
var grd = context.createLinearGradient(600,500,800,100);
context.beginPath();
context.moveTo(600,0);
context.lineTo(600,500);
context.lineTo(800,600);
context.lineTo(800,0);
grd.addColorStop(0, 'rgb(200,200,200)');
grd.addColorStop(.1, 'rgb(250,250,250)');
context.fillStyle = grd;
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'gray';
context.stroke();
//Door//////////////
context.beginPath();
context.moveTo(70,500);
context.lineTo(250,500);
context.lineTo(250,140);
context.lineTo(70,140);
context.lineTo(70,500);
context.fillStyle = 'brown';
context.stroke();
////////////////////////////////////// end above this line
};
</script>
</head>
<body>
<canvas id="myCanvas" width="800" height="600"></canvas>
</body>
</html>
No comments:
Post a Comment