Hello, my brain hurts. I am using the pointLight method on this sphere. I want the light to rotate around the sphere, but I can’t figure out how to do a complete rotation. I am incrementing the z position, but it stops when it gets to the middle of the sphere (max z). Any pointers on how I can get this to have a seemingly full rotation around the sphere? I’m thinking that I have to incorporate the x or y positions of the light, but I’m struggling to figure it out. Thanks in advance.
const ballcolor = [30, 180, 255]; // COLOR TO CHANGE (H, S, B)
let brightness = 40;
let z = -40;
function setup() {
createCanvas(400, 400, WEBGL);
colorMode(HSB,255);
frameRate(10);
}
function draw() {
background(30,20,brightness);
brightness += 5;
if (brightness >= 161) brightness = 70;
// CENTRAL SPHERE
push();
noStroke();
//HELP
z += 20;
if (z >= 800) z = -40;
pointLight(ballcolor, 200, -200, z);
specularMaterial(250);
shininess(70);
sphere(75);
pop();
}
const ballcolor = [30, 180, 255]; // COLOR TO CHANGE (H, S, B)
let brightness = 40;
//let y = -200;
let rad = -10;
function setup() {
createCanvas(400, 400, WEBGL);
colorMode(HSB,255);
frameRate(10);
}
function draw() {
background(20);
/*background(30,20,brightness);
brightness += 5;
if (brightness >= 161) brightness = 70;*/
// CENTRAL SPHERE
push();
noStroke();
rad += 10;
var x = (cos(radians(rad)) * 200);
var z = (sin(radians(rad)) * 200);
var y = (cos(radians(rad)) * 200);
pointLight(ballcolor, x, -y, z);
specularMaterial(250);
shininess(100);
sphere(75);
pop();
}