Skip to content

Instantly share code, notes, and snippets.

@jonesfish
Last active October 15, 2015 13:23
Show Gist options
  • Save jonesfish/d6257c4942b4a8c8fe8c to your computer and use it in GitHub Desktop.
Save jonesfish/d6257c4942b4a8c8fe8c to your computer and use it in GitHub Desktop.
PImage diamond = loadImage("img/diamond.png");
size(400,400);
final int COUNT = 5; // 5 diamonds at a line
float spacingX = width/COUNT;
float spacingY = height/COUNT;
float x = 0, y1 = 0, y2 = height-spacingY;
for (int i=0; i<COUNT; i++){
x = i*spacingX;
// 1st diamond
image(diamond,x,y1);
y1 += spacingY;
// 2nd diamond
image(diamond,x,y2);
y2 -= spacingY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment