Guest User

Untitled

a guest
Dec 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. Table table;
  2. PFont f;
  3. PShape leaf;
  4. color [] c = {color(225, 50, 50), color(225, 100, 0), color(225, 225, 0), color(0, 150, 0), color(0), color(125)};
  5. int i=0;
  6.  
  7. void setup() {
  8. size(1100, 500);
  9. background(255);
  10. table=loadTable("P3_data.csv", "header");
  11. leaf= loadShape("leaf.svg");
  12. leaf.disableStyle();
  13. }
  14.  
  15.  
  16. void draw() {
  17. stroke(255);
  18. strokeWeight(0.1);
  19.  
  20. for (TableRow row : table.rows()) {
  21. int friend= (row.getInt("Friend"));
  22. int travel= (row.getInt("Travel"));
  23. int selfimprovement= (row.getInt("Self-improvement"));
  24. int club= (row.getInt("Club"));
  25. int schoolwork= (row.getInt("Schoolwork"));
  26. int money= (row.getInt("Money"));
  27.  
  28. int total= 0;
  29. int [] Daily= {friend, travel, selfimprovement, club, schoolwork, money};
  30. for (int k=0; k<6; k++) {
  31. total +=Daily[k];
  32. }
  33. println (total);
  34. for (int j=0; j<6; j++) {
  35.  
  36. for (int m=0; m< Daily[j]; m++) {
  37. fill(c[j]);
  38. ellipse((i%120)*10+10, (i/120)*40+10, 3*total, 4*total);
  39. //shape(leaf, (i%120)*10+10, (i/120)*40+10, 3*total, 3*total);
  40. total --;
  41. }
  42. }
  43. if (i>1095) {
  44. break;
  45. }
  46. i++;
  47. }
  48. save("sketch.png");
  49. }
Add Comment
Please, Sign In to add comment