Annotated code

short, heavily annotated JavaScript programs

Circles bouncing off lines

Uses some simple trigonometry to calculate the movement of circles bouncing off lines.

When I first tried to write this program, I had no idea how to bounce a circle off a line. And I couldn't find any good explanations on the web. Some resources were prose descriptions that did not derive the maths. Some derived the maths, but didn't explain what was going on. Some resouces showed only code. Some resources showed no code.

My approach for the code is to make it proceed in small, pedantic steps. My approach for the comments is to explain all the maths spatially, rather than algebraicly. Hopefully, this means that the explanations are intuitive.