275
edits
No edit summary |
|||
Line 37: | Line 37: | ||
== End of Semester == | == End of Semester == | ||
<source lang = "java"> | |||
PImage img; | |||
int m = 200; | |||
int p = 30; | |||
color c; | |||
int value = 0; | |||
int q; | |||
int a; | |||
int j; | |||
import processing.sound.*; | |||
SoundFile file; | |||
void setup() { | |||
size(640, 465); | |||
img=loadImage("Schneekanone1.jpg"); | |||
image(img, 0, 0); | |||
file = new SoundFile(this, "Spruehschnee.mp3"); | |||
} | |||
void draw() { | |||
loadPixels(); | |||
for (int w=0; w<000; w++) { | |||
q = int(random(pixels.length)); | |||
a = int(random(a, pixels.length)); | |||
} | |||
} | |||
void mouseReleased() { | |||
file.play(); | |||
for (int w=0; w<2000; w++) { | |||
q = int(random(pixels.length)); | |||
a = int(random(q, pixels.length)); | |||
j = int(random(pixels.length)); | |||
if ( a<pixels.length && j<pixels.length || pixels[m] < pixels[p] ) { | |||
c = pixels[q]; | |||
pixels[q] = c; | |||
pixels[a] = c; | |||
pixels[j] = c; | |||
} | |||
} | |||
updatePixels(); | |||
} | |||
</source> |
edits