"Why are you fishing in my bowl?"
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
}
</style>
</head>
<body>
<canvas id="myCanvas" width="600" height="600"></canvas>
<script>
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 4;
var centerY = canvas.height / 4;
var radius = 70;
//BACKGROUND
context.beginPath();
context.rect(0, 0, 600, 600);
context.fillStyle = "rgb( 23, 156, 233)";
context.fill();
// add linear gradient
var grd = context.createLinearGradient(600, 1, canvas.width, canvas.height);
// light blue
grd.addColorStop(0, '#8ED6FF');
// dark blue
grd.addColorStop(1, '#004CB3');
context.fillStyle = grd;
context.fill();
context.stroke();
//SAND
context.beginPath();
context.rect(0, 500, 600, 100);
context.fillStyle = "rgb( 23, 156, 233)";
context.fill();
// add linear gradient
var grd = context.createLinearGradient(600, 1, canvas.width, canvas.height);
grd.addColorStop(0, "rgb(246, 255, 101)");
grd.addColorStop(1, 'tan');
context.fillStyle = grd;
context.fill();
context.stroke();
//LARGE BUBBLE
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
// add linear gradient
var grd = context.createLinearGradient(1, 1, canvas.width, canvas.height);
// light blue
grd.addColorStop(0, "rgb(18, 255, 232)");
// dark blue
grd.addColorStop(1, "rgb(13, 34, 220)");
context.fillStyle = grd;
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'blue';
context.stroke();
//MEDIUM BUBBLE
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 3;
var centerY = canvas.height / 2;
var radius = 30;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 8 * Math.PI, false);
context.fillStyle = "rgba(78, 191, 255, 0.5)";
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'blue';
context.stroke();
//BUBBLE OVERLAP
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 3;
var centerY = canvas.height / 7;
var radius = 50;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = "rgba(78, 191, 255, 0.5)";
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'blue';
context.stroke();
//FISH EYE
var centerX = canvas.width / 2;
var centerY = canvas.height / 1.6;
var radius = 30;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'white';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'white';
context.stroke();
//DORSAL FIN
context.beginPath();
context.moveTo(500, 500);
context.lineTo(460, 250);
context.lineTo(380, 430);
context.lineTo(500, 500);
context.stroke();
context.lineWidth = 5;
context.fillStyle = 'orange';
context.fill();
context.strokeStyle = 'orange';
context.stroke();
//FISH
var centerX = canvas.width / 1.5;
var centerY = canvas.height / 1.3;
var radius = 110;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'orange';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'orange';
context.stroke();
//SIDE FIN
// begin custom shape
context.beginPath();
context.moveTo(550, 550);
context.bezierCurveTo(550, 550, 550, 450, 450, 450);
context.bezierCurveTo(550, 550, 550, 550, 550, 550);
context.fillStyle = "rgba(255, 128, 0, 0.5)";
context.fill();
// complete custom shape
context.closePath();
context.lineWidth = 5;
context.strokeStyle = "rgb(255, 128, 0)";
context.stroke();
//TAIL FIN
// miter line join (left)
context.beginPath();
context.moveTo(550, 300);
context.lineTo(500, 420);
context.lineTo(570, 480);
context.lineTo(590, 500);
context.lineTo(560, 420);
context.lineTo(550, 400);
context.lineTo(550, 300);
context.lineJoin = 'miter';
context.fillStyle = 'orange';
context.fill();
context.strokeStyle = 'orange';
context.stroke();
//FISH EYE
var centerX = canvas.width / 1.6;
var centerY = canvas.height / 1.6;
var radius = 30;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'white';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'white';
context.stroke();
//PUPIL 1
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 2.1;
var centerY = canvas.height / 1.68;
var radius = 10;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
//PUPIL 1
var canvas = document.getElementById('myCanvas');
var context = canvas.getContext('2d');
var centerX = canvas.width / 1.66;
var centerY = canvas.height / 1.68;
var radius = 10;
context.beginPath();
context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
context.fillStyle = 'black';
context.fill();
context.lineWidth = 5;
context.strokeStyle = 'black';
context.stroke();
//FISH HOOK
context.beginPath();
context.moveTo(120, 200);
context.bezierCurveTo (10, 330, 40, 10, 38, 17);
context.lineWidth = 12
// line color
context.strokeStyle = 'silver';
context.stroke();
//FISH MOUTH
context.beginPath();
context.moveTo(320, 490);
context.lineTo(370, 490);
context.lineTo(360, 500);
context.lineJoin = 'round';
context.strokeStyle = "rgb(242, 64, 100)";
context.stroke();
</script>
</body>
</html>
No comments:
Post a Comment