//import processing.opengl.*; ParticleSystem ps; void setup() { //size(screen.width, screen.height, OPENGL); size(1200,900); frameRate(35); smooth(); fill(226); ps = new ParticleSystem(); } void draw() { ps.draw(); } /********************* *********************/ class ParticleSystem{ int tickIndex = 0; int NUM_PARTICLES = 40; Particle[] particles; float minDist = 100; float springAmount = 0.0001; float attractAmount = 0.01; Attractor attractor; // float maxVelocity = ParticleSystem() { particles = new Particle[NUM_PARTICLES+1]; for(int i=0; i10) { vx = 10; }else if(vx<-10){ vx = -10; } if(vy>10) { vy = 10; }else if(vy<-10){ vy = -10; } } void draw() { if(x>width) { x = 0; }else if(x < 0) { x = width; } if(y>height) { y = 0; }else if(y<0) { y = height; } fill(255,255,0); ellipse( x, y, mass*5, mass*5); } }