xxxxxxxxxx
140
// This was my original idea I was going to do in 3D but I changed gears and tried this idea here:
// 1D6 for shapes:
// 1: Plane
// 2: Box
// 3: Cylinder
// 4: Cone
// 5: Sphere
// 6: Torus
// 1D20 - take value * 20 to determine point in space
/////////////////////////////////////////////////////
let shapeVal;
//let colorVal;
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
//debugMode();
}
function draw() {
background(15);
noStroke();
orbitControl();
//ambientLight(255);
//directionalLight(255, 255, 255, 0, 1, 0);
spotLight(205, 205, 205, 0, -1000, 0, 0, 1, 0, PI/3, 25);
spotLight(205, 205, 205, 0, 0, 1000, 0, 0, -1, PI/3, 100);
ambientMaterial(175);
structure();
extraPillars();
normalMaterial();
generateShape();
}
function keyPressed(ENTER) {
shapeVal = floor(random(1, 7));
console.log(shapeVal);
}
function generateShape() {
if(shapeVal == 1) {
push();
rotateY(frameCount * 0.03);
plane(150);
pop();
}
if(shapeVal == 2) {
push();
rotateY(frameCount * 0.03);
box(150);
pop();
}
if(shapeVal == 3) {
push();
rotateY(frameCount * 0.03);
cylinder(150);
pop();
}
if(shapeVal == 4) {
push();
rotateY(frameCount * 0.03);
cone(150);
pop();
}
if(shapeVal == 5) {
push();
rotateY(frameCount * 0.03);
sphere(150);
pop();
}
if(shapeVal == 6) {
push();
rotateY(frameCount * 0.03);
torus(130);
pop();
}
}
function structure() {
push();
translate(0, 200, 0);
box(750, 100, 750);
pop();
push();
translate(263, 0, -263);
box(100, 300, 100);
pop();
push();
translate(-263, 0, -263);
box(100, 300, 100);
pop();
push();
translate(-263, 0, 263);
box(100, 300, 100);
pop();
push();
translate(263, 0, 263);
box(100, 300, 100);
pop();
}
function extraPillars() {
push();
translate(500, 0, -500);
box(100, 2000, 100);
pop();
push();
translate(-500, 0, -500);
box(100, 2000, 100);
pop();
push();
translate(-500, 0, 500);
box(100, 2000, 100);
pop();
push();
translate(500, 0, 500);
box(100, 2000, 100);
pop();
}
/* function keyPressed(SHIFT) {
colorVal = floor(random(8, 13));
console.log(colorVal);
} */