Source CODE : 

function setup() {
createCanvas(600, 500, WEBGL);
trs = loadImage('trs.png');  
txt = loadImage('txt.png');  
rotx = 0;
roty = 0;
z=0;
trans=1;
textFont('Bahnschrift');
}
function draw() {
  if(trans==1) {
    background(0,150,50);
  } else {
    background(230);
  }
  rectMode(CENTER);
  
  if(mouseX<600 && mouseX>-300 && mouseY<500 && mouseY>-250) {
    rotx=(mouseX-300)/250;
    roty=((mouseY-250)/200)*-1;
  }
  texture(txt);
  rect(0,234,600,30);
  
  translate(0,0,z);
  rotateX(roty);
  rotateY(rotx);
  if(trans==1) {
    fill(0,100,200);
  } else {
    texture(trs);
  }
  circle(0,0,100);
  if(trans==1) {
    fill(200,20,0);
  } else {
    texture(trs);
  } 
  translate(0,0,25);
  box(10,10,50);
  rotateX(0);
  rotateY(0);
  translate(0,0,0);
  
}
function mouseWheel(event) {   
    z-=event.delta;
}
function keyPressed() {
  trans=trans*-1; 
}

Leave a comment

Log in with itch.io to leave a comment.