import traer.physics.*; import com.nootropic.processing.layers.*; int w = 500; int h = w; AppletLayers layers; PImage backgroundImage; boolean newClick = false; void setup() { size(500, 500); frameRate(24); layers = new AppletLayers(this); layers.addLayer(new HeatLayer(this)); layers.addLayer(new SparksLayer(this)); layers.addLayer(new SmokeLayer(this)); layers.addLayer(new LightLayer(this)); backgroundImage = loadImage("metal1.jpg"); image(backgroundImage, 0, 0); } void paint(java.awt.Graphics g) { if (layers != null) { layers.paint(this); } else { super.paint(g); } } void draw() { if (mousePressed) { noCursor(); smooth(); stroke(0); strokeWeight(random(2,4)); if (!newClick) { line(mouseX, mouseY, pmouseX, pmouseY); } newClick = false; int size = (int)random(5, 10); int dx = (int)random(-5, 5); int dy = (int)random(-5, 5); copy(mouseX - size/2, mouseY - size/2, size, size, mouseX+dx-(size/2), mouseY+dy-(size/2), size, size); } else { cursor(CROSS); } } void mousePressed() { newClick = true; } void keyPressed() { if (key == CODED) { if ((keyCode == RIGHT) && (!looping)) { redraw(); } } else { if (key == ' ') { if (looping) { noLoop(); } else { loop(); } } } }