Advertisement
xeromino

import

Jan 14th, 2016
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String[] cities;
  2. Table table;
  3. TableRow row;
  4. int frms = 60, step, c=0;
  5.  
  6. void setup() {
  7.   size(540, 270);
  8.   background(0);
  9.   table = loadTable("cities.csv", "header");
  10.   step = table.getRowCount()/frms;
  11. }
  12.  
  13. void draw() {
  14.   translate(-270, -200);
  15.   scale(4.5);
  16.   if (frameCount<=frms) {
  17.     for (int i=c; i<c+step; i++) {
  18.       row = table.getRow(i);
  19.       float lat = row.getFloat("lat");
  20.       float lng = row.getFloat("lng");
  21.       setXY(lat, lng);
  22.     }
  23.     c += step;
  24.   }
  25.   if (frameCount<=frms+30) saveFrame("image-###.gif");
  26. }
  27.  
  28.  
  29. void setXY(float lat, float lng) {
  30.   float sz = 0.25;
  31.   float x = map(lng, -180, 180, 0, width);
  32.   float y = map(lat, 90, -90, 0, height);
  33.   fill(255, 150);
  34.   noStroke();
  35.   ellipse(x, y, sz, sz);
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement