Skip to content

Instantly share code, notes, and snippets.

@emmettbutler
Created February 14, 2013 15:20
Show Gist options
  • Save emmettbutler/4953497 to your computer and use it in GitHub Desktop.
Save emmettbutler/4953497 to your computer and use it in GitHub Desktop.
The movement code producing this beautiful periodic spiral pattern http://i.imgur.com/3Si1Ki5.gif
// ttime is the global timer, a floating point number of seconds
for(int i = 0; i < numSprites; i++){
sprites[i]->SetAngle(sprites[i]->GetAngle() + .04);
sprites[i]->SetPosition(spm::vec2(
anchorPoint.m[0] + 20 * i * sin(i * .01f * ttime),
anchorPoint.m[1] + 20 * i * cos(i * .01f * ttime)
));
sprites[i]->Draw(frame);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment