Daily Creative Coding

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

歪んだパーリンノイズ

/**
 * distorted perline noise 
 * 
 * @author aadebdeb
 * @date 2017/03/05
 */
 
function keyPressed(){
  saveCanvas("image.jpg", "jpg");
}

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


function mousePressed() {
  background(0);

  noStroke();
  var ndistort = random(10000);
  var nw = random(10000);
  var nh = random(10000);
  for (var h = 0; h < height; h++) {
    nw += map(noise(h * 0.01 + ndistort), 0, 1, -0.05, 0.05);
    for (var w = 0; w < width; w++) {
      var n = noise(w * 0.003 + nw, h * 0.003 + nh);
      stroke(map(sin(map(n, 0, 1, 0, TWO_PI * 3)), -1, 1, 0, 255));
      point(w, h); 
    }
  } 
}


function draw() {

}
f:id:aa_debdeb:20170304095716j:plain