Gravity obeys an inverse square law - this was Newton's great discovery
Although this sounds complex it's not really
When the distance gets greater the force gets less by the sqaure of that - an example
when it's twice as far away the force is 1/4 ( 4 being the square of 2)
when it's 3 times as far away the force is 1/9 etc
Now what this means in principle is several types of trajectory are possible - some are nearly circular (like the planets), some highly eliptical (like regular comets) and others are open like comets that do not return.
These open trajectories are usually hyperbolic.
The shape of orbit depends largely on the speed of the body and the angle it comes in at.
The body moves faster as it gets closer to the sungiving it more energy to escape again before slowing down and being dragged back
http://upload.wikimedia.org/wikipedia/en/thumb/6/69/Kepler-second-law.gif/220px-Kepler-second-law.gif
Gravity is constant (but tails off with distance) - I'm not sure elastic is quite the same - Imagine a hill that gets steeper the closer you get to the summit
Kepler first discovered all about this and formulated 3 laws about it
http://en.wikipedia.org/wiki/Kepler%27s_laws_of_planetary_motion