Animation shows a probe (shown in yellow) moving past a planet (shown in green). With the right kind of intial position and velocity, the probe can gain energy in the passage past the planet.
Center of the black area is the origin. Experiment with different intial postions and velocities.
The dots show the probe's position at equal intervals of time. Notice the spacing between the dots as the probe appoaches and as it recedes.