Tuesday, October 20, 2015

HTML project

I really didn't like doing this project. It was very frustrating. At first I was going to make Bubbles from the PowerPuff Girls but it was too difficult. I am so glad it's over.

TextWrangler

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

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

//Background
context.beginPath();
context.rect(0, 0, canvas.width, canvas.height);
var grd = context.createLinearGradient(0, 0, canvas.width, canvas.height);
grd.addColorStop(0, '#8ED6FF');
grd.addColorStop(1, '#004CB3');
context.fillStyle = grd;
context.fill();

//left ear
context.beginPath();
context.moveTo(325,45);
context.lineTo(250,250);
context.lineTo(350,250);
context.lineTo(325,45);
context.lineWidth = 3;
context.strokeStyle = 'black';
context.stroke();
context.fillStyle = 'pink';
context.fill();

//right ear
context.beginPath();
context.moveTo(525,45);
context.lineTo(450,250);
context.lineTo(550,250);
context.lineTo(525,45);
context.lineWidth = 3;
context.strokeStyle = 'black';
context.stroke();
context.fillStyle = 'pink';
context.fill();


//head
context.beginPath();
context.arc(425, 300, 200, 0, 2 * Math.PI, false);
context.lineWidth = 8;
context.strokeStyle = 'black';
context.stroke();
context.fillStyle = 'pink';
context.fill();

//nose
context.beginPath();
context.arc(425, 425, 120, 0, 2 * Math.PI, false);
context.lineWidth = 8;
context.strokeStyle = 'black';
context.stroke();
context.fillStyle = 'pink';
context.fill();

//nostril 1
context.beginPath();
context.arc(350, 425, 45, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();

//nostril 2
context.beginPath();
context.arc(498, 425, 45, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();

//left eye
context.beginPath();
context.arc(325, 225, 65, 0, 2 * Math.PI, false);
context.fillStyle = 'white';
context.fill();

//right eye
context.beginPath();
context.arc(525, 225, 65, 0, 2 * Math.PI, false);
context.fillStyle = 'white';
context.fill();


//pupil
context.beginPath();
context.arc(325, 225, 30, 0, 2 * Math.PI, false);
context.fillStyle = 'aqua';
context.fill();
context.beginPath();
context.arc(325, 225, 25, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();

//pupil2
context.beginPath();
context.arc(525, 225, 30, 0, 2 * Math.PI, false);
context.fillStyle = 'aqua';
context.fill();
context.beginPath();
context.arc(525, 225, 25, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();










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

};

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

No comments:

Post a Comment