Visual Experiment 13 (Processing)

Tags:

A visual experiment using the colors from a reference image, while a nested, out-of-phase oscillation is generated using the “angle” variable. To create a much smoother transition, Gemini AI was used to make the movement much more stable.

PImage source;
int cellSize = 40; 

void setup() {
  size(800, 600);
  noStroke();

  source = loadImage("josé_chávez_morado.jpg"); 

  source.resize(width, height); 
}

void draw() {
  background(10);

  for (int x = 0; x < width; x += cellSize) {
    for (int y = 0; y < height; y += cellSize) {

      color col = source.get(x, y); 

      float angle = frameCount * 0.05 + (float)(x + y) * 0.02;

      float diameter = map(sin(angle), -1, 1, 5, cellSize * 1.5);

      fill(col); 

      ellipse(x + cellSize / 2, y + cellSize / 2, diameter, diameter);
    }
  }
}