/** Beginners should crank up the opacity and start experimenting with the right hand RESPAWN pane.
Set your desired parameters and press RESPAWN.

The SPECTRUM slider switches between 5 different color modes.

The TWIST slider affects the particles affinity for changing their course.
Try setting the twist to zero and spawn a new cloud.

NEW FIELD generates a new background gravity noise.
This effect is in most cases completely unnoticable.

STEER will force all particles to travel in the direction set by the ANGLE slider.
But they will soon return to their normal twisting behaviour. */ int[][] screenImage; Pellet[] pellet; SkanaarGUI gui; float gravity = 4; int pelletCount = 500; int opacity = 32; float s = 0.01; // the sampling scale boolean playing = true; int[][] spectrums; int[] spectrum; //--------------------------------------------- void setup(){ size(450,502); framerate(50); screenImage = new int[width][width]; spectrums = new int[5][]; spectrums[0] = new int[]{ 0,2,4 }; spectrums[1] = new int[]{ 2,0,4 }; spectrums[2] = new int[]{ 3,1,0 }; spectrums[3] = new int[]{ 1,1,5 }; spectrums[4] = new int[]{ 1,1,1 }; spectrum = spectrums[0]; gui = new SkanaarGUI(); gui.setDesign( loadFont("silkscreen.vlw") ); //-- playback and system controls gui.addLayer("lay_play"); gui.hideLayer("lay_play"); gui.layer("lay_play").addButton("play", "play (p)", 8, height-43); gui.addLayer("lay_pause"); gui.showLayer("lay_pause"); gui.layer("lay_pause").addButton("pause", "pause (p)", 8, height-43); if(!online) gui.addButton("save_image", "save image", 8, height-23); //-- simulation interaction gui.addText("t_opacity", "opacity", 80+(width-280)/2-68, height-43); gui.addSliderH("slid_opacity", 80+(width-280)/2-68, height-33, 50, 0.2); gui.addText("t_spectrum", "spectrum", 80+(width-280)/2-68, height-23); gui.addSliderH("slid_spectrum", 80+(width-280)/2-68, height-13, 50, 0f); gui.addText("t_gravity", "twist", 80+(width-280)/2-8, height-43); gui.addSliderH("slid_gravity", 80+(width-280)/2-8, height-33, 60, 0.5); gui.addButton("new_field", "new field", 80+(width-280)/2-8, height-23); gui.addText("t_angle", "angle", width-208, height-43); gui.addSliderH("slid_angle", width-208, height-33, 60, 80/(width*0.5)); gui.addButton("steer", "steer", width-208, height-23); //-- respawn parameters gui.addText("t_density", "density", width-128, height-43); gui.addSliderH("slid_density", width-128, height-33, 50, pelletCount/1000f); gui.addText("t_radius", "radius", width-128, height-23); gui.addSliderH("slid_radius", width-128, height-13, 50, 80/(width*0.5)); gui.addButton("respawn", "respawn", width-68, height-43); gui.addRect("rect",-1,width,80,52); gui.addRect("rect",width-138,width,200,52); gui.addRect("rect",width-218,width,80,52); gui.addRect("rect",-1,width,width+1,52); background(0); pellet = new Pellet[pelletCount]; for(int i=0;i>spectrum[0], screenImage[x][y]>>spectrum[1], screenImage[x][y]>>spectrum[2]); updatePixels(); updateGUI(); } //--------------------------------------------- void updateGUI(){ gravity = 10*gui.getValue("slid_gravity"); opacity = (int)( 64*gui.getValue("slid_opacity") ); gui.visualize(); if(mousePressed) gui.mouseDrag(mouseX,mouseY); } //--------------------------------------------- void clearScreen(){ for(int x=0;x