BallCannon

A rectangle represents a launcher which launches simulated balls, represented by colored circles. Pressing the "Fire!" button fires a ball out of the launcher. Controls allow changing the angle of the cannon and the velocity it fires balls out. A small random component is added to the angle that the balls are fired out to simulate imprecision in a real cannon. Technically there should also be some randomness to the velocity as well, but I haven't added that to this simulation.

Source Code: