xxxxxxxxxx
let department = {
x:5,
y:5,
w: 20,
h: 40,
}
let patient = {d: 5}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
}
function draw() {
push()
scale(5)
drawOutline(department);
drawPatientZone(department, patient)
drawSupportZone(department, patient)
drawCorridor(department,patient)
pop()
}
function drawOutline({x,y,w,h}){
stroke(0)
noFill()
rect(x,y,w,h)
}
function drawPatientZone({x,y,w,h},{d}){
stroke(0)
rect(x,y,w,h)
if ( h > w) {
fill(34,155,215)
rect(x,y,d,h)
rect(x+w-d,y,d,h)
} else {
}
}
function drawSupportZone({x,y,w,h},{d}){
if ( h > w) {
fill('green')
rect(x+d,y,w-2*d,h)
} else {
}
}
function drawCorridor({x,y,w,h},{d}){
strokeWeight(2)
stroke(0)
strokeCap(SQUARE)
d += 1.5
if ( h > w) {
line(x+d,y,x+d,y+h)
line(x+w-d,y,x+w-d,y+h)
strokeWeight(1.5)
stroke(255)
line(x+d,y,x+d,y+h)
line(x+w-d,y,x+w-d,y+h)
} else {
}
}