Friday, November 4, 2016

4 de nov


float [] x, y, rotY;
color [] col;
int cant;
float grow;
void setup() {
  size (1280, 800, OPENGL);
  smooth();
  cant = 25;
  grow = 10;
  x = new float[cant];
  y = new float[cant];
  col = new color[cant];
  rotY = new float[cant];
  int renglones = 5;
  int columnas = 5;
  int contar_cols = 0;
  for (int i=0; i<cant; i+=1) {
    col[i] = color(120, random(100,125), map(i, 0, cant-1, 0, 155));
    x[i] = map (i%renglones, 0, renglones-1, 150, width-150);
    y [i] = map(contar_cols, 0, columnas-1, 150, height-150);
    rotY[i] = map(i, 0, cant-1, 0, TWO_PI);
    if (i%columnas==columnas-1) {
      contar_cols+=1;
    }
  }
}
void draw() {
  background(0);
noFill();
grow+=0.5;
  for (int i=0; i<cant; i+=1) {
    rotY[i]+=0.01;
    pushMatrix();
    translate (x[i], y[i]);
    rotateY(rotY[i]);
    for (int j=0; j<10; j+=1) {
      fill(255,10);
      stroke(col[i]);
      box(grow);
      rotateX(map(mouseX, 0, width, 0, 1));
      rotateZ(map(mouseY,0,height,0,QUARTER_PI));
      scale (1.1);
    }

    popMatrix();
  }
  //saveFrame("cuadro-########.jpg");
}

Friday, October 14, 2016

Arrays 2

//ARRAY LISTADO
float [] y = new float[300];
float [] x = new float[300];
float [] tam = new float[300];
color [] col = new color [300];
void setup() {
  size(1080, 720);

  for (int i=0; i<300; i+=1) {
    x[i]=map(i,0,299,0,width);
    y[i]=height/2;
    tam[i] = random(10,500);
    col [i] = color(random(255),random(255),random(255));
  }
  noFill();
}
void draw() {
  background(110);
  for (int i=0; i<300; i+=1) {
    stroke (col[i]);
    ellipse(x[i], y[i], tam[i], tam[i]);
  }
}

Arrays 1

//ARRAY LISTADO
float [] y = new float[300];
float [] x = new float[300];
float [] tam = new float[300];
void setup() {
  size(1080, 720);

  for (int i=0; i<300; i+=1) {
    x[i]=random(width);
    y[i]=random(height);
    tam[i] = random(10, 200);
  }
  noFill();
}
void draw() {
  background(110);
  for (int i=0; i<300; i+=1) {
    ellipse(x[i], y[i], tam[i], tam[i]);
  }
}

Friday, October 7, 2016

7 de Octubre

 PImage mi_imagen;
PShape mi_forma;
float ang;
void setup() {
  size(1080, 720);
  background(0);
  mi_imagen = loadImage("imagen.png");
  mi_forma = loadShape("forma.svg");
  ang = 0;
}
void draw() {
  noStroke();
  fill(0, 80);
 // rect(0, 0, width, height);
  ang+=0.05;
  imageMode(CENTER);
  shapeMode(CENTER);
  translate(mouseX,mouseY);
  rotate(ang);
  scale (map(cos(ang),-1,1,0.25,1));
  tint(map(tan(-ang),-1,1,100,255), map(sin(ang), -1, 1, 0, 255), random(150));
  image(mi_imagen, 0, 0);
  //shape(mi_forma, 0,0);
}

Friday, September 23, 2016

imágenes y formas

PImage dibujo;
PShape forma;

void setup(){
size(1080,720);
dibujo = loadImage("forma_imagen.png");
forma = loadShape("dibujo_forma.svg");
}
void draw(){
  background(0);
  tint (255,0,0);
  image(dibujo, 100,100);
  shape(forma, 500,100);
}

Friday, September 9, 2016

pelota que bota


float xPos, yPos, diam, vel;
int dirX, dirY;
void setup() {
  size (1080, 720);
  xPos = width/2;
  yPos = height/2;
  dirX=1;
  dirY=1;
  diam = 100;
  vel = 2;
}
void draw() {
  background(110);
  diam = mouseY;
  vel = mouseX/10;
  xPos += vel * dirX;
  yPos += vel * dirY;
  ellipse (xPos, yPos, diam, diam);
  if (xPos>width-(diam/2)||xPos<0+(diam/2)) {
  dirX=-dirX;
  }
  if (yPos>height-(diam/2)||yPos<0+(diam/2)){
  dirY=-dirY;
  }
}

Friday, August 26, 2016

ejercicio clase ago 26

float posY, r, g, b, diam;
int dirY;
void setup() {
  size (1080, 720);
  posY=height/2;
  dirY=1;
  r=0;
  g=0;
  b=0;
  diam = 0;
}
void draw() {
  posY = posY+5*dirY;
  r+=1;
  b+=0.01;
  g = random(255);
  diam+=0.01;
  noStroke();
  fill (255, 5);
  rect (0, 0, width, height);
  noStroke ();
  fill (r, g, sin(b)*255);
  ellipse (width/2, posY, sin(diam)*100, sin(diam)*100);
  if (posY>height-diam/2||posY<0+diam/2) {
    dirY=-dirY;
  }
  if (r>255) {
    r=0;
  }
}

circulo senoidal

float posY, diam, posX;
void setup(){
size(1080,720);
diam = 100;
posY = 0-diam;
posX = width/2;
}
void draw(){
  posY+=random(5);
  posX+=random(4);
  diam += 0.1;
//  background(0);
  ellipse(posX,posY,sin(diam)*100,sin(diam)*100);
  if (posY>height){
  posY=0;
  }
  if (posX>width){
   posX= 0;
  }
 
}

circulo insecto

float posY, diam, posX;
void setup(){
size(1080,720);
diam = 50;
posY = 0-diam;
posX = width/2;
}
void draw(){
  posY+=random(5);
  posX+=random(4);
//  background(0);
  ellipse(posX,posY,diam,diam);
  if (posY>height+diam){
  posY=0-diam;
  }
  if (posX>width+diam){
   posX= 0 - diam;
  }
 
}

Friday, August 19, 2016

círculo creciente en el mouse

float diametro, ancho, r, g, b;

void setup() {
  size(1080, 720);
  diametro = 0;
  ancho = 0.5;
  r= 2;
  g= 20;
  b= 1;
  noFill();
  colorMode(RGB);
  background(108, 12, 193);
}
void draw() {
  noStroke();
  fill(108, 12, 193, 1);
  rect(0, 0, width, height);
  strokeWeight(ancho);
  stroke (r, g, b);
  ellipse(mouseX, mouseY, diametro, diametro);
  diametro = diametro+0.1;
  ancho += 0.2;
  r += 0.1 ;
  g += 0.5;
  b += 1;
  if (diametro>1460) {
    diametro=0;
    ancho=0.5;
  }
  println(diametro);
}

Friday, August 12, 2016

Primer código

size(500,700);
stroke(247,22,158);
strokeWeight(10);
line(0,0,width, height);
stroke (0,255,14);
fill (255,0,0);
ellipse(100,100,100,100);
noStroke();
fill (0,255,0,50);
rect(width/2-25,height/2-25,50,50);
stroke (0);
noFill();
triangle(20,20,400,20,width/2,250);
fill (0);
text("HOLA MUNDO", 400,200);

LIBRO

http://file.ebook777.com/005/Make_Getting_Started_with_Processing_Second_Edition.pdf