Daily Creative Coding

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

変調されたパーリンノイズ #2

/**
 * modulated perlin noise
 * 
 * @author aadebdeb
 * @date 2017/03/09
 */

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

function mousePressed() {
  var nscale = 0.01;
  var noffsetX = random(10000);
  var noffsetY = random(10000);
  var noffsetZ = random(10000);
  var mscale = 0.01;
  var moffsetX = random(10000);
  var moffsetY = random(10000);
  for (var w = 0; w < width; w++) {
    for (var h = 0; h < height; h++) {
      var m = noise(w * mscale + moffsetX, h * mscale + moffsetY);
      var mz = map(pow(m, 3) - pow(0.5, 3), -1, 1, -10, 10)
      var n = noise(w * nscale + noffsetX, h * nscale + noffsetY, mz + noffsetZ);
      var v = map(sin(map(n, 0, 1, 0, TWO_PI * 2)), -1, 1, 0, 1);
      stroke(lerpColor(color(10, 40, 19), color(78, 161, 159), v));
      point(w, h);
    }
  }
}

function draw() {
  
}
f:id:aa_debdeb:20170304220236j:plain