Change the sliders to adjust physics, click and hold to attract the ball to your mouse. Stiffness: How quickly the ball gets out of the wall Try turning the stiffness very low, then launch the ball into the wall.
This project uses Verlet Integration (https://en.wikipedia.org/wiki/Verlet_integration) Verlet stores the current position and the previous one to calculate physics. This makes it easy to apply constraints, like keeping it in the screen, simply by changing the current position to be on-screen.