Random / ランダム

乱数はこの画像の基礎を作成します。プログラムがロードされるたびに結果は異なります。

random generative
Math

View Source Code

/*
 * @name Random
 * @arialabel Various shades of grey bars change patterns randomly every half a second 
 * @description Random numbers create the basis of this image.
 * Each time the program is loaded the result is different.
 */
function setup() {
  // createCanvas(710, 400);
  createCanvas(windowWidth, windowHeight);
  background(0);
  strokeWeight(20);
  frameRate(2);
}

function draw() {
  for (let i = 0; i < width; i++) {
    let r = random(255);
    stroke(r);
    line(i, 0, i, height);
  }
}

License

Source code is available on GitHub p5.js website legacy.

All examples are licensed under CC BY-NC-SA 4.0.