xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB, 360, 100, 100, 100);
}
function draw() {
background(0, 0, 255);
smooth();
//ランダムな場所に10000個の直線を引く
for (let i = 0; i < 10000; i++) {
push(); //座標を記憶
//ランダムな位置に移動
let x = random(width);
let y = random(height);
translate(x, y);
//X座標で色相を変化
let hue = map(x, 0, width, random(120), random(240, 360));
stroke(hue, 80, 80);
//ランダムに回転
rotate(random(PI));
//線を描く
line(-width/200, 0, width/200, 0);
pop(); //座標を元に戻す
}
noLoop(); //ループ停止
}