code for Motion Clouds