A 3D rotating cube animation built with HTML, CSS, and JavaScript.
This project displays a 3D cube with numbered faces that continuously rotates in both X and Y axes. The cube is composed of six sides, each with a different number of dots (1-6) similar to a die. The animation runs infinitely with a smooth rotation effect.
- 3D cube with six distinct faces
- Continuous rotation animation (15 seconds per full rotation)
- Responsive design that centers the cube on the screen
- Each face of the cube has a different number of dots (1-6)
- Purple/blue violet color scheme with black cube faces
.
├── index.html
├── css/
│ └── style.css
├── js/
│ └── index.js
└── .vscode/
└── settings.json
- HTML5
- CSS3 (with 3D transforms and animations)
- JavaScript (currently contains example code snippets)
The cube is created using CSS 3D transforms:
- The main cube container uses
transform-style: preserve-3dto create a 3D space - Each face is positioned absolutely and transformed to create the cube shape
- A CSS animation rotates the cube continuously around both X and Y axes
- Perspective is applied to the container to give a 3D effect
Developed by Isah Abdullahi Isah
- Clone or download the repository
- Open
index.htmlin a web browser - (Optional) Use Live Server extension with port 5501 as configured in
.vscode/settings.json
The JavaScript file currently contains commented-out example code snippets and is not actively used in the animation. The cube animation is implemented purely with CSS.
You can modify the following aspects by editing the CSS:
- Rotation speed (change the animation duration in
.cube) - Cube size (adjust width/height in
.cubeandtransformvalues) - Colors (edit
background-colorinbodyand.side) - Dot patterns (modify the divs in each face)