int total = 20; Container container; void setup(){ size(400, 400); colorMode(HSB, 360, 100, 100, 100); ellipseMode(CENTER); noStroke(); smooth(); frameRate(20); background(0, 0, 100); container = new Container(width, height); } void draw(){ background(0, 0, 100); container.bdraw(); } class Container{ //property int canvasWidth, canvasHeight; float leftBounds, rightBounds; Ball[] ball; Edge[] edge; int ballSize = 98; int edgeSize = 100; float posX, posY; float vx, vy; //constructor Container(int canvasWidth, int canvasHeight){ this.canvasWidth = canvasWidth; this.canvasHeight = canvasHeight; leftBounds = -edgeSize; rightBounds = edgeSize + canvasWidth; ball = new Ball[total]; edge = new Edge[total]; for(int i=0; i rightBounds) ball[i].posX = leftBounds; edge[i].posX = ball[i].posX; ball[i].vx *= 0.8; if(ball[i].vx < 0.00001) { ball[i].vx = random(0, 60); } } for(int i=0; i