Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Created September 9, 2014 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nataliefreed/3026c6c40bde5d581197 to your computer and use it in GitHub Desktop.
Save nataliefreed/3026c6c40bde5d581197 to your computer and use it in GitHub Desktop.
//Art and Science of Computing Fall 14
//Star decreases in size over time
//Click mouse to save a "screenshot" of its current state
int[] xPositions = { 90, 251, 51, 213, 151, 90 };
int[] yPositions = { 230, 112, 112, 229, 39, 230 };
float scaleSize = 1;
void setup()
{
size(300, 300);
}
void draw()
{
background(255);
scale(scaleSize);
beginShape();
for(int i=0;i<xPositions.length;i++)
{
vertex(xPositions[i], yPositions[i]);
}
endShape();
scaleSize = scaleSize - 0.001;
}
void mousePressed()
{
saveFrame("star.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment