Visual Experiment 01 (Processing)

Tags:

Categories:

,

Experiment through nested loops designed to iterate across the canvas. Within each cycle, this code draws vibrant, layered circles whose color and position are dynamically controlled by the mouse’s real-time coordinates.

import gifAnimation.*;

GifMaker gifExport;

int totalFrames = 60;
int currentFrame = 0;

void setup() {
  size(250, 250);
  gifExport = new GifMaker(this, "out.gif");
  gifExport.setRepeat(0);
  gifExport.setQuality(10);
  gifExport.setDelay(33);
  background(0);
}

void draw() {
  int size = 20;
  noStroke();
  for (int x=0; x<width; x=x+size) {
    for (int y=0; y<width; y=y+size) {
      fill(mouseX, 255, mouseY);
      circle(mouseX, mouseY, size);
      fill(mouseX, mouseY, 255);
      circle(mouseX, mouseY, size-8);
    }
  }
  gifExport.addFrame();
  currentFrame++;
  if (currentFrame >= totalFrames) {
    gifExport.finish();
    println("GIF saved!");
    noLoop();
  }
}