xxxxxxxxxx
function setup() {
noLoop();
let url =
'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +
'summary/all_day.geojson'; // go to this link and examine the data structure, JSON Formatter browser plugin can help
loadJSON(url, drawEarthquake);
}
function draw() {
createCanvas(windowWidth, windowHeight);
background(200);
}
function drawEarthquake(earthquakes) {
let y = 30;
// Get multiple magnitude and name of the earthquake out of the loaded JSON
for (let i=0; i<earthquakes.features.length; i++){ // iterating through all the earthquakes
let earthquakeMag = earthquakes.features[i].properties.mag;
let earthquakeName = earthquakes.features[i].properties.place;
ellipse(width/4, y, earthquakeMag * 10, earthquakeMag * 10);
text(earthquakeName, width/4 + 50, y, width, 30);
y+=30;
}
}