Last active
May 27, 2019 21:02
-
-
Save uxBrad/859d2c1e97b92f5ee091a7d053f1214d 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 allCoordinates = []; | |
// Create a row | |
for ( i = 0; i < rows + 1; i++ ){ | |
// Create a column | |
for ( j = 0; j < columns + 1 ; j++ ){ | |
rect( j * columnWidth, i * columnHeight, columnWidth, columnHeight ) | |
//create my point | |
var pointPositionX = random( j * columnWidth + columnWidth, j * columnWidth ) | |
var pointPositionY = random( i * columnHeight + columnHeight, i * columnHeight ) | |
allCoordinates.push( [pointPositionX, pointPositionY] ) | |
circle( pointPositionX, pointPositionY, 10 ) | |
console.log(allCoordinates) | |
} | |
} | |
// Create the first triangle | |
fill( 90, 90, 90 ) | |
var currentPoint = 0 | |
var firstPointX = allCoordinates[0][0] | |
var firstPointY = allCoordinates[0][1] | |
var secondPointX = allCoordinates[1][0] | |
var secondPointY = allCoordinates[1][1] | |
var thirdPointX = allCoordinates[6][0] | |
var thirdPointY = allCoordinates[6][1] | |
triangle( firstPointX, firstPointY, secondPointX, secondPointY, thirdPointX, thirdPointY ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment