鼠标点击物体旋转,再点击停止。

float angle=0;  


boolean a=true;


void setup() {

  size(500, 500,P3D);

}


float x = 0;


void draw() {

  background(204);

  noFill();

  translate(width/2,height/2,0);

  rotateX(angle);

  

  if(a){

   angle=angle+0.01;

  }

  

   box(80);

 

}


void mousePressed() {

  a=!a;

}



希望这些入门的案例可以帮到更多喜欢processing的新手,有意加我QQ:617416179,大家一起学习processing