The trippy patterns that you see when you shut your eyes tightly are called phosphenes. They are caused by electrical charge produced in the retina and/or mechanical stimuli such as rubbing your eyes.