xxxxxxxxxx
let stars = [];
let speed = 0;
let myCamera;
function setup() {
background(0);
createCanvas(800, 800, WEBGL);
createStars();
noStroke();
myCamera = createEasyCam();
}
function draw() {
background(0);
orbitControl(5, 5, 0.01);
//Add some lights (every frame!) ------------------------------------------------
//Add directional light to surfaces which face it
//Params: (color, directionVector)
directionalLight(color(150, 100, 0), createVector(-0.8, -0.5, -0.2));
//Add a little light evenly to ALL surfaces. Not too much or we'll see no shadow
ambientLight(180, 150, 150);
}
function createStars() {
for (let i = 0; i < 200; i++) {
let star = {
x: random(-400, 400),
y: random(-400, 400),
z: random(-400, 400),
size: 1
};
stars.push(star);
}
}