Daily Creative Coding

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

blendMode(DIFFERENCE)で干渉する縞

/**
 * interference disc
 * 
 * @author aadebdeb
 * @date 2017/02/14
 */
 

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

function mousePressed() {
  blendMode(BLEND);
  background(random(255), random(255), random(255));
  blendMode(DIFFERENCE);
  translate(width / 2, height / 2);
  
  push();
  for (var i = 0; i < 5; i++) {
    drawCircles();
  }
  pop();
  
}

function draw() {

  
}

function drawCircles() {
  translate(randomGaussian(0, 4), randomGaussian(0, 4));
  stroke(random(255), random(255), random(255));
  strokeWeight(5);
  noFill();
  for (var r = 10; r < windowWidth + windowHeight; r += 20) {
    ellipse(0, 0, r, r);
  }
}
f:id:aa_debdeb:20170211110231j:plain