Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nataliefreed/830899c8286588e3f078 to your computer and use it in GitHub Desktop.
Save nataliefreed/830899c8286588e3f078 to your computer and use it in GitHub Desktop.
void setup()
{
size(300, 300);
//position and draw two triangles in different places
drawMyTriangle(10, 10);
drawMyTriangle(50, 50);
}
void draw()
{
//Remove the // from the line of code below to see what happens when you draw a new white background at the start of every frame
//background(255);
//draw triangles at a y-position of 100, at a random x-position
drawMyTriangle(int(random(0, width)), 100);
}
void drawMyTriangle(int x, int y)
{
triangle(x+0, y+20, x+20, y+0, x+40, y+20);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment