mirror of
https://github.com/processing/processing4.git
synced 2026-01-29 11:21:06 +01:00
32 lines
561 B
Plaintext
32 lines
561 B
Plaintext
class Ring {
|
|
|
|
float x, y; // X-coordinate, y-coordinate
|
|
float diameter; // Diameter of the ring
|
|
boolean on = false; // Turns the display on and off
|
|
|
|
void start(float xpos, float ypos) {
|
|
x = xpos;
|
|
y = ypos;
|
|
on = true;
|
|
diameter = 1;
|
|
}
|
|
|
|
void grow() {
|
|
if (on == true) {
|
|
diameter += 0.5;
|
|
if (diameter > width*2) {
|
|
diameter = 0.0;
|
|
}
|
|
}
|
|
}
|
|
|
|
void display() {
|
|
if (on == true) {
|
|
noFill();
|
|
strokeWeight(4);
|
|
stroke(155, 153);
|
|
ellipse(x, y, diameter, diameter);
|
|
}
|
|
}
|
|
}
|