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