The electron localization function ELF, which is crafted to reveal chemical bonds and their properties, has been generalized to the time-dependent regime. This allows the time-resolved visualization of the formation, modulation and breaking of bonds and gives thus insight into the dynamics of excited electrons. This has been illustrated by the pi–pi* transition of ethyne induced by a laser field, and by the destruction of bonds and the formation of lone-pairs in a scattering process of a proton with ethene. In the second part, an optimal control algorithm is used to determine an optimized laser pulse of a HOMO–LUMO transition of the diatomic molecule lithium fluoride.