/*
- Processing wallpaper creator
- Karin Hellman
*/
//Variables used
public int w = 800; //Screen width
public int h = 600; //Screen height
public float sizeX; //Ellipse x radi
public float sizeY; //Ellipse Y radi
public float r;
public float g; //rgb values
public float b;
void setup(){
size(w,h); //the size of the output screen
background(255,255,255);
noStroke();
}
void draw(){
}
//Changes the color and size of the ellipses
//every time the mouse is clicked
void mouseClicked(){
sizeX = randVal(w/4, w); //ellipse's max radi 1/4
sizeY = randVal(h/4, h); //of the screen width/height
r = random(255);
g = random(255);
b = random(255);
fill(r,g,b,random(50,200)); //random the alpha each time
//specifys how to draw the ellipses
int[] f = {CENTER, RADIUS, CORNER};
int n = int(random(f.length));
ellipseMode((f[n]));
//Draws a pattern of transparent ellipses covering the screen
for (int i = 0; i < w+sizeX; i=i+int(sizeX)){
for (int j = 0; j < h+sizeY; j=j+int(sizeY)){
ellipse(i, j, sizeX, sizeY);
}
}
}
//function that returns the ellipses' radii
float randVal(float rMax, float max){
float r = random(10, rMax);
r = rMax/round(rMax/r);
return r;
}
No comments:
Post a Comment