Created
July 27, 2016 12:50
-
-
Save vogelino/3d55f0b71d6e8a82c5c62fc9ca4e0486 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var rows = []; | |
| var gridSquareSize = 20; | |
| function setup() { | |
| createCanvas(windowWidth, windowHeight); | |
| rectMode(CENTER); | |
| stroke(255); | |
| var amountOfRows = Math.max(windowHeight / gridSquareSize); | |
| var amountOfColumns = Math.max(windowWidth / gridSquareSize); | |
| for (let rowIndex = 0; rowIndex < amountOfRows; rowIndex++) { | |
| for (let colIndex = 0; colIndex < amountOfColumns; colIndex++) { | |
| var hasStroke = random() > 0.8; | |
| if (rowIndex <= colIndex) { | |
| fill(0); | |
| } | |
| else { | |
| fill(255) | |
| } | |
| var x = gridSquareSize * colIndex + gridSquareSize / 2; | |
| var y = gridSquareSize * rowIndex + gridSquareSize / 2; | |
| strokeWeight(hasStroke ? 1 : 0); | |
| rect(x, y, gridSquareSize, gridSquareSize, (colIndex * rowIndex / 100)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment