Despite the availability of elaborate varieties of nanoparticles, their assembly into regular superstructures and photonic materials remains challenging. Here we show how flexible films of stacked polymer nanoparticles can be directly assembled in a roll-to-roll process using abending-induced oscillatory shear technique. For sub-micron spherical nanoparticles, this gives elastomeric photonic crystals termed polymer opals showing extremely strong tunable structural colour. With oscillatory strain amplitudes of 300%, crystallization initiates at the wall and develops quickly across the bulk within only five oscillations. The resulting structure of random hexagonal close-packed layers is improved by shearing bidirectionally, alternating between two in-plane directions. Our theoretical framework indicates how the reduction inshear viscosity with increasing order of each layer accounts for these results, even when diffusion is totally absent. This general principle of shear ordering in viscoelastic media opens the way to manufacturable photonic materials, and forms a generic tool for ordering nanoparticles.