Keywords changes, currently not entirely working

This commit is contained in:
Casey Reas
2012-12-09 15:35:57 +00:00
parent 46e3f44d1f
commit b9d9505827
15 changed files with 441 additions and 460 deletions

View File

@@ -9,26 +9,27 @@ class Bubble {
float x,y;
float diameter;
color c;
color c;
Bubble(float r,float g, float b, float d) {
x = width/2;
y = height/2;
c = color(r,g,b,150);
c = color(r, g, b, 204);
diameter = d;
}
// Display Bubble
void display() {
stroke(0);
noStroke();
fill(c);
ellipse(x,y,diameter,diameter);
ellipse(x, y, diameter, diameter);
}
// Bubble drifts upwards
void drift() {
x += random(-1,1);
y += random(-1,1);
x = constrain(x,0,width);
y = constrain(y,0,height);
x += random(-1, 1);
y += random(-1, 1);
x = constrain(x, 0, width);
y = constrain(y, 0, height);
}
}

View File

@@ -21,7 +21,7 @@ Bubble[] bubbles;
void setup() {
size(640, 360);
smooth();
// Load an XML document
XML xml = loadXML("bubbles.xml");
@@ -31,7 +31,7 @@ void setup() {
// Make an array of objects the same size
bubbles = new Bubble[children.length];
for (int i = 0; i < children.length; i ++ ) {
for (int i = 0; i < children.length; i++ ) {
// The diameter is the content of the child named "Diamater"
XML diameterElement = children[i].getChild("diameter");