xxxxxxxxxx
42
// Repeating texture
//
// Jared Donovan 2022
//
// Generates a texture like a shaggy carpet.
//
let yHeight = 40;
let y = -yHeight;
let xStep = 10;
let yStep = 5;
let s = 0;
function setup() {
createCanvas(800, 800);
background(220);
stroke(s, 40);
}
function draw() {
//background(220);
// let y = mouseY;
let y2 = y + 40;
for (let x = 0; x < width; x += xStep) {
let x2 = x + random(10);
strokeWeight(random(10));
line(x, y, x2, y2);
}
y += 10;
if (y > height){
y = -yHeight;
s = random(255);
stroke(s, 40);
}
}