xxxxxxxxxx
22
function setup() {
noLoop();
let url =
'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +
'summary/all_day.geojson';
loadJSON(url, drawEarthquake);
}
function draw() {
background(200);
}
function drawEarthquake(earthquakes) {
// Get the magnitude and name of the earthquake out of the loaded JSON
let earthquakeMag = earthquakes.features[0].properties.mag;
let earthquakeName = earthquakes.features[0].properties.place;
let earthquakeSig = earthquakes.features[0].properties.sig;
ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);
textAlign(CENTER);
text(earthquakeName, 0, height - 30, width, 30);
text(earthquakeSig, 10, 10);
}