A key goal of nanotechnology is the development of artificial machines capable of converting molecular movement into macroscopic work. Although conversion of light into shape changes has been reported and compared to artificial muscles, real applications require work against an external load. Here, we describe the design, synthesis and operation of spring-like materials capable of converting light energy into mechanical work at the macroscopic scale. These versatile materials consist of molecular switches embedded in liquid-crystalline polymer springs. In these springs, molecular movement is converted and amplified into controlled and reversible twisting motions. The springs display complex motion, which includes winding, unwinding and helix inversion, as dictated by their initial shape. Importantly, they can produce work by moving a macroscopic object and mimicking mechanical movements, such as those used by plant tendrils to help the plant access sunlight. These functional materials have potential applications in micromechanical systems, soft robotics and artificial muscles.