topical media & game development
graphic-processing-learning-04-example-4-7-example-4-7.pde / pde
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 4-7: Filling variables with random values
float r;
float g;
float b;
float a;
float diam;
float x;
float y;
void setup() {
size(200,200);
background(255);
smooth();
}
void draw() {
// Each time through draw(), new random numbers are picked for a new ellipse.
r = random(255);
g = random(255);
b = random(255);
a = random(255);
diam = random(20);
x = random(width);
y = random(height);
// Use values to draw an ellipse
noStroke();
fill(r,g,b,a);
ellipse(x,y,diam,diam);
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.