xxxxxxxxxx
36
let img;
function preload() {
// Load the image before setup() is called.
img = loadImage('myImage.jpg');
}
function setup() {
createCanvas(800, 600);
noLoop();
}
function draw() {
// Base wood color (a warm, light brown)
background(193, 154, 107);
// Set line color to a darker brown and define stroke weight
stroke(120, 85, 60);
strokeWeight(2);
// Spacing between the vertical lines
let spacing = 40;
let noiseScale = 0.02;
// Draw vertical lines with noise-based variation in x position
for (let x = 0; x < width; x += spacing) {
// Calculate an offset for a more organic appearance
let offset = map(noise(x * noiseScale), 0, 1, -5, 5);
line(x + offset, 0, x + offset, height);
}
// Draw the loaded image on top of the wood background
// Adjust the position (x, y) and size (width, height) as needed
image(img, 200, 150, 400, 300);
}