Skip to content

Commit

Permalink
3D Rotating Cube Animation (#2330)
Browse files Browse the repository at this point in the history
* 3D Rotating Cube Animation

* updated folder name and include.js file

---------

Co-authored-by: Laureline Paris <32878345+LaurelineP@users.noreply.github.com>
  • Loading branch information
MananSharma2710 and LaurelineP committed Oct 29, 2023
1 parent b5bfa23 commit f706977
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
Binary file added Art/MananSharma2710/Cube.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions Art/MananSharma2710/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<title>3D Cube Animation</title>
</head>
<body>
<div class="cube">
<div class="face front"></div>
<div class="face back"></div>
<div class="face top"></div>
<div class="face bottom"></div>
<div class="face left"></div>
<div class="face right"></div>
</div>
</body>
</html>
44 changes: 44 additions & 0 deletions Art/MananSharma2710/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
perspective: 1000px; /* Add 3D perspective */
background-color: #222;
}

.cube {
width: 100px;
height: 100px;
position: relative;
transform-style: preserve-3d; /* Enable 3D transformations for children */
animation: rotate 4s linear infinite;
}

.face {
width: 100px;
height: 100px;
position: absolute;
border: 1px solid #fff;
display: flex;
justify-content: center;
align-items: center;
font-size: 18px;
}

.front { transform: translateZ(50px); }
.back { transform: translateZ(-50px) rotateY(180deg); }
.top { transform: rotateX(90deg) translateZ(50px); }
.bottom { transform: rotateX(-90deg) translateZ(50px); }
.left { transform: rotateY(-90deg) translateZ(50px); }
.right { transform: rotateY(90deg) translateZ(50px); }

@keyframes rotate {
0% {
transform: rotateX(0deg) rotateY(0deg);
}
100% {
transform: rotateX(360deg) rotateY(360deg);
}
}
7 changes: 7 additions & 0 deletions include.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ let cards = [
author: 'Moccasym',
githubLink: 'https://github.com/Moccasym'
},
{
artName: '3D Rotating Cube Animation',
pageLink: './Art/MananSharma2710/index.html',
imageLink: './Art/MananSharma2710/Cube.gif',
author: 'Manan Sharma',
githubLink: 'https://github.com/MananSharma2710'
},
{
artName: ' Circular Roller ',
pageLink: './Art/himanshumahto/index.html',
Expand Down

0 comments on commit f706977

Please sign in to comment.