Created
February 13, 2019 19:07
-
-
Save kmancher/e0cd5457ff562f1ec38c352c88106c17 to your computer and use it in GitHub Desktop.
Bobbing object
This file contains hidden or 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
| float yPos = 200; | |
| void setup() { | |
| size(640, 360); | |
| noStroke(); | |
| } | |
| void draw() { | |
| background(0, 255, 255); | |
| fill(0, 0, 255); | |
| rect(0, height/2, width, height); | |
| fill(255); | |
| ellipse(width/2, yPos, 50, 50); | |
| yPos = yPos + 10; | |
| if(yPos < 200) { | |
| yPos +=10; | |
| } else if (yPos > 160) { | |
| yPos -= 10; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment