xxxxxxxxxx
140
// Texture and World Project.
//Joey Avalos.
// I created a world almost as similar as the universe creating a star, a saturn, and a cube into the world.
let star;
let mmm;
let universe;
let joey;
let planet;
function preload() {
star = loadModel('estrellica.obj');
mmm = loadImage('mario.jpg');
universe = loadImage('universe35.jpg');
joey = loadImage('astroworld.jpg');
planet = loadImage('mmm.jpg');
}
function setup() {
createCanvas(windowWidth,windowHeight, WEBGL);
perspective(PI / 3, width / height, -0.2, 10000000);
detailX = createSlider(2, 24, 12);
detailX.position(10, height + 5);
detailX.style('width', '80px');
}
function draw() {
background(0);
push();
drawStar();
pop();
push();
cero();
pop();
orbitControl(350);
astroWorld();
push();
playboy();
pop();
}
function drawStar() {
push();
background(200);
noStroke();
rotateX(frameCount * 0.03);
rotateY(frameCount * 0.03);
scale(10);
texture(mmm);
model(star);
pop();
}
function astroWorld(){
push();
//orbitControl();
noStroke();
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
texture(universe);
scale(20);
sphere();
pop();
}
function cero(){
push();
texture(joey);
rotateX(frameCount * 0.03);
rotateY(frameCount * 0.03);
rotateZ(frameCount * 0.03);
translate(150,150);
box(50);
pop();
}
function playboy(){
translate(-200,-150);
texture(planet);
rotateZ(frameCount * 0.04);
rotateY(frameCount * 0.04);
rotateX(frameCount * 0.04);
strokeWeight(0.25);
sphere(50);
torus(80,10);
}