xxxxxxxxxx
42
function setup() {
createCanvas(400, 400, WEBGL);
frameRate(10)
colorMode(HSB, 100, 100, 100, 100)
noStroke()
circles = []
for (let i = 0; i < 40; i++) {
x = random(-width/2, width/2)
y = random(-height/2, height/2)
z = random(-100, 100)
circles.push({
r: 5,
x: x,
y: y,
z: z,
ax: random(PI),
ay: random(PI),
az: random(PI),
color: color(random(100), 50, 100, 70)
})
}
}
function draw() {
background(30);
for (let i = 0; i < circles.length; i++) {
c = circles[i]
push()
translate(c.x, c.y, c.z)
rotateX(c.ax)
rotateY(c.ay)
rotateZ(c.az)
fill(c.color)
translate(-c.x, -c.y, -c.z)
circle(c.x, c.y, c.z, c.r)
pop()
c.ax += 0.1
c.ay += 0.005
c.az += 0.01
}
}