I am trying to duplicate the ellipse such that its center point of the copy is the inverse of the original position in both axes using the pixels[] array to copy pixel data to new locations. However, the copy does not have the same color (rather than black, it is pink) as the original; the colors are not copying as I intended. Why is this?
This is the code:
function setup() {
createCanvas(600, 600);
smooth(8);
rectMode(CENTER);
fill(250);
stroke(32);
strokeWeight(10);
}
function draw() {
draw_();
}
function draw_() {
background(250);
ellipse(100, 100, 100, 100)
loadPixels();
for(var i=0; i<pixels.length/2; i++)
pixels[pixels.length-i-1] = pixels[i];
updatePixels();
}
This is the result:
