When, as, while" can be used for two events happening at the same time, with the meaning "during the time".
The earthquake occurred when/as/while after": they were sleeping.
- "Before" means" earlier than" and "after" means "later than":
He left before I could explain anything.
We're going to tidy up after everyone is gone.