xxxxxxxxxx
let width = 400;
let height = 400;
let center_x = width / 2;
let center_y = height / 2;
let phase = 0;
function setup() {
// HSBモードに変更
// HSB, 色相、彩度、明度の最大値
colorMode(HSB, 360, 100, 100);
createCanvas(width, height);
// noLoop()
background(180, 40, 10);
}
function draw() {
let radius = 0;
let a = 0;
for (let ang = phase; ang <= 360 * 4; ang += 5) {
radius += a;
a += 0.02;
// if (random(10) > 1) continue
let rad = radians(ang);
x = center_x + (radius * cos(rad));
y = center_y + (radius * sin(rad));
x += randomGaussian(0, 25 + a)
y += randomGaussian(0, 25 + a)
star(x, y, ang + phase / 2);
}
radius = 0;
a = 0;
for (let ang = phase + 180; ang <= 360 * 4; ang += 5) {
radius += a;
a += 0.02;
let rad = radians(ang);
x = center_x + (radius * cos(rad));
y = center_y + (radius * sin(rad));
x += randomGaussian(0, 30 + a)
y += randomGaussian(0, 30 + a)
blackstar(x, y);
}
phase += 1;
if (phase > 360) {
phase = 0
}
if (random(10) > 9.91) {
// background(0, 10);
// plot();
}
}
function plot() {
x = random(0, width)
y = random(0, height)
w = randomGaussian(600, 200)
h = randomGaussian(600, 200)
heu = random(0, 100)
sat = random(30, 100)
bri = random(0, 5)
noStroke()
fill(heu, sat, bri);
ellipse(x, y, w, h);
}
function star(x, y, ang) {
heu = (ang * 3 + x + randomGaussian(20, 100)) % 360
// heu = random(0, 360)
sat = random(50, 100)
bri = random(80, 100)
stroke(color(heu, sat, bri, 100))
point(x, y);
}
function star(x, y, ang) {
heu = (ang * 3 + x + randomGaussian(20, 100)) % 360
// heu = random(0, 360)
sat = random(50, 100)
bri = random(80, 100)
w = randomGaussian(1, 4)
h = randomGaussian(1, 4)
noStroke()
fill(color(heu, sat, bri, 100));
ellipse(x, y, w, h);
}
function blackstar(x, y) {
w = randomGaussian(2, 8)
h = randomGaussian(2, 8)
noStroke()
fill(180, 40, 10);
ellipse(x, y, w, h);
}