xxxxxxxxxx
53
let pizzas;
function setup() {
createCanvas(650, 600);
background(240);
rectMode(CORNER);
Buildings = [
{
Building: "Burj Khalifa",
BuildingLocation: "Dubai",
BuildingHeight: 2717,
},
{
Building: "Shanghai Tower",
BuildingLocation: "Shanghai",
BuildingHeight: 2073,
},
{
Building: "Abraj Al-Bait",
BuildingLocation: "Mecca",
BuildingHeight: 1971,
},
{
Building: "Ping An Centre",
BuildingLocation: "Shenzhen",
BuildingHeight: 1969,
},
{
Building: "Lotte World Tower",
BuildingLocation: "South Korea",
BuildingHeight: 1823,
},
];
let xPos = 10;
for (let i = 0; i < Buildings.length; i++) {
fill(255, 125, 0);
// drawing pizzas
let Tall = Buildings[i].BuildingHeight/5;
rect(xPos, 600, 50, -Tall)
// drawing labels
fill(0);
text(Buildings[i].Building, xPos, 600-(Tall+45));
text(Buildings[i].BuildingLocation, xPos, 600-(Tall+25));
text(Buildings[i].BuildingHeight + "FT", xPos, 600-(Tall+5));
xPos = xPos + 120;
textSize(20)
text("Tallest Buildings in the World", 180, 25)
}
}