xxxxxxxxxx
34
let teapot;
let locX = 0;
function preload() {
// Load model with normalise parameter set to true
teapot = loadModel('assets/teapot.obj', true);
}
function setup() {
createCanvas(1000, 1000, WEBGL);
}
function draw() {
background(255)
let locY = mouseY - width / 2;
ambientLight(60, 60, 60);
directionalLight(255, 255, 255, locX, locY, -1);
scale(2); // Scaled to make model fit into canvas
// rotateX(frameCount * 0.01);
rotateY(locX * 0.01);
normalMaterial(250);
shininess(20);
model(teapot);
}
function mouseWheel(event) {
print(event.delta);
//move the square according to the vertical scroll amount
locX += event.delta;
//uncomment to block page scrolling
//return false;
}