/
json.js
38 lines (28 loc) · 913 Bytes
/
json.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var a=0;
var flag=0;
function setup(){
createCanvas(800,500);
//loadJSON('http://api.open-notify.org/iss-now.json', yoo,'jsonp');
setInterval(lol,1000);
}
function lol(){
loadJSON('http://api.open-notify.org/iss-now.json', yoo,'jsonp');
if(flag==1){
if(a==0){
document.getElementById("del").style.color = "red";
a=1;
}
else if(a==1){
document.getElementById("del").style.color = "green";
a=0;
}
}
}
function yoo(data){
flag=1;
document.getElementById("del").innerHTML = "LIVE! ISS Position";
document.getElementById("del").style.backgroundColor = "lightgrey";
document.getElementById("lon").innerHTML = data.iss_position.longitude;
document.getElementById("lat").innerHTML = data.iss_position.latitude;
document.getElementById("iss").style.display = "block";
}