Processing Cube
2022
Processing Cube
In this project, I used Variables, Functions, For Loops, Conditionals, Classes, Vec3d, 3d objects, pop, push matrix in processing to make Dancing Cubes that can rotate automatically, change constantly and interact with the mouse.
Category
Interactive Animation, Creative Coding
Tools
Processing
Working Process
Stage 1
Stage 2
Stage 3
Final
Final Work
Coding
First I set up the boxes of different sizes and divide them into two groups: stationary and rotating. The rotating box is rotated automatically by rotate(r); r=r+frameRate. Create two classes, ant and Cpoint. In ant, set int idX, idY, idZ, and use the created moveForward, turnleft and grid to control the movement of ant, and restrict the movement of the small boxes that change size with the sin function to a certain range by if. Set int indexX, indexY, loc, etc. in Cpoint to create points and boxes that change colour and can interact with mouseX, depending on the different state values.
In void setup and void draw, use pushMatrix and popMatrix to make ant and Cpoint form the four sides of a box. They rotate with the rotating boxes. The black and white colours of the input image are used to correspond to the different states and are used as the initial state of the box. As the frameRate changes the cubes start to rotate and change. The colour of the cube is changed by if(mouseX<width/2). If(mousePressed==true) makes some of the cubes' stroke and fill to interact with the mouse.
Void Setup & Draw
Class