ok I know this is going to end up three pages off from were it was requested, but here it goes, sorry in advance for the painfull spelling and gramer, I was typeing as fast as posable as to not be five pages behind.
important concept to remember the steps I describe do not happen quite as sequentaly as I describe them, many diferent things are going on at the same time
ok, so we have a worm, it has a bunch of light sensitive nerve endings on it's body, most likely to tell it if it needs to burrow and get out of the sun,
some of these worms have a slightly more well developed nervus system allowing them to tell wich way the light is comeing from, and they run in the opposite direction so they don't dry out and die, more of them survive than the ones with a (slightly) less developed utilisation of there senses, and over generations the speciese as a whole gets to understand were the light is comeing from better, at the same time the patturns of the nervs on the outside of there boddies is going from the origonal random distribution (becase all it did origonaly was tell them that there was light not were it's comeing from) to a more organised paturn, this is happening becase the more ordered nerv paturns are better at telling were light is comeing from than the random ones, worms that have patches of there skin covered with ever more precise paturns emerge (becase as I said the ones with less organised nervs can't run from the nasty life crushing light as well) in addition they are getting more of these nerves as haveing more of them gives them a larger sampleing of data for there simple brain like organs to determine were not to be, after a while some worms have there nerve endings organised to such an extent, and they have so many of them and they are so sensitive they not only can tell were light is comething from but also were the lack of light is comeing from (i.e. they can tell the diference between light and dark, at this point they have very primitive blurry innefective eyes, a step below the eyes insects have). as all these physical changes are happening on the outer skin of the worm inside it's nervus system evolution is at work, haveing more and more organised nerves isn't going to do you any good if you'r brain doesn't know what to do with the information it's getting. the first thing, and most important still, to evolve is a nervus system capable of understanding the information it's getting, the worms with a nervus system more apt at identifying light or later darkness are the worms that survive better, on top of that better organiseation and resolution give this system more information to work with. so as it's basic psudo mind becomes better able to cope with it's eye like colection of nerve arrays the worms with better more compact light sensitive nerves are able to, with ever more increased ability, identify a basic blurry world around them. this continues untill we have something like a simple eye.
now on to the fluff (lenses and muscles and stuff)
at this point it becomes he (though 'he' doesn't quite apply to worms) with the best eyes wins. not only do better eyes alow you to run from light but they have reached the point were the combind physical structure and internal hardwireing alow them to sence movement and general blurry shapes, alowing them to identify preditors (once again, those who don't have featuers that go with this trend are now also eaten more oftine). the 'eyes' have become an important asset to the worms, so much so that damage to the nerves means a major disadvantage, as a result cleare protective coverings have begun to develop, worms with thicker coverings have more well defented eyes, are less likely to lose these eyes, are less likely to be eaten or dry out. the coverings get thicker and thicker untill the point at witch they start to bend and focus the light. quite by accedent the worms defenceinve nerve coverings have developed into lenses, worms with a brain more able to use the sharper immages this allows are able to escape preditors and find shelter at a drasticly improved level, and of these the ones with the best formed lenses are able to see the best. muscles that origonaly were there simply to move skin and remained there as the lenses formed are now conected to places were they can change the shape of the lens, allowing some worms improved vission (wich amounts to improved surviveability, and more offspring) other mmuscles move the entier structure, worms that have mucles (wich remember were there to move skin and allow them to rithe about origonaly, but becase the skin to wich they were atached is now eye material there function has diferent effects) better able to controle the shape of the lens and the direction upon wich the whole structure is pointed have better surviveability. this trend continues untill the eye becomes fairly seperated from the rest of the skin it was once a part of. sinking into the body somewhat and developing a retractable covering make it better defended, and the shape becomes more spherical, the shape changes to what ever best suits it's function untill it becomes what you would call an eye.
there you now have worms with eyes