// Phishies // Sjoerd Kranendonk // Based on Flocking by Daniel Shiffman // Demonstration of Craig Reynolds' "Flocking" behavior // See: http://www.red3d.com/cwr/ // Rules: Cohesion, Separation, Alignment // Created 16 August 2007 //static public void main(String args[]) { // PApplet.main(new String[] { "--present", "Phishies" }); //} import noc.*; //import processing.opengl.*; Flock flock; PImage bg; float x, y, xB, yB; int lengthM = 500; float angle = 0.0; float angle_stepsize = 0.02; int i = 0; int t = 0; int rFactor = 0; int cAlpha = 10; int gap = 3; boolean cM = false, cR = true, draws = true; PImage b; void setup() { // set size to 640x480 //int w = screen.width; //int h = screen.height; //size(w,h,OPENGL); size( 800, 600);//, OPENGL ); // get fullscreen exclusive mode setFullScreen( false ); // change resolution to 640, 480 setResolution( 800, 600 ); // let ctrl+f switch to window mode createFullScreenKeyBindings(); //set colormode colorMode(RGB,255,255,255,100); flock = new Flock(); // Add an initial set of boids into the system for (int i = 0; i < 12; i++) { flock.addBoid(new Boid(new Vector3D(width/2,height/2),36.0f,0.05f));//,(random(15f,70f)/10f))); } strokeWeight(5); stroke(255,180,0); smooth(); b = loadImage("zwart.GIF"); //smooth(); frameRate(10); //bg = loadImage("backg.jpg"); //background(bg); } void draw() { // background(100); // image(bg,0,0,width,height); tint(255,cAlpha); image(b, 0, 0); //fill(0); //rect(0,0,640,480); flock.run(); if(cR){ i+=3; } else i-=3 ; if(i == 30){ cR = false; } if( i == 0){ cR = true; } if((i / 3)%gap == 0) draws = true; else draws = false; } void mousePressed() { if ( isFullScreen() ) { setFullScreen(false); } else { setFullScreen(true); } }