<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Camvas</title>
</head>
<body>
<canvas width="600" height="400"> </canvas>
<script>
var pantalla = document.querySelector("canvas");
var pincel = pantalla.getContext("2d");
pincel.fillStyle = "lightblue"
pincel.fillRect(0,0,600,150);
pincel.fillStyle = "lightblue"
pincel.fillRect(0,250,600,400);
var lineaX = [300,370,400,380,300,200,180,220]
var lineaY =[100,125,200,260,300,250,200,128]
var lineas = 0
var enx=0
var eny=0
while (lineas<= 7){
pincel.fillStyle = "yellow"
pincel.beginPath();
pincel.moveTo(300,200);
pincel.lineTo(lineaX[enx],lineaY[eny]);
if (lineas == 3 || lineas == 7){
pincel.lineTo(lineaX[enx]-10,lineaY[eny]+25);
}else{
pincel.lineTo(lineaX[enx]+20,lineaY[eny]+20);
}
pincel.fill();
//document.write("enx "+lineaX[enx]+"<br>"); //es solo para er que valores cargan las variables por buelta
//document.write("eny "+lineaY[eny]);
enx=enx+1;
eny=eny+1;
lineas++
}
pincel.fillStyle = "yellow"
pincel.beginPath();
pincel.arc(300,200,50,0,2*3.14);
pincel.fill();
</script>
</body>
</html>