/** * Some experiments with Particle Systems. * Nick Selvaggio * 12.15.09 **/ //a collection of palettes. I am using http://www.colourlovers.com/ color[] blues = {#00C5CC, #7CFFF4, #74E4FF, #BEFFEF, #A1F1FF}; color[] light = {#D8EBE0, #BADEDD, #C9BAA1}; color[] smlBlue = {#00C5CC}; color[] blacks = {#000000}; color[] pie_crust = {#310015, #1C0B12, #C4B482, #0D0207, #17070E}; color[] nothing_changes = {#70074B, #110240, #89868A, #FFD000}; color[] classic_holiday = {#5F0606, #DA1717, #FFF5D6, #035F0B, #013A06}; color[] palette = classic_holiday; ArrayList forces; Emitter e; int t; void setup() { size(500,500, P2D); background(255); t=0; //start time at 0. createUniverse(); } //------------------------------------ void createUniverse() { createForces(); createEmitter(); } //------------------------------------ //Here is where we can add environmental forces global to the entire "universe". void createForces() { forces = new ArrayList(); //forces.add(new PVector(0, 9.8)); //gravity. //forces.add(new PVector(2, -3.0)); //random. left to right wind. with a ground blow. } //------------------------------------ void draw() { fill(255, 10); rect(0, 0, width, height); //background(0); e.step(); //steping with it... //recreate the emitter at some arbirary time and then reset. if(t > 175) { createEmitter(); t = 0; } t++; } //shot out to jared tarbell... my favorite artist! color someColor() { return palette[int(random(palette.length))]; } //------------------------------------ void mousePressed() { //saveFrame("ParticleLab-####.png"); //e.emit(); fill(255, 100); rect(0, 0, width, height); //reset time. t = 0; createEmitter(); } void createEmitter() { //instantiate the emitter. e = new Emitter(1000, new PVector(width/2, height/2)); }