// Bouncing Circles: ICM Project # 3: Yonatan Kelib // Created with the help of Tye a second year student. circle circle1; circle circle2; int xdirec=1; int ydirec=-3; void setup () { size (400,400); background(112,128,144); color ccolor= color (79,148,205); circle1 = new circle (ccolor,11,3); ccolor= color(255,255,000); circle2 = new circle (ccolor,65,25); } void draw() { circle1.render(); circle2.render(); } class circle { int xpos; int ypos; color ccolor; circle(color _ccolor,int _x,int _y) { ccolor=_ccolor; xpos = _x; ypos = _y; } void render () { xpos=xpos+xdirec; ypos=ypos+ydirec; fill(ccolor); if (xpos>=width || xpos<=0) { xdirec=xdirec*-1; } ellipse(xpos,ypos,50,50); if (ypos>=height || ypos<=0) { ydirec=ydirec*-1; } } }