<file_sep>package de.darxi.processing.sketches;

import processing.core.PApplet;
import processing.core.PImage;
import processing.opengl.*;

public class ImageManipExp extends PApplet {

	PImage wasp;
	int t; 
	
	static int W = 800; 
	static int H = 300; 
	static int Wc = W/2; 
	static int Hc = H/2; 
	
	
	public void setup(){
		
		size(W,H); 
		background(0);

		wasp = loadImage("images/wasp.jpg");

		image(wasp,0,0,W,H); 

		
	}
	
	public void draw(){

		t++;

		//blend(wasp,0,0,W,H,0,0,Wc+t/1000,Hc+t/1000,LIGHTEST);
		
		//fadeOut(100); 
		
	}
	

	public void fadeOut(float fade){
		
		fill(0,255/fade); 
		rect(0,0,W,H); 
		
	}
	
}
<file_sep>package de.darxi.processing.sketches;

import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
import ddf.minim.analysis.BeatDetect;

public class ThreeDimensionMusic extends AbstractSimpleSketch {

	Minim minim; 
	AudioPlayer track; 
	Float l = 0f; 
	
	BeatDetect b = new BeatDetect();
	
	
	public void setup() {
		
		
		minim = new Minim(this);
				
		track = minim.loadFile("omen.mp3");

		track.play(); 
		
		size(W,H,P3D); 
		noStroke(); 

		background(0);
		
		
	}
	
	
	public void draw() {
		
		background(0);
		
		T++;
		
		float lFactor = track.mix.level()*track.mix.level();
		
		directionalLight(lFactor*500,lFactor*500,lFactor*500,0,0,-200); 
		
		translate(0,Hc,100);
		
		for(int i = 0; i < 300; i++) {
			translate(i*0.5f,0,i*-0.3f);
			drawBox((float)Math.sqrt(track.mix.get(i)),i); 
		}
		
	}

	public void keyPressed() {
		T = 0; 
	}
	
	public void drawBox(float level,int delay){

		fill(255);
		noStroke(); 
		pushMatrix(); 
		rotateX(2*PI/500*T);
		rotateY(2*PI/500*T*(delay*0.4f));
		rotateZ(2*PI/500*T);
		box(200*level*2,200*level*2,200*level*2); 
		popMatrix();
		
	}
	
	public void stop() {
		track.close(); 
		minim.stop();
		
	}
	
}
<file_sep>package de.darxi.processing;
	 
	import toxi.geom.*;
	import toxi.geom.mesh.*;
	import toxi.physics.*;
	import toxi.physics.behaviors.*;
	import toxi.processing.*;
	import processing.opengl.*;
	import processing.core.*;


	/**
	 * This example demonstrates the new winged-edge mesh structure in combination with
	 * the 3d verlet physics engine to simulate a crash test scenario. The winged-edge mesh
	 * provides connectivity information for each mesh vertex which is used to create a
	 * physical representation of the mesh and allows each vertex/particle to be connected with
	 * springs. Every frame the mesh vertices are updated to the position of their corresponding
	 * particle and due to the gravity in the space, the mesh is being deformed.
	 * 
	 * <p>Usage: Press 'r' to restart the simulation.</p>
	 */
	 
	/* 
	 * Copyright (c) 2010 <NAME>
	 * 
	 * This library is free software; you can redistribute it and/or
	 * modify it under the terms of the GNU Lesser General Public
	 * License as published by the Free Software Foundation; either
	 * version 2.1 of the License, or (at your option) any later version.
	 * 
	 * http://creativecommons.org/licenses/LGPL/2.1/
	 * 
	 * This library is distributed in the hope that it will be useful,
	 * but WITHOUT ANY WARRANTY; without even the implied warranty of
	 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
	 * Lesser General Public License for more details.
	 * 
	 * You should have received a copy of the GNU Lesser General Public
	 * License along with this library; if not, write to the Free Software
	 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
	 */

	public class ToxiParticles extends PApplet {
	
	private static final long serialVersionUID = 8397331804008509029L;
	
	
	
	ToxiclibsSupport gfx;
	
	VerletPhysics physics;
	
	WETriangleMesh box;

	
	
	public void setup() {
	
		size(680, 382, OPENGL);
	    
		gfx = new ToxiclibsSupport(this);

	    initPhysics();
	
	}

	
	
	public void draw() {
	    physics.update();
	    // update mesh vertices based on the current particle positions
	    for (Vertex v : box.vertices.values()) {
	        v.set(physics.particles.get(v.id));
	    }
	    // update mesh normals
	    box.computeFaceNormals();
	    // setup lighting
	    background(51);
	    
	    //lighting
	    	lights();
	    	directionalLight(255, 255, 255, -200, 1000, 500);
	    	specular(100);
	    	shininess(100);
	    
	    // point camera at mesh centroid
	    Vec3D c = box.computeCentroid();
	    camera(-100, -50, 80, c.x, c.y, c.z, 0, 1, 0);
	    // draw coordinate system
	    gfx.origin(new Vec3D(), 50);
	    // draw physics bounding box
	    stroke(255, 80);
	    noFill();
	    gfx.box(physics.getWorldBounds());
	    // draw car
	    fill(160);
	    //noStroke();
	    gfx.mesh(box, false, 0);

	}

	
	void initPhysics() {

		physics = 	new VerletPhysics();
	    
		box 	=	new WETriangleMesh().addMesh(new STLReader().loadBinary(openStream("audi.stl"),"car",STLReader.WEMESH));
	    
		// properly orient and scale mesh
	    box.rotateX(PI);
	    box.scale(80);
	    // adjust physics bounding box based on car (but bigger)
	    // and align car with bottom of the new box
	    AABB bounds = box.getBoundingBox();
	    Vec3D ext = bounds.getExtent();
	    Vec3D min = bounds.sub(ext.scale(4, 3, 2));
	    Vec3D max = bounds.add(ext.scale(4, 3, 2));
	    physics.setWorldBounds(AABB.fromMinMax(min, max));
	    box.translate(new Vec3D(ext.scale(3, 2, 0)));
	    // set gravity along negative X axis with slight downward
	    
	    physics.addBehavior(new GravityBehavior(new Vec3D(-0.01f, 0, 0)));
	    
	    // turn mesh vertices into physics particles
	    for (Vertex v : box.vertices.values()) {
	        physics.addParticle(new VerletParticle(v));
	    }
	    // turn mesh edges into springs
	    for (WingedEdge e : box.edges.values()) {
	        VerletParticle a = physics.particles.get(((WEVertex) e.a).id);
	        VerletParticle b = physics.particles.get(((WEVertex) e.b).id);
	        physics.addSpring(new VerletSpring(a, b, a.distanceTo(b), 1f));
	    }
	}

	public void keyPressed() {
	    if (key == 'r') {
	        initPhysics();
	    }
	}

	
	
}
