mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
moving getting started to the books subfolder
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Example 07-05 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
int radius = 40;
|
||||
float x = 110;
|
||||
float speed = 0.5;
|
||||
int direction = 1;
|
||||
|
||||
void setup() {
|
||||
size(240, 120);
|
||||
smooth();
|
||||
ellipseMode(RADIUS);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
x += speed * direction;
|
||||
if ((x > width-radius) || (x < radius)) {
|
||||
direction = -direction; // Flip direction
|
||||
}
|
||||
if (direction == 1) {
|
||||
arc(x, 60, radius, radius, 0.52, 5.76); // Face right
|
||||
} else {
|
||||
arc(x, 60, radius, radius, 3.67, 8.9); // Face left
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user