Mouse, Keyboard UP key to move the 3D text upwards Use the DOWN key to move the 3D text downwards.
xxxxxxxxxx
let cheese;
let wimpy;
let tct;
var t2 = 90
function preload() {
cheese = loadModel ('tinker.obj');
tct = loadModel ('text.obj');
wimpy = loadImage('wimpy.png')
}
function setup() {
createCanvas(600, 600, WEBGL);
}
function draw() {
background(193, 174, 207);
//cheese mouse
push();
translate(mouseX-250, mouseY-250, 300);
strokeWeight(.5)
ambientLight(255);
ambientMaterial(242, 224, 29)
rotateX(frameCount*0.03);
rotateY(frameCount*0.01);
// rotateZ(frameCount*0.02);
model(cheese);
pop();
//text
push();
translate(0, t2, 100);
noStroke()
ambientLight(155);
ambientMaterial(163, 133, 245)
rotateX(474.5);
// rotateY(frameCount*0.03);
model(tct);
pop();
//greg
push();
translate (-200, -240, 2);
image(wimpy, 0 , 0 );
pop();
}
//UP key to move text upwards
//DOWN key to move text downwards
function keyPressed(){
if (keyCode === UP_ARROW){
t2 -= 30;
}else if (keyCode === DOWN_ARROW){
t2 += 30;
}
}