ArrayList particles; PImage img; float r,g,b; int x,y,loc,locP; color c; //image pixel color color cP; //particle color int frameCounter = 0; void setup() { size(420,600); img = loadImage("fisk_mississippi_map.jpg"); frameRate(30); getColor(); particles = new ArrayList(); } //setup() void draw() { smooth(); noStroke(); background(50,50); // frameCounter+= 1; //Track frameCount particles.add(new Particle(0,0)); Iterator it = particles.iterator(); while (it.hasNext()) { Particle p = it.next(); PVector wind = new PVector(random(-0.1,0.1),random(-0.3,0.1)); PVector gravity = new PVector(0,0.1); p.applyForce(wind); p.applyForce(gravity); p.update(); // if (frameCounter%30 == 0) { //Change particle color incrementally //This worked with single particle, but not arrayList //Relate particle location to underlying image pixel: if((p.pH.x > 0) && (p.pH.x < width)) { if((p.pH.y > 0) && (p.pH.y < height)) { locP = (int)p.pH.x + (int)p.pH.y*width; }} else { locP = 0; } r = red (img.pixels[locP]); g = green(img.pixels[locP]); b = blue (img.pixels[locP]); cP = color(r,g,b); // } p.display(cP); //pass underlying pixel color to particle if (p.isDead()) it.remove(); }} //draw() void getColor() { loadPixels(); img.loadPixels(); for (x=0; x