//PImage face1a;
//PImage face2a;
Face[] faces = new Face [10];
void setup() {
size(600, 400);
background(255);
smooth();
//face1a = loadImage ("face1a.gif");
//face2a = loadImage ("face2a.gif");
for(int i=0; i < faces.length; i++) {
// float x = 300 + i * 2; //place
// float y = 200 + i * 2; //size
// faces[i] = image (face1a);
faces[i] = new Face(random(width), random(height), random (1.5));
}
}
void draw() {
for(int i=0; i < faces.length; i++) {
//faces[i].move();
faces[i].display();
}
}
class Face {
PImage face1;
PImage face2;
int a;
float x, y;
float siz;
Face(float xin, float yin, float sizin) {
face1 = loadImage ("face2a.gif");
face2 = loadImage ("face1a.gif");
x = xin;
y = yin;
siz = sizin;
}
void display() {
pushMatrix();
scale(siz);
image(face1, 200, 10);
if (mousePressed == true){
image(face2, 200,10);
}
else {
//fill(255);
//rect (0,0,600,400);
image(face1, x, y);
}
popMatrix();
}
}
Monica - M
on Monday, Nov 24, 2008 – 8:53 am