I’m trying to make a circle bounce in the canvas but I can only get it to bounce from side to side. Here’s the link to my pen. https://codepen.io/OriginalName/pen/mwXbyw
I think your lines:
if (y + radius > innerHeight || y - radius < 0) {
dy = -dy;
}
is in the wrong place. It needs to be inside the animate function, right after the one for x.
It worked, thanks for the help I really appreciate it.