martes, 12 de abril de 2016

processing 3



float startAngle = 0;
float angleBump= 0;
color Color1 = color (180, 95, 10);
color Color2 = color (0, 80, 110);

void setup () {
  size (600,600);
  smooth();
}

void draw () {
 background(Color1);
  noStroke();
  float radius = 200;
  float angle = startAngle;
 
  while (radius > 0) {
   
    fill(255);
    ellipse(100,100,radius,radius);
    ellipse(300,100,radius,radius);
    ellipse(300,300,radius,radius);
    ellipse(300,500,radius,radius);
   
    fill(Color2);
    arc(100, 100, radius, radius, angle, angle+PI);
       arc(300, 100, radius, radius, angle, angle+PI);
          arc(300, 300, radius, radius, angle, angle+PI);
             arc(300, 500, radius, radius, angle, angle+PI);
             radius-= 30;
             angle += angleBump;
            
  }

startAngle += .01;
angleBump += .010;
}



lunes, 11 de abril de 2016

processing 2



float noiseScale = 0.005;
float noiseOffsetX;
float noiseOffsetY;

void setup () {
 
  size (800, 600, P2D);
  background(255);
  smooth();
  noFill();
  stroke(0,0,0,32);
  for ( int i = 0; i<150; i++){
    noiseOffsetX += 5;
    noiseOffsetY +=7.1;
    drawOneStream();
  }
}
void drawOneStream(){
float px = 0;
float py = height/2.0;
float vx = 150;
float vy = 0;
 int pcnt = 0;
 while ((px>=0) && (px<width) && (py<height) && (py>=0)){
   point(px, py);
   float xNoise = noise((pcnt+noiseOffsetX) * noiseScale);
   float yNoise = noise((pcnt+noiseOffsetY) * noiseScale);
   vx = ((2*vx) + 1 + map(xNoise, 0, 1, -1, 1))/4.0;
   vy = ((3*vy) + map(yNoise, 0, 1, -1, 1))/4.0;
   px += vx;
   py += vy;
   pcnt++;
 }
 }












martes, 5 de abril de 2016

processing


import processing.pdf.*;

void setup() {
  size(600, 600);                                        instrucion de tamaño, coordenadas en x y dado en
  background(190, 678, 800);                    color de fondo, canales( rojo, verde, azul)
  smooth();                                                 suaviza linea no smooth endurece las lineas

beginrecord(pdf, "espiral.pdf");

  translate(300, 300);
  for (float i=0; i<360; i +=0.5) {
    pushMatrix();
    rotate(radians(i));
    translate(0, 200);
    rotate(radians(i*3));
    scale(map(sin(radians(i*6)), -1, 1, .5, 1), map(sin(radians(i*3)), -1, 1, .5, 1));
    drawEllipse();
    popMatrix();
  }
}
void drawEllipse() {
 
  noFill();
  stroke(0, 0, 0, 128);
  ellipse(0, 0, 500, 900);
}