Click or drag to set the target X position of the black circle. The acceleration of the black circle is limited. You can set the acceleration limit to anything you want, by pressing “a” and inputting the desired acceleration in pixels/second/second.
Code and concept all by me. I achieved this using a physics acceleration formula that calculates where the object will be (its location) at rest if you input the current velocity and current location. I also added an FPS counter for FPS independence, so it runs just as smoothly, or even better at 60fps. This is because it does more calculations per second, so it knows very precisely when to start accelerating in the opposite direction. Also another cool thing: There is a small ball trapped inside the big ball, so it moves backwards when the big ball is accelerating forward, and moves forward when the big ball is accelerating backwards (because of inertia).