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++);

}
Ejecicios de creatividad .. processing





PImage foto;
int i =0;
int j=0;
int tamanio= 10;


void setup () {
  size(1000, 1000);
  foto = loadImage ("Imagen 129.jpg");
}
void draw () {

  if (mouseX>0) {

    tamanio= (int) map (mouseX, 0, width, 5, 30);
  }
  i=0;
  j=0;
  for (int i=0; i< width; i=i+1 ) {
    for (int j=0; j< width; j=j+1 ) {
     
     
     

      fill(random(0, 255), random(0, 255), random(0, 255));
      stroke(foto.get(i, j));
      ellipse(i, j, tamanio, tamanio);
      j=j+tamanio;
    }
    i=i+5;
    j=0;
   
   
  }
}
Usar Whiles y crear cuadrados


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

}

void draw() {
  int num = 0;
  float posX = 0;
  float posY = 0;
  boolean dibujar = true;

  background(220);
  if (dibujar) {
    while (num < 100) {

      if (num > 0) {
         fill(random(255), random(255), random(255));
        rect( posX * num, posY * num, num, num);
      }
   
      num++;
      posX = num ;
      posY = num;
    }

    dibujar = false;
  }
}

IMAGEN DE INTERNET



PImage foto;
int posX;
int posY;
void setup(){
  size (800,800);
  foto = loadImage ("https://tantumevangelium.files.wordpress.com/2013/02/tormenta-de-la-incredulidad.jpg");

}

void draw (){
  while( posX<foto.width){
    foto.set(posX,posY,color(255));
    posX=posX+3;
 
  }
  posX=0;
  posY=posY+3;

  //foto.set(width/2,height/2,color(255,255,0));
  image(foto,0,0,width,height);
  fill(foto.get(mouseX,mouseY));
  ellipse(width/2,height/2,50,50);
}
DEBER Colores ...




CODIGO

void setup() {

  size (500, 500);
  //size(displayWidth, displayHeight);
  background(255);
  colorMode(RGB);
  //colorMode(HSB);
}

void draw() {
  //Alpha
  noStroke();
  rectMode(CORNER);
 
  fill(0,10,10,10);
  rect(250,250,250,250);
  fill(200,20,30,40);
  rect(250,125,250,250);
 
 
  //HSB
  //colorMode(HSB,255);
  colorMode(HSB, 500,50,550);
  color(0,34,43);
  fill(0,554,543,849);
  rectMode(CORNERS);
  rect(500,0,250,250);
 
 
  //Grices
  rectMode(CORNERS);
  noStroke();
  fill(0);
  rect(0,500,250,250);
  fill(20);
  rect(40,500,250,250);
  fill(50);
  rect(85,500,250,250);
  fill(100);
  rect(135,500,250,250);
  fill(150);
  rect(180,500,250,250);
  fill(210);
  rect(220,500,250,250);
 
 
  rectMode(CORNERS);
  colorMode(RGB);
  fill(14,4,53);
  rect(0,0,250,250);
 
 
}

Juego acelerado


boolean  gameOver = true;

float posX;
float posY;

float speedX = 1;
float speedY = 1;     //DECLARAMOS

void setup () {
  size (500, 500);
  posY = random (height);
  posX = random (width);
  rectMode (CENTER); //posision del rectangulo de la base
  posX = width/2;
  posY = height/2;
}

