Function No Parameters Completed
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 */
function drawBase() {
let base = draw.rect(200, 200);
base.fill("white");
base.stroke("black");
base.move(basex, basey);
}
let basex = 50;
let basey = 100;
drawBase();
/* Draw the door */
function drawDoor() {
let door = draw.rect(80, 100);
door.move(doorx, doory);
door.fill("brown");
door.stroke({
width: 2
});
}
/* Draw first door */
let doorx = 110;
let doory = 200;
drawDoor();
/* Draw second door */
doorx = 210;
drawDoor();
/* Draw the roof */
function drawRoof() {
let roof =
draw.polygon([
[0, 0],
[150, -100],
[300, 0]
]);
roof.move(roofx, roofy);
}
let roofx = 0;
let roofy = 0;
drawRoof();