A fun project that renders a 3D spinning donut in Java using Swing and simple 3D math.
Inspired by the classic ASCII donut, but rendered with smooth graphics and shading.
- 3D torus rendered with Java2D
- Real-time rotation on X, Y, Z axes
- Simple perspective projection
- Basic lighting & shading
- Smooth 60 FPS animation
Here’s the donut in action:
- Clone this repository:
git clone https://github.com/anshumanjadiya1102/DonutJava.git
cd DonutJava- Compile
javac SwingDonut.java
- Run
java SwingDonut
A window will open with the spinning donut 🍩.
If you want to capture your own demo:
-
Run the program
-
Use ShareX (Windows) or Peek/Kap (Linux/Mac)
-
Record the window as GIF and drop it into the repo
-
Java 8+
-
Swing for GUI rendering
-
Basic 3D math (rotation matrices + perspective)
Apache License — feel free to use, modify, and share.
