xxxxxxxxxx
let fish;
var fishX = -400;
let lilguy;
let wood;
let barrel;
function preload(){
fish = loadModel("fish.obj");
lilguy = loadModel("lilguy.obj");
wood = loadImage("wood.png");
barrel = loadImage("barrel.jpg");
}
function setup() {
createCanvas(400, 400, WEBGL);
}
function draw() {
background(38, 122, 173);
push();
translate(0, 0, 0);
rotateX(frameCount*0.01);
rotateY(frameCount*0.01);
rotateZ(frameCount*0.01);
normalMaterial();
model(lilguy);
pop();
push();
translate(100, -150, 0);
rotateX(frameCount*0.015);
rotateY(frameCount*0.015);
rotateZ(frameCount*0.015);
texture(wood);
box(40, 40, 40);
pop();
push();
translate(-100, 50, 0);
rotateX(frameCount*0.015);
rotateY(frameCount*0.015);
rotateZ(frameCount*0.015);
texture(wood);
box(40, 40, 40);
pop();
push();
frameRate(15);
translate(fishX += 10, 125, 0);
if(fishX > 400){
fishX = -400;
}
normalMaterial();
ambientLight(252, 159, 71)
ambientMaterial(255);
model(fish);
pop();
push();
directionalLight(255, 0.25, 0.25, 0);
translate(-100, -100, 0);
specularMaterial(181, 34, 34);
rotateX(frameCount*0.015);
rotateY(frameCount*0.015);
rotateZ(frameCount*0.015);
torus(30, 10, 64, 64);
pop();
push();
translate(100, 100, 0);
rotateX(frameCount*0.015);
rotateY(frameCount*0.015);
rotateZ(frameCount*0.015);
texture(barrel);
cylinder(20, 50);
pop();
}