xxxxxxxxxx
50
let img;
let cnv;
function preload(){
img = loadImage('assets/DigitalArtworks/A4TT.jpg')
}
function setup() {
cnv = createCanvas(img.width, img.height);
//print(img.width, img.height)
let newCanvasX = (windowWidth - img.width)/2;
let newCanvasY = (windowHeight - img.height)/2;
cnv.position(newCanvasX, newCanvasY);
//row and column of img pixels manipulated by col+= (lower = denser), ie changed by 20, size of points controlled by strokeWeight
//access pixel information of image
for(let col = 0; col< img.width; col+=3){
for(let row = 0; row< img.height; row+=3){
let xPos = col;
let yPos = row;
let c = img.get(xPos, yPos);
//strenght of curve controlled by rotate, thickness of lines by strokeWeight
push();
translate(xPos, yPos);
rotate(radians(random(360)))
noFill();
stroke(color(c))
//points
strokeWeight(random(28));
//point(xPos,yPos);
//curves
strokeWeight(random(3));
curveTightness(random(3));
//curve(x1, y1, x2, y2, x3, y3, x4, y4)
curve(xPos, yPos, sin(xPos) * random(60), cos(xPos) * sin(xPos) * random(75), random(21), random(122), sin(yPos) * random(114), random(635))
pop();
}
}
}
function keyPressed(){
if (key === 's'){
saveCanvas("A4TT.jpg");
}
}