xxxxxxxxxx
var bins = 10;
var api
var baseurl = 'https://data.cityofnewyork.us/resource/sxx4-xhzg.json';
var thestuff = {};
var isready = false;
let bg;
let content = 'hi';
let yStart = 0;
let yshift = 0;
let startindex = 0;
var fontsize = 18;
function preload() {
thestuff = loadJSON(baseurl, goforit);
font = loadFont('font.ttf');
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
textFont(font);
stroke(0);
fill(0);
textSize(fontsize);
//bg = loadImage('bins.png');
}
function draw() {
if(isready)
{
background(0);
fill(255);
let y = fontsize - yshift;
for(let i =startindex;i<startindex+30;i++)
{
fill(255, y / 2 + 55, 100);
let s = '';
s+=thestuff[i%500].borough + ' : ';
s+=thestuff[i%500].site_type + ', ';
s+=thestuff[i%500].park_site_name + ' : ';
text(s, 20, y);
y+=fontsize;
fill('white');
let a = thestuff[i%500].address;
text(a, 40, y);
y+=fontsize;
//background(bg);
}
yshift+=1;
if(yshift>=fontsize*2)
{
yshift = 0;
startindex++;
}
//for (let y = yStart; y < height; y += 28)
//text(content, width / 2, y);
//yStart--;
}
}
function goforit() { // response function
isready = true;
console.log(thestuff);
}