Function Parameters Mobile House
Be sure to change the title and author of this fiddle to match the assignment requirements!
by Prathameshsb
HTML
<div id="drawing"></div>
JavaScript
"use strict"
let draw = SVG('drawing');
draw.size(300, 300);
/* draw the base of the house */
let base = draw.rect(200, 200);
base.fill("white");
base.stroke("black");
let basex = 50;
let basey = 100;
base.move(basex, basey);
/* draw the door of the house */
let door = draw.rect(80, 100);
let doorx = 110;
let doory = 200;
door.move(doorx, doory);
door.fill("brown");
door.stroke({ width: 2});
let doort;
function drawDoor(){
let doort = draw.rect(80,100);
doort.move(200, 200);
doort.fill("brown");
doort.stroke({ width: 2});
}
drawDoor();
doort.move(25,25);
/* draw the roof of the house */
let roofx = 0;
let roofy = 0;
let roof =
draw.polygon([
[0, 0],
[150, -100],
[300, 0]
]);
roof.move(roofx,roofy);