This project creates a rotating 3D ASCII cube that is displayed in the terminal. The cube rotates continuously, and the luminance of its faces is shown using ASCII characters. Each face of the cube is uniquely colored with six different colors, similar to a Rubik's cube.
The rotation mechanism is inspired by Andy Sloane's blog post, where he explained how the rotating ASCII donut works. This served as the inspiration for building this project.
- The cube rotates in 3D, and the rotation is displayed with ASCII art in the terminal.
- Luminance is depicted using varying ASCII characters.
- Each face of the cube is displayed in a unique color.
- Pause Rotation: Press the
Space
key to pause the rotation. - Manual Rotation:
- W/S: Rotate the cube around the X-axis.
- A/D: Rotate the cube around the Y-axis.
- Q/E: Rotate the cube around the Z-axis.
- You can customize the direction of the light by modifying the
light
array in the code.
-
Distorted Cube Display:
- If the cube appears distorted in your terminal, maximize the terminal window to full screen or press
Ctrl + "-"
to zoom out.
- If the cube appears distorted in your terminal, maximize the terminal window to full screen or press
-
Performance:
- For increased speed and smoother rotation, connect your laptop to a charger.
- Download the precompiled executable file
rotated_cube.exe
from the repository. - Double-click the executable to run it directly on your system.
- Clone the repository:
git clone https://github.com/aniketmishr/ascii-rotating-shapes.git
- Navigate to the project directory:
cd ascii-rotating-shapes
- Compile the code:
g++ rotating_cube.cpp -o rotating_cube
- Run the program:
./rotating_cube
This project was inspired by Andy Sloane's blog post on the rotating ASCII donut. His explanation motivated me to explore ASCII rendering and create a similar project with a unique spin.
This project is licensed under the MIT License. See the LICENSE
file for details.