xxxxxxxxxx
41
function setup() {
createCanvas(600, 600);
colorMode(HSB, 360, 100, 100);
background(60, 50, 100);
noFill();
//bezier(85, 20, 10, 10, 90, 90, 15, 80);
//let cellSize = floor(width / 40);
let cellSize = 50;
//randomCurve(width/2-cellSize, height/2-cellSize, cellSize, cellSize);
for(let x = 0; x < width; x+=cellSize){
for(let y = 0; y < height; y+=cellSize){
randomCurve(x, y, cellSize, cellSize);
}
}
}
function randomCurve(x, y, width, height){
//50% chance
strokeWeight(2);
let leftToRight = random(1) <= 0.5;
if(leftToRight){
stroke(360, 50, 100);
//let p1 = {x: x+width/5,y: y+width/5};
let p1 = {x: x, y: y};
//point(p1.x, p1.y);
bezier(x, y+height, p1.x, p1.y+15, p1.x+15, p1.y, x+width, y)
} else {
stroke(200, 50, 100);
let p1 = {x: x+width, y: y};
//point(p1.x, p1.y);
bezier(x, y, p1.x-15, p1.y, p1.x, p1.y+15, x+width, y+height)
}
}
function draw() {
//looping code
}