Based on an analysis of maximum stripe deformation (due to depth change on surfaces) and measuring resolution limits, a principle of spatial periodicity used for coding is proposed. When spatial periodicity is used for coding, the resolution is greatly improved, or the number of patterns is greatly reduced for real-time structured light systems. A novel coded pattern for real-time structured light systems is presented, which is based on spatial periodicity. The coding pattern allows range scanning of moving objects with easy implementation of decoding and high measurement resolution. Using alternate time-space coding in a structured light system, we achieve a measurement speed of 20 frames per second with two stripe patterns.