int SBrange; int SBradius; int mySBX; int mySBY; int maxFractals = 10; //x & y velocity float mxvel = 5; float myvel = 10; public boolean triggered; //mouse location x, y and new mouse location x, y - just variables not the actual mouse... float mlocx; float mlocy; float mlocxnew; float mlocynew; float mvel = 124; int numSubpars = 0; float sens = 0.5; float msens = 0.3; float direction; boolean kill=false; int c=0; //create two arrays - pars & subpars - each containing instances of the class Particle Part [] pars, subpars; //create new trees public Tree[] t; int maxScatters = 5; //max no of fractals on screen //to indicate how many particles are in each scatter brain int numStars = 0; //*********************the original set up**************************// public void SB1setup(){ //the SBrange determines how big the circle is and how many particles are in it SBrange = int(random(100, 250)); SBradius = int(SBrange/2.0); //SBradius of the circle that the particles exist in mySBX =(int)(random(0+SBradius, width-SBradius)); //values based on the canvas size mySBY =(int)(random(0+SBradius, height-SBradius)); mlocxnew = mySBX; mlocynew = mySBY; triggered=false; //for drawing the fractals direction = (TWO_PI/100.0) * random(0, 100); /******Creating the star particles and placing them in an array**********/ //the number of particles in each SB changes based on size numStars = SBrange; //creates an array for the particles pars = new Part[numStars]; //populates the array if(numSubpars>0) subpars = new Part[numSubpars*pars.length]; for(int i = 0; i < pars.length; i++) { if(i == 0) pars[i] = new Part(mySBX,mySBY, false); else { float tempX = getRandX(); pars[i] = new Part(tempX,getRandY(tempX), false); } } //create the fractal pattern and place in an array t = new Tree[maxFractals]; for(int i = 0; i < maxFractals; i++){ t[i] = new Tree(); } }//end original set up //********************************************************************************************* //duplicate set up method public void SBsetup(int xx, int yy){ kill=false; //the SBrange determines how big the circle is and how many particles are in it SBrange = int(random(100, 250)); SBradius = int(SBrange/2.0); //SBradius of the circle that the particles exist in mySBX = xx; mySBY = yy; for(int i=0; i 100) { for(int i=0; i maxY) || (temp < minY)) { temp = (float)((Math.random()*SBrange)+mySBY-(SBrange/2)); } return temp; } /********************************************************************************/ void SBnormal(){ for(int i = 0; i < pars.length; i++) { if(pars[i].alive) { pars[i].normalize(); } } } //end SBnormal /********************************************************************************/ public void SBheat(){ for(int i = 0; i < pars.length; i++) { pars[i].hotColor(); pars[i].scatter_hot(); } } //end SBheat /********************************************************************************/ public void SBcool(){ for(int i = 0; i < pars.length; i++) { pars[i].coldColor(); pars[i].scatter_cold(); } //local variable to check if any of the particles are still alive (they are being set //not be alive in the scatter_cold() method when their position reaches a certain point... boolean anyAlive = false; //parse throught the array and checkif any particles are alive - if there are still some //start again & parse through the whole array again!!! for(int i = 0; i < pars.length; i++) { if(pars[i].alive) { anyAlive = true; i = pars.length; } } //if there are none alive and the triggered start has not already been set then SET UP the fractal! if(!anyAlive && !triggered && overallHeat < -5){ //begining coordinates and all alive... t[0].treeSetup(mySBX, mySBY, true); triggered=true; } } //end SCcool /********************************************************************************/ public void SBvolt(){ for(int i = 0; i < pars.length; i++) { pars[i].disturbColor(); pars[i].scatter_disturb(); } } //end SBvolt /********************************************************************************/ public void SBkill(){ mxvel = 5; myvel = 10; mvel = 124; for(int i=0; i