Daily Creative Coding

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

サイバー・ランドスケープ

/*
 * cyber landscape
 *
 * @author aadebdeb
 * @date 2017/01/29
 */

var startW;

function setup(){
  createCanvas(windowWidth, windowHeight);
  frameRate(10);
  background(0);
  startW = -100;
}

function draw(){
  stroke(lerpColor(color(111, 186, 44, 100), color(63, 184, 236, 100), map(sin(frameCount * 0.01), -1, 1, 0, 1)));
  noFill();
  beginShape();
  for (var h = -150; h < height + 150; h += 20) {
    var w = startW - h * 2;
    var nh = h + noise(w * 0.01, h * 0.01, frameCount * 0.0001) * -150;
    vertex(w, nh);
  }
  endShape();
  startW += 20;
  if(startW > width * 2.5 + 100) {
    startW = random(-105, -100);
  }
}
f:id:aa_debdeb:20170126083109j:plain