xxxxxxxxxx
28
let earthquakes;
function preload() {
let url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?' +
'format=geojson&limit=1&orderby=time';
httpGet(url, 'jsonp', false,
function(response) {
earthquakes = response;
});
}
function setup(){
createCanvas(400, 400);
background(204,100,49);
frameRate(2);
}
function draw() {
if (!earthquakes) {
return;
}
let earthquakeMag = earthquakes.features[0].properties.mag;
let earthquakeName = earthquakes.features[0].properties.place;
ellipse(100, 100, earthquakeMag * 10, earthquakeMag * 10);
textAlign(CENTER);
text(earthquakeName, 200, 300);
//noLoop();
}