xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
}
function draw() {
background(color(51, 51, 51))//color(255, 255, 255))
rotateY(frameCount* -0.010)//(millis() / 1000)//frameCount* -0.025)
orbitControl()
//directionalLight定向光源
let dirX = (mouseX / width - 0.5) * 2;
let dirY = (mouseY / height - 0.5) * 2;
directionalLight(color(220,248,255), -dirX, -dirY, -1);//directionalLight(color(255, 255, 255), 0, 0, -1)//定向灯rgb(222,199,143)
noStroke();
//pointLight点光源
let locX = mouseX - width / 2;
let locY = mouseY - height / 2;
pointLight(color(166,50,240),locX, locY, 500)//(168, 0, 0), 0, 0, 1000)
box(10, 2000, 10)
translate(0, 450, 0)
for (let i = 16; i--;) {
push()
translate(100, 0, 0)
box(50, 10, 50)
translate(350, 600, 0)
noStroke()
box(50, 1430, 50)
translate(50, 0, 0)
box(50, 1230, 50)//box(50, 1200, 50)
translate(50, 0, 0)
box(50, 1030, 50)
translate(50, 0, 0)
box(50, 830, 50)
translate(50, 0, 0)
box(50, 630, 50)
translate(50, 0, 0)
pop()
translate(0, -40, 0)
rotateY(PI / 5)
}
}