Hi,
I’m new to coding for my student work.
I’m making combining random objects + random words.
I’m trying to put related code and some point it’s working.
But when I put noLoop, the rotation movement is not working…
Can I show the movements of objects during noLoop. and if it refresh the window, it will show different objects.
let sculptures;
let numSculptures = 3;
let sculptures1;
let numSculptures1 = 3;
function preload() {
let sculpture1 = loadModel('obj/furniture1.obj' ,true);
let sculpture2 = loadModel('obj/furniture2.obj',true);
let sculpture3 = loadModel('obj/furniture3.obj',true);
sculptures = [sculpture1,sculpture2, sculpture3];
sculptures1 = [sculpture1,sculpture2, sculpture3];
}
function setup(){
createCanvas(windowWidth,600,WEBGL);
}
function draw() {
background('gray');
noLoop();
let locX = height / -2;
let locY = width / -2;
ambientLight(200, 200, 200);
pointLight(200, 200, 200, locX, locY, 100);
fill('white')
noStroke();
ambientMaterial(250);
scale(2);
translate(0,-40,0);
rotateY(millis()/1000);
rotateX(millis()/1000);
let randoObj = random(sculptures)
model(randoObj);
translate(0,0,0);
let randoObj1 =random(sculptures)
rotateY(millis()/1000);
rotateX(millis()/1000);
model(randoObj1);
translate(0,-40,0);
}
I’ll share my code.
Many thanks in advance!