import java.applet.*; import java.awt.*; import java.awt.image.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; public class beachimage extends BApplet { // Beach Image // Kevan Davis, 14/9/03 int direction = 0; int stone = 0; int scatter = 0; int wipenext = 1; int flash = 0; int which = 0; BImage godpic; BImage wordspic; int[][] targetcol = new int[202][202]; int[][] xdirection = new int[202][202]; int[][] ydirection = new int[202][202]; void setup() { size(200,200); wordspic = loadImage("words.jpg"); godpic = loadImage("god.jpg"); noBackground(); } void loop() { if (flash == 0) { flash = 1; which = 1 - which; if (which == 1) { image(wordspic, 0, 0); } else { image(godpic, 0, 0); } for (int x=0; x= 0; x--) { for (int y = 0; y < height; y++) { setPixel(x, y, pebble()); } } } } } void keyPressed() { if(key == 'z' || key == 'Z') { flash = 0; // size(100, 100); // direction++; if (direction == 8) { direction = 0; } } if(key == ' ') { wipenext = 1; } if(key == 'x' || key == 'X') { stone++; if (stone == 4) { stone = 0; } wipenext = 1; } if(key == 'c' || key == 'C') { scatter = 1 - scatter; } } void mousePressed() { for (int yoff=-8; yoff<8; yoff++) { for (int xoff=-8; xoff<8; xoff++) { if (sqrt((xoff*xoff)+(yoff*yoff))<8) { int z = (int)random(255); if (mouseY+yoff > 0 && mouseY+yoff < height && mouseX+xoff > 0 && mouseX+xoff < width) { setPixel(mouseX+xoff, mouseY+yoff, pebble()); } } } } } int pebble() { if (stone == 0) { int z = (int)random(155)+100; return color(z,z/1.5f+random(50),z/3+random(50)); } else if (stone == 2) { if ((int)random(2)==1) { return color(200,0,0); } return color(100,0,0); } else { int z = (int)random(255); return color(z,z,z); } } }