xxxxxxxxxx
//this sketch shows recorded shootings in nyc from the years 2005 and 2020
var gun; // this is gonna hold all the stuff that comes back
var loca; // the locations of each ones
var numshots = 10;
var baseurl = 'https://data.cityofnewyork.us/resource/833y-fsy8.json?$limit='+numshots;
var city = 'New York, NY';
var whichShot = 0;
var drawing =1;
function preload() {
var URL = baseurl;
console.log('downloading...' +URL);
gun = loadJSON(URL);
img = loadImage("man1.png");
img2 = loadImage("gun.png");
}
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
}
function draw() {
//if(drawing ==1){
background(100);
image(img, 1500,0, windowWidth/8, windowHeight);
image(img2, 0, 600,300,150);
image(img2, 0, 400,300,150);
image(img2, 0, 200,300,150);
image(img2, 0, 00,300,150);
fr = 10;
frameRate(fr)
stroke(0);
textSize(20);
let x = random(width);
let y = 0;
for(let i = 0; i<10; i++){
thestuff = gun[i];
stroke(0);
ellipse(x, y, 100, 30);
fill(0);
stroke(255, 100, 100);
text('Victim race:' + thestuff.vic_race, x, y-40);
text('City: ' + thestuff.boro + 'at' + thestuff.occur_time, x, y);
y=y+100;
}
}
// drawing=0;
//}
/*if(drawing ==0){
}
}*/