xxxxxxxxxx
var data;
var temp1,temp2,temp3;
function showData(data) {
// println(data.currently.temperature);
temp1 = data.hourly.data[0].temperature;
temp2 = data.hourly.data[1].temperature;
temp3 = data.hourly.data[2].temperature;
translate(width/2, height/2);
if (temp1 > 80) {fill(255,0,0);} else {fill(0,0,255);}
rect(-200,0,100,100);
if (temp2 > 80) {fill(255,0,0);} else {fill(0,0,255);}
rect(0,0,100,100);
if (temp3 > 80) {fill(255,0,0);} else {fill(0,0,255);}
rect(200,0,100,100);
}
function setup() {
rectMode(CENTER);
createCanvas(500, 500);
loadJSON('https://api.darksky.net/forecast/4c2a126163d2d3e03d7c53162cf5f797/22.267024,114.237801',showData,'jsonp');
// data = loadJSON("https://goo.gl/aFfmCT",showData,"jsonp");
}
function draw() {
}