Last active
November 8, 2019 14:10
-
-
Save GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e to your computer and use it in GitHub Desktop.
JSON Open-Notify ISS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
height: 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "number": 6, "message": "success", | |
"people": [ | |
{ "craft": "ISS", "name": "Peggy Whitson" }, | |
{ "craft": "ISS", "name": "Fyodor Yurchikhin" }, | |
{ "craft": "ISS", "name": "Jack Fischer" }, | |
{ "craft": "ISS", "name": "Sergey Ryazanskiy" }, | |
{ "craft": "ISS", "name": "Randy Bresnik" }, | |
{ "craft": "ISS", "name": "Paolo Nespoli" } | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script async src=http://cdn.JsDelivr.net/npm/p5></script> | |
<script defer src=sketch.js></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* JSON Open-Notify ISS (v3.0) | |
* GoToLoop (2017-May-06) | |
* | |
* https://Forum.Processing.org/two/discussion/22414/ | |
* trouble-loading-json-data-from-a-url#Item_7 | |
* | |
* http://Bl.ocks.org/GoSubRoutine/7a567f0510b338b6d0fc1ef53f24f10e | |
*/ | |
"use strict"; | |
const HTTP = 'http' + '://', | |
SITE = 'api.Open-Notify.org/', | |
FILE = 'astros.json', | |
REMOTE = true, | |
PATH = REMOTE && HTTP + SITE + FILE || FILE, | |
COLOR = 'OrangeRed'; | |
let jsonObject; | |
function preload() { | |
jsonObject = loadJSON(PATH, print); | |
} | |
function setup() { | |
noCanvas(), noLoop(); | |
const astroArray = jsonObject.people, | |
len = astroArray.length, | |
issCrewNames = Array(len), | |
ol = createElement('ol'); | |
ol.style('color', COLOR) | |
.style('font-weight: bold') | |
.style('font-size: 1.2em'); | |
for (let i = 0; i < len; issCrewNames[i] = astroArray[i++].name); | |
print(issCrewNames); | |
for (const crew of issCrewNames) createElement('li', crew).parent(ol); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment