Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String[] cities;
- Table table;
- TableRow row;
- int frms = 60, rows;
- float start[][], end[][];
- float l;
- void setup() {
- size(540, 270);
- background(0);
- fill(255, 100);
- noStroke();
- table = loadTable("cities.csv", "header");
- rows = table.getRowCount();
- start = new float[rows][2];
- end = new float[rows][2];
- for (int i=0; i<rows; i++) {
- row = table.getRow(i);
- float lat = row.getFloat("lat");
- float lng = row.getFloat("lng");
- float x = map(lng, -180, 180, 0, width);
- float y = map(lat, 90, -90, 0, height);
- end[i][0] = x;
- end[i][1] = y;
- start[i][0] = int(random(width/2));
- start[i][1] = int(random(height/2));
- }
- }
- void draw() {
- background(0);
- translate(-270, -200);
- scale(4.5);
- for (int i=0; i<rows; i++) {
- float x = lerp(start[i][0], end[i][0], l);
- float y = lerp(start[i][1], end[i][1], l);
- float sz = .25;
- ellipse(x, y, sz, sz);
- }
- if (l<1) l = map(frameCount,1,frms,0,1);
- //if (frameCount<=frms+30) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement