// Variance int numBall = 20; Ball[] maru = new Ball[numBall]; int[][] iro = new int[numBall][3]; void setup() { size(400, 400); //window background(0, 0, 0); //black noStroke(); //lineless for (int i = 0; i < numBall; i++) { for (int j=0; j<3; j++ ) { iro[i][j] = (int)(random(1)*255); } maru[i] = new Ball(200*random(-1,1)+200, 200*random(-1,1)+200, 20, iro[i]); } } void draw(){ for (int i = 0; i < numBall; i++) { maru[i].display(); } } class Ball{ float px, py; //position float vx, vy; //velocity float dia; //diameter int[] col = {}; Ball(float x, float y, float d) { px = x; py = y; dia = d; } Ball(float x, float y, float d, int[] c) { px = x; py = y; dia = d; col = c; } void display() { fill(col[0], col[1], col[2]); ellipse(px, py, dia, dia); } void display(int[] col) { fill(col[0], col[1], col[2]); ellipse(px, py, dia, dia); } }