mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
Keywords changes, currently not entirely working
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user