void draw () {
  background (0);

  if (gameOver == true) {   //codigos para que salga game over
    background (#048630);   //fondo de ventana game over
    fill(255);    //color texto
    text ("GAME OVER", width/2, height/2);   //texto
  }

  else {    //codigos para cuando se esta jugando
    fill(255);    //color texto
    text("JUGANDO", width/2, height/2);    //texto

  fill (255);
  rect( mouseX, height*0.95, 80, 10);   //rectangulo: tamaños y codigo para que funcione con el mouse
  fill (#F50202);
  ellipse (posX, posY, 10, 10);

  if (speedY > 10) {
    speedY = 6;
  }

  if (posY > height) {
    speedY = -(speedY*1);  //AUMENTAMOS LA VELOCIDAD EN Y DE ABAJO
    posY = height;
  }
  if (posY < 0) {
    speedY = -(speedY*2); // AUMENTAMOS VELOCIDAD EN Y ARRIBA
    posY = 0;
  }
  if (posX > width) {
    speedX = -(speedX*1); //AUMENTAMOS VELOCIDAD EN X DERECHA
    posX = width;
  }
   if (posX < 0) {
    speedX = -(speedX*1);  //AUMENTAMOS VELOCIDAD EN X IZQUIERDA
    posX = 0;
  }

  if (posY == height) //codigo para cuando se reinicie y la pelotita salga del centro
{
  posX = width/2;
  posY = height/2;
  gameOver = true;
  speedX = speedX ;
  speedY = speedY ;
}
    if (posX > mouseX-30 && posX < mouseX + 30 && posY > 0.95*height-5 && posY < 0.95*height+5){
  speedX = speedX;
  speedY = -1*speedY;
    }


  posX = posX+speedX;
  posY = posY+speedY;
}
}
void keyPressed() {   //codigos para que se reinicie el juego
  if (gameOver == true) {
    gameOver = false;
  }
}
Deber Juego



boolean  gameOver = true; //DECLARAMOS (EN ESTE CASO VERDADERO)

float posX; // DECLARAMOS POSICIONES DE X /  Y
float posY;

float speedX = 3;  //DECLARAMOS VELOCIDAD DE X /Y
float speedY = 3;

void setup () {
  size (500, 500);
  posY = random (height);  //POSCICION ALEATORIA
  posX = random (width);
  rectMode (CENTER); //POSCICION DEL RECTANGULO EN LA BASE
  posX = width/2;
  posY = height/2;
}

void draw () {

  if (gameOver == true) {   // CONDICIONAL IF (GAME OVER)
    background (#100630);   // FONDO VENTANA GAME OVER
    fill(200);    //color texto
    text ("GAME OVER", width/2, height/2);   // TEXTO
  } else {    // CODIGOS PARA CUANDO SE ESTA JUGANDO

    fill(255);    //COLOR DE TEXTO
    text("JUGANDO", width/2, height/2);    //TEXTO


  fill (255);
  rect( mouseX, height*0.95, 80, 10);   //RECTANGULO (MOVIMIENTO CON EL MOUSE)
  fill (#F02222);
  ellipse (posX, posY, 10, 10);


  if (posY > height) {
    speedY = -random(1,4);
    posY = height;
  }
  if (posY < 0) {
    speedY = 3;
    posY = 0;
  }
  if (posX > width) {
    speedX = -random(1,4);
    posX = width;
  }
   if (posX < 0) {
    speedX = -speedX;
    posX = 0;
  }

  if (posY == height) //REINICIO DE LA PELOTA
{
  posX = width/2;
  posY = height/2;
  gameOver = true;
  speedX = speedX ;
  speedY = speedY ;
}
    if (posX > mouseX-30 && posX < mouseX + 30 && posY > 0.95*height-5 && posY < 0.95*height+5){
  speedX = speedX;
  speedY = -1*speedY;    //REBOTE EN EL RECTANGULO
    }


  posX = posX+speedX;
  posY = posY+speedY;
}
}
void keyPressed() {   //REINICIO DE JUEGO ( APLASTANDO UNA TECLA)
  if (gameOver == true) {
    gameOver = false;
  }
}
Leccion 4... Condicionales


float posX;
float posY;
float desplazamiento; // DECLARAMOS LAS DIFERENTES VARIABLES A USAR
float mm;

void setup (){
size(800, 800);   //TAMAÑO DEL DOCUMENTO
posX = width/2;   //POSCICION X EN EL ANCHO DEL DOCUMENTO    (ACTIVAR)  
posY = height/2; // POSCICION Y EN LA ALTURA (ACTIVAR
desplazamiento = -2;  //ACTIVAR EL DESPLAZAMIENTO EN Y
mm= -2;  // ACTIVAMOS EL DESPLAZAMIENTO EN X
}

void draw(){
  background (0);
  fill(#55E364); //COLOR (VERDE)
  ellipse(posX, posY, 300, 300); //ELIPSE
  if(posY < 0){      //CONDICIONAL
  desplazamiento= 1;
  }
  else if (posY> height){ //CONDICIONAL
    desplazamiento= -1;     //SUBIR
  }
 
  posY = posY + desplazamiento  ;
  posX= posX + mm;

  if (posX < 0){
    mm= 2;
  }
  else if (posX > width){  //CONDICIONAL
    mm= -2;  //BAJA
  }
}


Processing Ideas.... 

//DECLARAMOS ESTAS PRIMERAS TRES VARIABLES

String string;  //DECLARA EL TEXTO QUE APARECERA AL IMPRIMIR
float J = 50;    //DECLARA   TAMAÑO DE LETRA A USAR
float P = height; // DECLARA POSCICION


void setup() {

  size (1300,700);  //TAMAÑO DEL DOCUMENTO
  textAlign(CENTER); //ALINEAR AL CENTRO
  frameRate(10);   //VELOCIDAD DEL TEXTO
  textSize(300);     //TAMAÑO DE TEXTO
  string = "Viviendo no envejeces";   // FRASE A USAR

}

void draw() {

  J= J-2.9;   //ACTIVAMOS EL CODIGO ASCII
  P= P -10;
background (0);  //FONDO (NEGRO)

fill(255,255,0);   //COLOR DE TEXTO (AMARILLO)
textSize(200+J); //INDICA COMO VA A VARIAR EL TEXTO
text(string,width/2,height + P);
}