Skip to content

Instantly share code, notes, and snippets.

@borkDoy
Last active May 27, 2019 21:01
Show Gist options
  • Save borkDoy/19e4936b1f2db103211e2ad726b03c0b to your computer and use it in GitHub Desktop.
Save borkDoy/19e4936b1f2db103211e2ad726b03c0b to your computer and use it in GitHub Desktop.
function drawCirclePattern() {
// Creates the dots that surround the canvas
var numberOfRows = 19
var numberOfColumns = 38
var radius = 14
var marginX = 34
var marginY = 38
var xPosition = 20
var yPosition = 16
var rotation = 0
fill ( 215, 21, 101 )
// Create each row
for (j = 0; j < numberOfRows; j++ ){
// Create each column's circle
for (i = 0; i < numberOfColumns; i++ ){
// Add the circle with a little bit of randomness for the Y position
ellipse( xPosition, yPosition + ( random( -3, 3 ) ), radius, radius )
xPosition += marginX
}
// Offset the even numbered rows
if ( j % 2 == 0 ){
xPosition = -41
}
else{
xPosition = 20
}
yPosition += marginY
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment