Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

歪んだパーリンノイズ#3

/**
 * distorted perline noise #3
 * 
 * @author aadebdeb
 * @date 2017/03/07
 */

function setup() {
  createCanvas(windowWidth, windowHeight);
  mousePressed();
}


function mousePressed() {
  background(0);

  noStroke();
  var ndw = random(10000);
  var ndh = random(10000);
  var nw = random(10000);
  var nh = random(10000);
  for (var h = 0; h < height; h++) {
    nw += map(pow(noise(h * 0.007 + ndw), 6) - pow(0.5, 6), -1, 1, -0.3, 0.3);
    var nht = nh;
    for (var w = 0; w < width; w++) {
      nht += map(pow(noise(w * 0.007 + ndh), 6) - pow(0.5, 6), -1, 1, -0.3, 0.3);
      var n = noise(w * 0.005 + nw, h * 0.005 + nht);
      var cl = sin(map(n, 0, 1, 0, TWO_PI * 1));
      if (cl < 0) {
        stroke(lerpColor(color(104, 129, 167), color(116, 198, 190), map(cl, -1, 0, 0, 1)));
      } else {
        stroke(lerpColor(color(116, 198, 190), color(206, 215, 75), map(cl, 0, 1, 0, 1)));
      }
      point(w, h); 
    }
  } 
}


function draw() {

}
f:id:aa_debdeb:20170304151946j:plain