Launched in November 2017. View Project Displays a full solar system with planets doing circular movement due to gravity pull of the sun Written entirely on JavaScript How it works? I used an interval that repeats an algorithm for about 30 miliseconds. The algorithm spawns the point-planets with the position (random(0, canvas.width / 2) , canvas.height / 2) and a starting point towards the bottom of the canvas. Than I used the formulas of my book that calculate the gravitational force with which the planets are pulled towards the sun performing circular orbits. The formula i used for gravitational force is F = planetMass * sunMass * gama / distance^2. To make the orbits circular I set this force equal to circular force F = Mass * Speed / distance; Through that I could define the starting speed of each planet. If you want to see some weird planet orbits try changing the parameters of the browser window on your desktop or by rotating the phone screen if ...
Blog about programming experiences, things I've built, and my advice to make best programming choices.