Created
October 2, 2012 11:53
-
-
Save Fintan/3818443 to your computer and use it in GitHub Desktop.
grid layout algorithm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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