Skip to content

Instantly share code, notes, and snippets.

@slambert
Created April 25, 2018 15:37
Show Gist options
  • Save slambert/adb49d9ed9b7ceb9e8d49a9926c16aab to your computer and use it in GitHub Desktop.
Save slambert/adb49d9ed9b7ceb9e8d49a9926c16aab to your computer and use it in GitHub Desktop.
modulo and ring of points working together
float radius=200;
int numPoints=4;
void setup(){
size(500,500);
}
void draw () {
if(frameCount % 15 == 1){
numPoints = frameCount % 270;
}
background(0);
stroke(255);
strokeWeight(5);
pushMatrix();
translate(width/2, height/2);
float angle=TWO_PI/(float)numPoints;
for(int i=0;i<numPoints;i++)
{
point(radius*sin(angle*i),radius*cos(angle*i));
}
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment