Real-time nanoparticle reform paves way for smart coatings