There are two potential causes here.
First of all, sometimes when you stand up or change positions quickly, your body's vascular system doesn't have time to respond appropriately by constricting the veins in your feet and legs. When this happens, blood pools in your legs temporarily and the blood flow to your brain is very briefly affected, leading to symptoms like dizziness
or black spots in front of the eyes. You can solve this problem by staying well hydrated, by changing positions slowly, and by talking with your primary care doctor
to determine whether you might be taking any medications that could be making this problem worse.
The second possibility are floaters. These are small collections of protein that form inside the liquid of the eye ball with normal aging. They cast shadows on the retina and therefore are seen as dancing grey or black spots or wavy lines. They are generally not much of a nuisance, but they may be more noticeable when changing position quickly as they suddenly shift around under the influence of gravity.
You should talk to your primary care doctor or your eye doctor
for more information.