xxxxxxxxxx
103
let width = 400;
let height = 400;
let maze;
let rry = [];
let size = 50;
let radius = 100;
function setup() {
createCanvas(width , height,WEBGL);
angleMode(DEGREES);
rectMode(CENTER);
}
function CubeSidesA(c){
for(let k =0; k<3; k++){
rotateY(90);
rotateZ(90);
let tmp = size * 0.5 + k;
for(let x = tmp; x<width; x+=size){
for(let y = tmp ; y<height; y+=size){
push();
translate(x,y,width);
let maze =new Maze(x,y,size);
maze.display();
pop();
}
}
}
}
function sphereMaze(){
for(let i=0; i<width; i+=size){
for(let j=0; j<360; j+=size){
let x = sin(i) * (cos(j) * radius);
let y = cos(i) * radius;
let z = sin(j) * sin(i) * radius;
push();
translate(x,y,z);
// stroke(0)
noFill()
// ambientLight(255);
// box(size)
let maze =new Maze(x,y,size);
//
maze.display();
pop();
}
}
}
function draw(){
orbitControl();
background(255);
let sp=2;
// rotateX(frameCount * sp);
rotateY(frameCount * sp);
// rotateZ(frameCount * sp);
// sphereMaze();
push();
CubeSidesA();
pop();
push();
translate(width,width,width);
rotateX(180);
rotateZ(90)
CubeSidesA();
pop();
}