Skip to content

Instantly share code, notes, and snippets.

@Fintan
Created October 2, 2012 11:53
Show Gist options
  • Save Fintan/3818443 to your computer and use it in GitHub Desktop.
Save Fintan/3818443 to your computer and use it in GitHub Desktop.
grid layout algorithm
//grid layout snippet:
for(i in 0...cellCount) {
var cell = cells[i];
var xPos = (i % cols) * (cellWidth + colSpacing);
var yPos = Math.floor(i / cols) * (cellHeight + rowSpacing);
cell.x = xPos;
cell.y = yPos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment