xxxxxxxxxx
46
/*
Upload csv downloaded from the other sketch here
todo:
- upload multiple csv
- right now you also have to upload the image but it only uses it for width*height. it should save image size in the csv
- for some inexplicable reason when doing saveCanvas it doubles the width and height. this is stupid and im sure theres a fix but right now all ive got is to just make the canvas half as big :(
- because of this i also had to do something stupid with the coords in the other sketch uh oh
*/
let i;
let x, y;
let c;
let img;
function preload(){
//DATA INPUT!!!
table = loadTable('new.csv', 'csv', 'header');
img=loadImage('main-image.jpeg');
}
function setup() {
c = createCanvas(img.width/2, img.height/2);
rows = table.getRowCount();
}
function draw() {
circfill = color(255, 0, 255);
circfill.setAlpha(50);
noStroke();
fill(circfill);
for(i=0;i<rows;i++){
x=table.getNum(i,0);
y=table.getNum(i,1);
r=table.getNum(i,2);
circle(x,y,r*2);
}
print(width + " " + height);
saveCanvas(c, 'heatmap', 'png');
noLoop();
}