mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Removing some examples
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* When the shape hits the edge of the window, it reverses its direction.
|
||||
*/
|
||||
|
||||
int size = 60; // Width of the shape
|
||||
int rad = 60; // Width of the shape
|
||||
float xpos, ypos; // Starting position of shape
|
||||
|
||||
float xspeed = 2.8; // Speed of the shape
|
||||
@@ -16,9 +16,10 @@ int ydirection = 1; // Top to Bottom
|
||||
|
||||
void setup()
|
||||
{
|
||||
size(640, 200);
|
||||
size(640, 360);
|
||||
noStroke();
|
||||
frameRate(30);
|
||||
ellipseMode(RADIUS);
|
||||
smooth();
|
||||
// Set the starting position of the shape
|
||||
xpos = width/2;
|
||||
@@ -35,13 +36,13 @@ void draw()
|
||||
|
||||
// Test to see if the shape exceeds the boundaries of the screen
|
||||
// If it does, reverse its direction by multiplying by -1
|
||||
if (xpos > width-size || xpos < 0) {
|
||||
if (xpos > width-rad || xpos < rad) {
|
||||
xdirection *= -1;
|
||||
}
|
||||
if (ypos > height-size || ypos < 0) {
|
||||
if (ypos > height-rad || ypos < rad) {
|
||||
ydirection *= -1;
|
||||
}
|
||||
|
||||
// Draw the shape
|
||||
ellipse(xpos+size/2, ypos+size/2, size, size);
|
||||
ellipse(xpos, ypos, rad, rad);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user