Grating-based intereferometry is a method used in X-ray phase-contrast imaging to visualize details in transparent objects that are hard to resolve in absorption contrast. Phase shifts introduced into the propagating X-ray wavefront are translated into intensity variations by comparing changes in the interference patterns produced by diffraction gratings. Diffraction gratings and the interference pattern they produce are typically considered static. Using MEMStechnology, the gratings can be actuated such that, e.g., their internal structure can be varied. By driving the gratings into resonance, it is possible to obtain modulated, dynamic interference patterns. By demodulating the time-varying signals from the detector pixels, useful object-related phase-contrast information can be differentiated from the static background and noise. The method, thus, allows low-dose imaging of organic specimens with improved contrast and reduced noise.