Project 1
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title> ART 210 - CANVAS PROJECT </title>
<style type="text/css">
body,td,th {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
color: rgba(0,0,0,1);
}
body {
background-color: rgba(255,255,255,1);
}
#myCanvas { border: rgba(102,0,255,1) medium dashed; }
</style>
</head>
<body>
<canvas id="myCanvas" width="1000" height="1000"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
//// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> YOUR CODE STARTS HERE
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.rect(0, 0, canvas.width, canvas.height);
// add linear gradient
var grd = context.createLinearGradient(0, 0, canvas.width, canvas.height);
// light blue
grd.addColorStop(0, '#808080');
// dark blue
grd.addColorStop(1, '#ff5c33');
context.fillStyle = grd;
context.fill();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(150, 500);
context.lineTo(150, 50);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(475, 500);
context.lineTo(475, 50);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(150, 50);
context.lineTo(225, 150);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(400, 150);
context.lineTo(475, 50);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(222, 150);
context.quadraticCurveTo(300, 100, 403, 150);
context.lineWidth = 7;
// line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(175, 335);
context.lineTo(312, 370);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(310, 370);
context.lineTo(450, 335);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(175, 332);
context.lineTo(175, 450);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(450, 332);
context.lineTo(450, 450);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(175, 448);
context.lineTo(250, 500);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(375, 500);
context.lineTo(450, 448);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(248, 500);
context.lineTo(377, 500);
context.lineWidth = 7;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(312, 280);
context.lineTo(312, 370);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(205, 260);
context.lineTo(280, 275);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(344, 275);
context.lineTo(419, 260);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(250, 290);
context.lineTo(280, 275);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(205, 260);
context.lineTo(252, 290);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(344, 275);
context.lineTo(374, 290);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(372, 290);
context.lineTo(419, 260);
context.lineWidth = 5;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(180, 245);
context.bezierCurveTo(240, 200, 210, 230, 290, 260);
context.lineWidth = 5;
// line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(335, 260);
context.bezierCurveTo(400, 230, 400, 200, 440, 245);
context.lineWidth = 5;
// line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(252, 415);
context.bezierCurveTo(260, 400, 364, 400, 372, 415);
context.lineWidth = 5;
// line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(280, 450);
context.bezierCurveTo(295, 440, 329, 440, 344, 450);
context.lineWidth = 4;
// line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(312, 460);
context.lineTo(312, 485);
context.lineWidth = 3;
// set line color
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(625, 650, 65, 275);
context.fillStyle = 'gainsboro';
context.fill();
context.lineWidth = 4;
context.strokeStyle = 'gainsboro';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(615, 810, 10, 117);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(690, 810, 10, 117);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(640, 810, 10, 117);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(665, 810, 10, 117);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 1;
context.strokeStyle = 'black';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(623, 740, 70, 60);
context.fillStyle = 'gainsboro';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'darkgrey';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(693, 685, 3, 20);
context.fillStyle = 'red';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'red';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(647, 740, 23, 60);
context.fillStyle = '#ffd24d';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'darkgrey';
context.stroke();
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
context.beginPath();
context.rect(635, 100, 45, 550);
context.fillStyle = '#ccebff';
context.fill();
context.lineWidth = 8;
context.strokeStyle = '#0099ff';
context.stroke();
//// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< YOUR CODE ENDS HERE
// CHANGE THE CREDITS
context.beginPath();
context.font = 'bold 20px Arial';
context.fillStyle = "rgba(0,0,0,1)";
context.fillText('Maverick Gagliano HTML Project', 20, 550);
context.closePath();
</script
/body
></html>
Comments
Post a Comment