Drawing

function full(){ tail() bodyy() ears() headd() legs() face() shadows() arms() } function kustuta2(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.clearRect(0,0, 500, 300); } function headd(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.arc(150, 80, 20, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”yellow”; k.fill(); k.stroke(); k.beginPath(); k.arc(150, 90, 22, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”yellow”; k.fill(); } function bodyy(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.arc(130, 125, 20, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); k.beginPath(); k.arc(170, 125, 20, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); //ristkülik k.stroke(); k.fillStyle=”yellow”; k.fillRect(130, 85, 40, 60); //x, y, laius, kõrgus } function arms(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.lineWidth=”2″; k.strokeStyle=”black”; k.moveTo(160, 120); //alguspunkt k.lineTo(165, 135); k.lineTo(170, 137); k.lineTo(175, 120); //Lõppunkt=alguspoint k.moveTo(140, 120); //alguspunkt k.lineTo(135, 135); k.lineTo(130, 137); k.lineTo(125, 120); //Lõppunkt=alguspoint k.stroke(); // joon k.fillStyle=”yellow”; k.fill(); //taust } function legs(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.arc(115, 135, 12, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); k.beginPath(); k.arc(185, 135, 12, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); } function tail(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.lineWidth=”2″; k.strokeStyle=”black”; k.moveTo(160, 120); //alguspunkt k.lineTo(200, 110); k.lineTo(190, 99); k.lineTo(220, 90); k.lineTo(228, 70); k.lineTo(175, 78); k.lineTo(190, 105); k.lineTo(160, 120); //Lõppunkt=alguspoint k.stroke(); // joon k.fillStyle=”yellow”; k.fill(); //taust } function ears(){ let k=document.getElementById(“kanva2”).getContext(“2d”); k.beginPath(); k.lineWidth=”2″; k.strokeStyle=”black”; k.moveTo(150, 70); //alguspunkt k.lineTo(200, 58); //kesk point k.lineTo(150, 60); //lõpp point k.lineTo(100, 50); //Lõppunkt=alguspoint k.stroke(); // joon k.fillStyle=”yellow”; k.fill(); //taust } function face(){ let k=document.getElementById(“kanva2”).getContext(“2d”); //right eye k.beginPath(); k.arc(160, 75, 2.5, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”black”; k.fill(); //right eye 2 k.beginPath(); k.arc(159, 74, 1.5, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”white”; k.fill(); //left eye k.beginPath(); k.arc(140, 75, 2.5, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”black”; k.fill(); //right eye k.beginPath(); k.arc(141, 74, 1.5, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”white”; k.fill(); //right cheek k.beginPath(); k.arc(165, 85, 3, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”red”; k.fill(); //left cheek k.beginPath(); k.arc(135, 85, 3, 0, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”red”; k.fill(); //right mouth k.beginPath(); k.arc(153, 85, 2, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); //left mouth k.beginPath(); k.arc(147, 85, 2, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.stroke(); k.fillStyle=”yellow”; k.fill(); //noze k.beginPath(); k.lineWidth=”2″; k.strokeStyle=”black”; k.moveTo(149, 80); //alguspunkt k.lineTo(151, 80); //Lõppunkt=alguspoint k.stroke(); // joon } function shadows(){ let k=document.getElementById(“kanva2”).getContext(“2d”); //left leg k.beginPath(); k.arc(115, 135, 12, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”gold”; k.fill(); //left leg2 k.beginPath(); k.arc(112, 135, 9, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”yellow”; k.fill(); //right leg k.beginPath(); k.arc(185, 135, 12, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”gold”; k.fill(); //right leg2 k.beginPath(); k.arc(188, 135, 9, 1 * Math.PI, 2 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”yellow”; k.fill(); //center k.beginPath(); k.arc(150, 145, 20, 0, 1 * Math.PI, true); //x, y, -alguspunkt, R k.fillStyle=”gold”; k.fill(); }form{ background-color: darkred; border: 3px }

Joonis