Optical imaging is commonly performed with either a camera and wide-field illumination or with a single detector and a collimated beam that scans the imaged object. Unfortunately, sources that can be collimated and cameras do not exist at all wavelengths and may not always achieve the specifications required for a given application. Single-pixel imaging (SPI) offers an alternative that requires a single detector and may be performed with wide-field illumination, potentially enabling imaging applications in which both the detection and illumination technologies are immature. However, SPI currently struggles with low imaging rates owing to its reliance on configurable spatial light modulators, whose rates do not generally exceed 22 kHz. In this work, we develop an approach towards rapid SPI which relies on cyclic patterns coded onto a spinning mask and demonstrate it for in vivo imaging of C. elegans worms. Spatial modulation rates of up to 2.4 MHz and imaging rates of up to 72 fps are reported, creating new opportunities for using the SPI paradigm in dynamic imaging scenarios.