xxxxxxxxxx
var imagee;
var amountt = 15;
var PLANET = [];
var URLL = 'https://data.cityofnewyork.us/resource/xi7c-iiu2.json';
var anglee = 0;
function preload() {
imagee = loadImage('Universe.jpg');
JSONN = loadJSON(URLL);
}
function setup() {
createCanvas(windowWidth, windowHeight);
randomizee();
}
function draw() {
background(imagee);
for(let i=0; i<PLANET.length; i++)
{
push();
translate(PLANET[i].x, PLANET[i].y, 30);
noStroke();
anglee = anglee + JSONN[i]._2010_population/10000000;
rotate(anglee);
fill(255, 255, random(0, 255), 175);
circle(0, 0, JSONN[i]._2010_population/1000);
fill(255);
textAlign(CENTER);
textFont('Georgia');
textSize(15);
text(JSONN[i].borough, 0, 0)
text(JSONN[i].cd_name, 0, 15);
text(JSONN[i]._2010_population, 0, 30);
pop();
}
}
function randomizee() {
for(let i=0; i<amountt; i++)
{
let spheree = {};
spheree.x = random(0, windowWidth);
spheree.y = random(0, windowHeight);
PLANET.push(spheree);
}
}