function koik(){
jalad();
laip();
pea();
nagu();
kaed();
vest();
saapad();
sall();
kiiver();
}
function kustuta2() {
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.clearRect(0,0, 400, 300);
}
function jalad(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.fillRect (100, 100, 25, 40);
k.fillRect (150, 100, 25, 40);
}
function laip(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.beginPath();
k.lineWidth=»1″;
k.strokeStyle=»DarkOliveGreen»;
k.moveTo(105, 40);
k.lineTo(170, 40);
k.lineTo(185, 100);
k.lineTo(90, 100);
k.lineTo(105, 40);
k.stroke();//joon
k.fill(); //taust
}
function pea(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.fillRect (125, 38, 25, 2);
k.fillStyle=»Bisque»;
k.fillRect (110, 13, 55, 25);
}
function nagu(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»Black»;
k.fillRect (120, 22, 6, 4);
k.fillRect (150, 22, 6, 4);
k.fillRect (122, 32, 33, 2);
}
function kaed(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.beginPath();
k.lineWidth=»1″;
k.strokeStyle=»DarkOliveGreen»;
k.moveTo(170, 42);
k.lineTo(190, 44);
k.lineTo(215, 70);
k.lineTo(210, 95);
k.lineTo(196, 95);
k.lineTo(200, 70);
k.lineTo(170, 50);
k.moveTo(105, 42);
k.lineTo(85, 44);
k.lineTo(60, 70);
k.lineTo(65, 95);
k.lineTo(79, 95);
k.lineTo(75, 70);
k.lineTo(105, 50);
k.stroke();//joon
k.fill(); //taust
k.lineWidth=»4″;
k.strokeStyle=»DarkGreen»;
k.beginPath();
k.arc(71, 102, 5, 3, 2 * Math.PI); //alguspunkt, radius
k.stroke();
k.beginPath();
k.arc(203, 102, 5, 3, 2 * Math.PI); //alguspunkt, radius
k.stroke();
}
function vest(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkGreen»;
k.fillRect (110, 39, 10, 10);
k.fillRect (155, 39, 10, 10);
k.beginPath();
k.lineWidth=»1″;
k.strokeStyle=»DarkGreen»;
k.moveTo(105, 44);
k.lineTo(170, 44);
k.lineTo(182, 90);
k.lineTo(160, 90);
k.lineTo(150, 105);
k.lineTo(125, 105);
k.lineTo(115, 90);
k.lineTo(93, 90);
k.stroke();//joon
k.fill(); //taust
k.fillStyle=»DarkOliveGreen»;
k.fillRect (160, 70, 15, 15);
k.fillRect (140, 70, 15, 15);
k.fillRect (120, 70, 15, 15);
k.fillRect (100, 70, 15, 15);
k.fillRect (120, 50, 35, 15);
k.fillRect (125, 90, 25, 10);
k.fillStyle=»DarkGreen»;
k.fillRect (130, 95, 15, 1);
k.fillRect (136, 92, 2, 7);
}
function saapad(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»Grey»;
k.fillRect (99, 125, 27, 16 );
k.fillRect (149, 125, 27, 16 );
k.fillStyle=»black»;
k.fillRect (105, 128, 15, 1 );
k.fillRect (105, 130, 15, 1 );
k.fillRect (105, 132, 15, 1 );
k.fillRect (155, 128, 15, 1 );
k.fillRect (155, 130, 15, 1 );
k.fillRect (155, 132, 15, 1 );
}
function sall(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.fillRect (110, 30, 55, 8);
}
function kiiver(){
let k=document.getElementById(«kanva2»).getContext(«2d»);
k.fillStyle=»DarkOliveGreen»;
k.fillRect (105, 10, 65, 10 );
k.fillRect (105 , 10, 5, 15);
k.fillRect (165 , 10, 5, 15);
}canvas{
width: 400px;
height: 400px;
background-color: gainsboro;
}