Simple activated animations and controls

I’m working on something more challenging, I swear. But in the meantime I was able to play with some 3D objects and 3D rotation in this little script. The mouse can control the motion of the object if you click.


int rX, rY, rZ;

void setup () {
size (400, 400, P3D);
background ( 0);
}

void draw () {
background(0);
if (mousePressed) {

rX = mouseX-200;
rY = mouseY-200;
//println("rX : " + rX + "\n" + "rY : " + rY);
}
else {
rX++;
rY++;
rZ++;
}
translate(200, 200);
rotateX(radians(rX));
rotateY(radians(rY));
rotateZ(radians(rZ));
box(100);
}

Author: Ali

Developer and dreamer. I like to solve problems and make things come to life.

Leave a Reply

Your email address will not be published. Required fields are marked *