viernes, 17 de junio de 2016

123d design.


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


noFill();
stroke(255);
strokeWeight(2);
}

float t= - 0;

void draw(){
  background(0);
 
  translate(width / 2, height/ 2);
 
  beginShape();
 
  //ad some vertices ...
  for (float theta = 0; theta <= 2 * PI; theta +=0.01) {
    float rad = r(theta,
    2, //a
    2, //b
    6, //m
    1, //n1
    sin(t) *0.5 + 0.5, //n2
    cos(t) *0.5 + 0.5 //n3
    );
    float x = rad * cos(theta)*50;
    float y =rad * sin(theta)*50;
    vertex(x, y);
  }
 
  endShape();
 
  t += 0.1;
 
}


float r(float theta, float a, float b, float m, float n1, float n2, float n3) {
  return pow(pow(abs(cos (m * theta / 4.0)/ a), n2) + pow(abs(sin(m * theta / 4.0) / b), n3), -1.0/ n1);
}
// y = 5x

// x =5t
// y= 3t + 3

static final int NUM_LINES = 10;
float t;
void setup(){
  background (20);
  size(500, 500);
}

void draw(){
  background(20);
  stroke(255);
  strokeWeight(5);
 
  translate(width/2, height/2);

 for (int i = 0; i< NUM_LINES; i++){
  line(x1(t+i), y1(t+i),x2(t+i), y2(t+i));
 }
  t+=0.4;
 
}

float x1(float t) {
  return sin(t/10)*100 +sin(t/5)* 20;
}

float y1(float t) {
  return cos(t/ 10)* 100;
}

float x2(float t) {
  return sin(t/10)*200 +sin(t/15)* 2;
}

float y2(float t) {
  return cos(t/ 20)* 200+cos (t/12)*20;
}

miércoles, 15 de junio de 2016