xxxxxxxxxx
function setup() {
createCanvas(800, 800, WEBGL);
colorMode(HSB, 360, 100, 100);
noStroke()
background(0, 10, 10)
}
function draw() {
let locX = mouseX - height / 2;
let locY = mouseY - width / 2;
ambientLight(50);
directionalLight(255, 0, 0, 0.25, 0.25, 0);
pointLight(0, 0, 255, locX, locY, 250)
for (let i = 0; i < 10; i++){
let center = createVector(random(-width,width), random(-height,height),random(-800,800));
let detail = 10
let size = random(15,40)
particle(center,size,detail)
}
}
function particle(center,size,detail){
push()
fill(random(160, 200), 100, 100)
translate(center.x, center.y, center.z)
rotate(random(PI));
sphere(size, detail, detail);
pop()
}