Share your repls and programming experiences

← Back to all posts
Bouncing balls with gravity
rjlevy (345)

Click and hold to see a stream of balls that bounce with gravity. Using JavaScript with canvas. Feedback welcome!

Commentshotnewtop
LTI2 (65)


Guess how many and you win 0.000001 dollars!!!!! and 1 cycle

rjlevy (345)

Hi @LTI2, over 1000? The program really starts to lag after that. Have you used JavaScript Canvas much?

ImmaEatYouMan (17)

@LTI2 42 :/ says greatest computer on the planet

rjlevy (345)

@ImmaEatYouMan is that the answer to the meaning of life? 😆

rjlevy (345)

@LTI2 I thought you were referring to this classic scene from The Hitchhiker's Guide To The Galaxy: https://www.youtube.com/watch?v=5ZLtcTZP2js 😂

nahu (26)

I made a high score can anyone beat it

Leroy01010 (200)

HOW DO YOU BREAK THE PROGRAM

i will hack this thing

rjlevy (345)

it's easy with JavaScript - it happens all the time

k9chelsea2 (614)

something that wold be quite hard yet possible is adding squash and stretch to the ball movements, really cool btw

rjlevy (345)

Hi @NDLFOREVER, thanks - so you mean when a ball hits the bottom or side it squashes?

k9chelsea2 (614)

well, I would say maybe bottom, stretch would work quite well with this program.

rjlevy (345)

@NDLFOREVER, thanks - I know how to animate using CSS @keyframes but don't know how it would work with Canvas - any thoughts?

k9chelsea2 (614)

well, I to be honest I don't actually use JS that much I know that @potatojs did something like this in their 3D flappy bird (I think)

rjlevy (345)

Hi @NDLFOREVER, thanks for that. Yes, I saw the @potatojs flappy bird which looks good. I'll see if he can help :)