Facebook
From Adjowa Asamoah, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 134
  1. void setup() {
  2.  
  3.   size(500, 500);
  4.  
  5.   int n_circles = 5;
  6.   int x_amp = width / n_circles;
  7.   int y_amp = height / n_circles;
  8.   int b = 1;
  9.   int n = 1;
  10.   int t = 1;
  11.  
  12.   for (int g_x = x_amp / 2; g_x <= width - x_amp / 2; g_x = g_x + x_amp) {
  13.     for (int g_y = (y_amp / 2) * b; g_y <= height - ((y_amp / 2) * t); g_y = g_y + y_amp) {
  14.       if (n % 2 == 0) {
  15.         fill(0, 0, 175);
  16.       } else {
  17.         fill(175, 0, 0);
  18.       };
  19.       ellipse(g_x, g_y, x_amp, y_amp);
  20.       fill(0);
  21.       textSize(16);
  22.       textAlign(CENTER, CENTER);
  23.       text(n, g_x, g_y);
  24.       n = n + 1;
  25.     }
  26.     t = t + 1;
  27.     b = b + 1;
  28.   }
  29.   save("Assignment4_part3");
  30.  
  31. }
  32.