import processing.opengl.*; import java.util.ArrayList; Particle[] pArray; private int pNum = 600; PImage[] images; int x; int y; PImage particle; ArrayList galleries; PImage img; void setup(){ size (640,480,OPENGL); frameRate(30); lights(); smooth(); galleries = new ArrayList(); x = mouseX; y = mouseY; pArray = new Particle[pNum]; int pWidth = 100; int pHeight = 100; particle = loadImage("particle.png"); blend(particle, 0, 0, 50, 50, 0, 0, 50, 50, ADD); image(particle,100,100); for (int i=0;i height || y < -100){ x=width/2; y=height; z= 0 ; curSize = 0.1; vx = Math.random()*5-2.5; vy = Math.random()*5-2.5; vz = Math.random()*5-2.5; } } private void updateVelocity() { //vx *= 1.01; vy *= 1.01; //vz *= 1.01; phase += phaseInc; //t+=timeInc; // if (mousePressed){ // t+=timeInc // } // if (t < 90){ // phase = quadEaseOut((float)t,(float)0,(float)1,(float)90); // } // if (t>90 || t<0){ // timeInc *= -1; // } // println(":" + phase); } public void render(PImage img){ pushMatrix(); translate(x,y,z); pushMatrix(); translate(-25,-25,0); popMatrix(); scale(curSize); image(img,50,50); popMatrix(); } } /* * * It's the penner bounce function! * */ public float bounceEaseOut (float t, float b, float c, float d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } } public float quadEaseIn (float t,float b,float c,float d) { return c*(t/=d)*t + b; } public float quadEaseOut (float t, float b,float c,float d){ return -c *(t/=d)*(t-2) + b; }