// color composition using this set of analagous colors: // AD33E3, D95F38, 3890CC, 33E342, D9BF3C color c; polkaDot test; int dotWidth, co; float xi, yi; ArrayList dots; color[] colors = { #AD33E3, #D95F38, #33E342, #D9BF3C }; void setup() { size(640, 480); color c = #D95F38; strokeWeight(0); background(#255F87); dotWidth = 11;// number of dots in a row int co = 0; dots = new ArrayList(); for (int h = 0; h < dotWidth; h = h+1) { for (int w = 0; w < dotWidth; w = w+1) { //xi is the x coordinate of the box //yi is the y coordinate of the box this stays comstant in the inner loop xi = ((width/dotWidth)*w + (width/(dotWidth*2))); // the second operation centers the dots yi = (height/dotWidth)*h + (height/(dotWidth*2)); if ( co < 3 ) { co = co + 1; } else { co = 0; } dots.add(new polkaDot(xi, yi, 30, colors[co])); } } for ( int i = 0; i < dots.size(); i++) { polkaDot polka = (polkaDot)dots.get(i); polka.draw(); } save("colorComposition.png"); } void draw() { } class polkaDot { float x, y, d; color c; polkaDot(float _x, float _y , float _d, color _c){ x = _x; y = _y; d = _d;//diameter c = _c; } void draw(){ fill(c); ellipse(x, y, d, d); } }