ArrayList<Particle> particles;
colorMode(RGB,255,255,255);
font = createFont("FreeSansBold.ttf", 450);
textAlign(CENTER,CENTER);
text(typedKey, width/2, height/2-70);
list = new int[width*height];
for(int y = 0; y<=height-1; y++){
for(int x = 0; x<=width-1; x++){
color pb = pixels[y*width+x];
if(red(pb)<5){ list[y*width+x]=0; }
else { list[y*width+x]=1; }}}
particles=new ArrayList<Particle>();
axis = new PVector(int(random(100,width-100)),int(random(100,height-100)));
if(list[int(axis.y*width+axis.x)]==0){
particles.add(new Particle(axis.x,axis.y));
for (int i = 0; i < particles.size(); i++) {
Particle p = particles.get(i);
for (int j = 0; j < particles.size(); j++) {
Particle p = particles.get(j);
if (key != CODED && key != ' ' && key != TAB && key != ENTER && key != RETURN) {
Particle(float x, float y) {
location = new PVector(x,y);
velocity = new PVector(random(1),random(1));
if ((list[int(location.y)*width+int(location.x+velocity.x)]==1) || (list[int(location.y)*width+int(location.x-velocity.x)]==1)) { velocity.x *= -1; }
if ((list[int(location.y+velocity.y)*width+int(location.x)]==1) || (list[int(location.y-velocity.y)*width+int(location.x)]==1)) { velocity.y *= -1; }
ellipse(location.x,location.y,radius,radius);
ellipse(location.x,location.y,radius-10,radius-10);