Integrated optical attenuator based on mechanical deformation of an elastomer layer