Galeria de imagenes.


   String [] s = {
    "1.jpg", "2.jpg", "3.jpg", "4.jpg", "5.jpg"    
  };
  int indiceActual =0;
  PImage [] imgs = new PImage [s.length];
  PImage img;
  void setup() {
    size(1500, 1000);
    for (int i= 0; i<s.length; i++) {
      imgs [i] = loadImage(s[i]);
    }
    textSize(40);
    img = loadImage(s[indiceActual]);           //pocicion
 
    imageMode(CENTER);
    rectMode(CENTER);
  }
  void draw () {
    //text(s[],width/2, height/2);
    //for (int i=0; i<s.length ; i++ ){
    background(0);
    img = loadImage(s[indiceActual]);          
    image (img, width/2, height/2);
    text(s[indiceActual], width/2, height/2);
    //}
    for (int i= 0; i<imgs.length; i++) {
      image(imgs[i], i*width/imgs.length+width/imgs.length/2, height/1.12, 100, 100);
    }
    if (mouseY>height/1.12 - width/imgs.length/2 && mouseX>width/imgs.length ) {
      noFill();
      stroke(0, 255, 255);
      strokeWeight(4);
      rect(width/imgs.length+width/imgs.length/2, height/1.12, 105, 105);
   
    } else {
      noStroke();
    }
  }
  void mouseClicked() {
    if (mouseX>width/2) {
      indiceActual= indiceActual+1;
    } else if (mouseX<width/2) {
      indiceActual= indiceActual-1;
    }
    if (indiceActual > s.length-1) {
      indiceActual = 0;
    }
    if (indiceActual <  0) {
      indiceActual = s.length-1;
    }
    img = loadImage(s[indiceActual]);
  }







CODIGO , letras "For"

void setup() {
  size(800, 800);
  }

 void draw() {
   background(200,200,5);
    for (int i=0;i<width;i+=50) {
      for (int j=0; j<height; j+=50) {
        fill(255);
        textSize((int) 2+j*0.1);
          text("C", i, height-j);
      }
    }
  }
import processing.video.*;
Capture cam;
float x;
float y;

PImage eyetest;
int blackPixels = 0;
PImage img;
void setup() {
  size(800, 800);
  String[] cameras = Capture.list();
  cam = new Capture(this, 720, 480);
  eyetest = loadImage("VIDA.jpg");
  cam.start();
}

void draw() {
  if (cam.available() == true) {
    cam.read();
  }
  blackPixels = 0;
  for (int i=0; i<cam.width; i++) {
    for (int j=0; j<cam.height; j++) {

      if (brightness(cam.get(i, j)) > 80) {
        //cam.set(i, j, color(255));
      } else {
        blackPixels = blackPixels + 1;
        //cam.set(i, j, color(0));
      }
    }
  }
  int x = (int)map(blackPixels, 160000, 190000, 0, 6);
  int y = (int)map(blackPixels, 160000, 190000, 0, 6);



  image(cam, 0, 0, width, height);
  ellipse(width/2, height/2, x++, y++);

}