Dancingers

 


CÓDIGO

//(C)Sergio Salazar Latorre

//Dancingers or Curiosity of Soul

//Dedicado a MAESTRO: Manuel Pérez Fungueiro

//Mucho mas que un Maestro: una persona

//que desperto en mi el conocimiento de como 

//continuar aprendiendo despues de lo aprendido

//Muchas gracias Querido Amigo


let l = 600

let nd = 50

let d = Array(nd)


function setup() {

  createCanvas(l,l);

  for(let i=0; i<nd; i++){

    d[i] = new Dancinger(random(0,l),

                         random(0,l),

                         random(50,100))

  }

}


function draw() {

  background(0,5);

  for(let i=0; i<nd; i++){

    d[i].showDancinger()

  }

  

  firma()

  

}


class Dancinger{

  constructor(x, y, r){

    this.x=x

    this.y=y    

    this.a1 = 0;

    this.a2 = 0;

    this.a3 = 0;

    this.r1 = r;

    this.r2 = this.r1/2;

    this.r3 = this.r2/2;

    this.cD1=this.colorDancinger(1)

    this.cD2=this.colorDancinger(2)

    this.cD3=this.colorDancinger(3)

  }

  

  showDancinger(){

    // Círculo 1 (centro)

    let x1 = this.x + cos(this.a1) * this.r1;

    let y1 = this.y / 2 + sin(this.a1) * this.r1;

    fill(this.cD1)

    strokeWeight(3)

    stroke(255-this.cD1.levels[1],

          255-this.cD1.levels[2],

          255-this.cD1.levels[3])


    ellipse(x1, y1, this.r1);

    

    // Círculo 2 (gira alrededor de 1)

    let x2 = x1 + cos(this.a2) * this.r2;

    let y2 = y1 + sin(this.a2) * this.r2;

    fill(this.cD2)

    strokeWeight(2)

    stroke(255-this.cD1.levels[1],

          255-this.cD1.levels[2],

          255-this.cD1.levels[3])


    ellipse(x2, y2, this.r2);

    

    // Círculo 3 (gira alrededor de 2)

    let x3 = x2 + cos(this.a3) * this.r3;

    let y3 = y2 + sin(this.a3) * this.r3;

    fill(this.cD3)

    strokeWeight(3)

    stroke(255-this.cD1.levels[1],

          255-this.cD1.levels[2],

          255-this.cD1.levels[3])


    ellipse(x3, y3, this.r3);


    // Actualizar ángulos para la animación

    this.a1 += 0.02;

    this.a2 += 0.05;

    this.a3 += 0.1;

  }

  

  colorDancinger(n){

    let cDan

    if(n==1){

      return color(random(0,100), 

                  random(0,100),

                  random(0,100))

    } else if(n==2){

      return color(random(100,200), 

                  random(100,200),

                  random(100,200))

      

    }else if(n==3){

      return color(random(200,250), 

                  random(200,250),

                  random(200,250))

    }

    

  }

}


function firma(){

  fill(0)

  stroke(255)

  text("(C)Sergio Salazar Latorre", 10, l-12*5)

  text("Dedicado a MAESTRO: Manuel Pérez Fungueiro", 10, l-12*4+3)

  text("Mucho mas que un Maestro: una persona que desperto en mi el conocimiento ", 10,l-12*2)

  text("de cómo continuar aprendiendo después de lo aprendido. Muchas gracias Querido Amigo",10,l-12+2)

}

Comentarios

Entradas populares