Last active
November 18, 2021 12:44
-
-
Save declann/bada28c7e828894394f7e16b1aae933c to your computer and use it in GitHub Desktop.
brets bounce
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
p5(sketch => { | |
sketch.setup = function () { | |
sketch.createCanvas(width, 200); | |
}; | |
var x = 0, y = 50, dy = 0; | |
sketch.draw = function () { | |
if (x > 600) { x = 0; y = 50; dy = 0; } | |
sketch.background("#001b42"); | |
x += dx_in; | |
y += dy; | |
if (y > 185) { | |
dy = - dy; | |
sketch.ellipse(x, 190, 36, 25); | |
} else { | |
dy = dy * dampener_in + 3; | |
sketch.ellipse(x, y, 30, 30); | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment