Created
December 28, 2020 20:52
-
-
Save tpatel/851fc68d38db10823dc3da286ff7f415 to your computer and use it in GitHub Desktop.
p5.js implementation of https://generativeartistry.com/tutorials/tiled-lines/
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
function setup() { | |
createCanvas(500, 500); | |
background('#ffffff'); | |
noLoop(); | |
} | |
function randomLine(x, y, w, h) { | |
if(Math.random() < 0.5) { | |
line(x, y, x+w, y+h); | |
} else { | |
line(x+w, y, x, y+h); | |
} | |
} | |
function draw() { | |
strokeWeight(4); | |
const step = 32; | |
for(let i=0; i<step; i++) { | |
for(let j=0; j<step; j++) { | |
randomLine(i*width/step, j*height/step, width/step, height/step); | |
} | |
} | |
} |
Author
tpatel
commented
Dec 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment