Created
April 30, 2022 18:09
-
-
Save argestes/dd1cc9c4ccf361778cfc5d045887ac27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(600, 400); | |
ellipse(50, 50, 60, 60); | |
} | |
int xPosition = 100; | |
int yPosition = 100; | |
int t = 0; | |
int vX = 3; | |
int vY = 3; | |
boolean enteredFrame = true; | |
// x(t) = x0 + v * t; | |
void draw() { | |
background(255); | |
xPosition = xPosition + vX; | |
yPosition = yPosition + vY; | |
ellipse(xPosition, yPosition, 60, 60); | |
if (xPosition + 30 > width || xPosition - 30 < 0 ) { | |
vX = vX * -1; | |
} | |
if (yPosition + 30 > height || yPosition - 30 < 0) { | |
//noLoop(); | |
vY = vY * -1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment