import toxi.util.datatypes.*; import toxi.math.noise.*; import toxi.math.waves.*; import toxi.geom.*; import toxi.math.*; import toxi.geom.mesh.*; import toxi.math.conversion.*; import toxi.physics2d.constraints.*; import toxi.physics.*; import toxi.physics.constraints.*; import toxi.physics2d.*; ParticleController pc; PImage img; String name = "janice3"; String ext = ".jpg"; int picScale = 1; Vec2D mVel; float MAXRADIUS = 10.0; int RADIST = int(1 * MAXRADIUS); void setup(){ frameRate(24); img = loadImage(name + ext); size(picScale * img.width, picScale * img.height); //background(img); pc = new ParticleController(); //pc.addParticles(30); //for(int x = 0; x < width; x+=RADIST){ //for(int y = 0; y < height; y+=RADIST){ //pc.addParticles(10,width/2,height/2, new Vec2D(random(-0.5,.5), random(0,2))); //} //} background(0); noStroke(); //fill(255); smooth(); } void update(){ if(mousePressed){ mVel = new Vec2D(mouseX - pmouseX, mouseY - pmouseY); pc.addParticles(5,mouseX,mouseY,mVel); } pc.update(); } void draw(){ //pushStyle(); //fill(10,100); //rect(0,0,width,height); //popStyle(); //background(color(20,200)); if(pc.particles.size() < 300){ pc.addParticles(5,int(random(width)),int(random(0,height/2)), new Vec2D(.1,random(.5,2))); pc.addParticles(5,int(random(width)),int(random(height/2,height)), new Vec2D(.1,random(-0.5,-2))); } //pc.addParticles(30); update(); pc.draw(); } void mouseClicked(){ //save(name + "-###" + ext); }