Dedicado a UNIVERSELLE: NervousFiches4Universelle

 


“He danzado por los vientos del agua
Entre las enaguas de la abstracción 
De la imaginación soy la fragua
Incandescente de la creativización.

He llorado con lagrimas tan arduas
Que soy experto en decision
Innovando cuando el mundo desagua
Cuando todo se acaba… ahí empiezo yo.”

            Poema de Sergio Salazar Latorre.

   Para mis tres referencias de la creatividad, (Pronúnciensen todos al mismo tiempo, pues ocupan el primer lugar en mi admiración), Para Sergio, Pablo y Javi. Para Universelle (www.universelle.io)


CÓDIGO 

//Dedicado a Universelle

//Para mis tres referencias favoritas: 

//Sergio, Pablo, Javi


let cols, rows;

let scale = 0.06; // Escala para el ruido

let inc = 0.2 // Incremento para el ruido

let zoff = 0; // Variable para el ruido 3D

let particles = [];

let l =600

let numfc=10

function setup() {

  createCanvas(l, l);

  cols = floor(width / numfc);

  rows = floor(height / numfc);


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

    particles.push(new Particle());

  }

}


function draw() {

  background(200,255,255,25);


  let yoff = 0;

  for (let y = 0; y < rows; y++) {

    let xoff = 0;

    for (let x = 0; x < cols; x++) {

      let index = x + y * cols;

      let angle = noise(xoff, yoff, zoff) * TWO_PI * 4;

      let v = p5.Vector.fromAngle(angle);

      xoff += inc;


      // Dibuja una línea para visualizar el campo de flujo

      stroke(0, 12);

      push();

      translate(x * 10, y * 10);

      rotate(v.heading());

      line(0, 0, 10, 0);

      pop();


      yoff += inc;

    }

    zoff += 0.0003;

  }


  for (let i = 0; i < particles.length; i++) {

    particles[i].followField();

    particles[i].update();

    particles[i].show();

    particles[i].edges();

  }

  stroke(0)

  fill(255)

  text("Dedicado a Universelle  www.universelle.io", 10,580)

  text("Para mis tres referencias de la innovación Sergio, Pablo y Javi", 10, 595)

}


class Particle {

  constructor() {

    this.pos = createVector(random(width), random(height));

    this.vel = createVector(0, 0);

    this.acc = createVector(0, 0);

    this.maxSpeed = 4;

    this.prevPos = this.pos.copy();

  }


  update() {

    this.vel.add(this.acc);

    this.vel.limit(this.maxSpeed);

    this.pos.add(this.vel);

    this.acc.mult(0);

  }


  applyForce(force) {

    this.acc.add(force);

  }


  followField() {

    let x = floor(this.pos.x / 10);

    let y = floor(this.pos.y / 10);

    let index = x + y * cols;

    let force = p5.Vector.fromAngle(noise(x * scale, y * scale, zoff) * TWO_PI * 4);

    this.applyForce(force);

  }


  show() {

    stroke(0);

    strokeWeight(2);

    line(this.pos.x, this.pos.y, this.prevPos.x, this.prevPos.y);

    this.updatePrev();

  }


  updatePrev() {

    this.prevPos.x = this.pos.x;

    this.prevPos.y = this.pos.y;

  }


  edges() {

    if (this.pos.x > width) {

      this.pos.x = 0;

      this.updatePrev();

    }

    if (this.pos.x < 0) {

      this.pos.x = width;

      this.updatePrev();

    }

    if (this.pos.y > height) {

      this.pos.y = 0;

      this.updatePrev();

    }

    if (this.pos.y < 0) {

      this.pos.y = height;

      this.updatePrev();

    }

  }

}




Comentarios

Entradas populares