Hi, I have been watching some tutorials this weekend and came across a tutorial that I started to tweak to create some Monet-like artworks from my pictures. The only problem is that it has some strange behavior on the right side of the image (long lines), and I’m not sure what is causing it. I guess they are the last pixels of every column.
Does anyone have an idea how I could change my code not to get this effect?
I created a Sandbox for the project:
Code:
let img;
let cnv;
function preload() {
img = [
"/assets/temp-1.jpeg",
"/assets/temp-2.jpeg",
"/assets/temp-3.jpeg",
"/assets/temp-4.jpeg",
"/assets/temp-5.jpeg",
"/assets/temp-6.jpeg",
"/assets/temp-7.jpeg",
"/assets/temp-8.jpeg",
"/assets/temp-9.jpeg",
"/assets/temp-11.jpeg",
"/assets/temp-13.jpeg"
];
var pos = floor(random(img.length));
img = loadImage(img[pos]);
}
function setup() {
// img.resize(img.width, img.height);
cnv = createCanvas(img.width, img.height);
let newCanvasX = (windowWidth - img.width) / 2;
let newCanvasy = (windowHeight - img.height) / 2;
cnv.position(newCanvasX, newCanvasy);
for (let col = 0; col < img.width; col += 1) {
for (let row = 0; row < img.height; row += 1) {
let xPos = col;
let yPos = row;
let c = img.get(xPos, yPos);
push();
translate(xPos, yPos);
rotate(radians(random(90, 360)));
noFill();
stroke(color(c));
strokeWeight(random(1, 3));
curve(
xPos,
yPos,
sin(xPos) * random(4, 10),
cos(xPos) * sin(xPos) * random(2, 10),
random(10),
random(2, 10),
cos(yPos) * sin(yPos) * random(2, 3),
cos(xPos) * sin(xPos) * 2
);
pop();
}
}
}

