Skip to content

Commit

Permalink
Merge pull request #1712 from manishdevelops/3d-cube
Browse files Browse the repository at this point in the history
add 3d spinning cube
  • Loading branch information
l-white committed Sep 4, 2023
2 parents e230d21 + 5ba9a39 commit 94aa39b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
Binary file added Art/ManishM/3dcube.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions Art/ManishM/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
perspective: 1000px;
background-color: #f0f0f0;
}

.cube {
position: relative;
transform-style: preserve-3d;
animation: spinAndChangeColor 10s linear infinite, changeCubeColor 10s ease-in-out infinite;
}

.surface {
position: absolute;
width: 200px;
height: 200px;
background: transparent;
border: 2px solid #fff;
}

.surface:nth-child(1) { transform: rotateY(0deg) translateZ(100px); background-color: #3498db; }
.surface:nth-child(2) { transform: rotateY(90deg) translateZ(100px); background-color: #e74c3c; }
.surface:nth-child(3) { transform: rotateY(180deg) translateZ(100px); background-color: #2ecc71; }
.surface:nth-child(4) { transform: rotateY(-90deg) translateZ(100px); background-color: #f1c40f; }
.surface:nth-child(5) { transform: rotateX(90deg) translateZ(100px); background-color: #9b59b6; }
.surface:nth-child(6) { transform: rotateX(-90deg) translateZ(100px); background-color: #34495e; }

@keyframes spinAndChangeColor {
0% { transform: rotateX(0deg) rotateY(0deg); }
100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes changeCubeColor {
0%, 100% { background-color: #3498db; }
25% { background-color: #e74c3c; }
50% { background-color: #2ecc71; }
75% { background-color: #f1c40f; }
}
20 changes: 20 additions & 0 deletions Art/ManishM/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="index.css">
</head>
<body>
<div class="cube">
<div class="surface"></div>
<div class="surface"></div>
<div class="surface"></div>
<div class="surface"></div>
<div class="surface"></div>
<div class="surface"></div>
</div>
</body>
</html>

!
7 changes: 7 additions & 0 deletions include.js
Original file line number Diff line number Diff line change
Expand Up @@ -6513,6 +6513,13 @@ let cards = [
author: 'cpk3',
githubLink: 'https://github.com/cpk3'
},
{
artName: '3D spinning cube',
pageLink: './Art/ManishM/index.html',
imageLink: './Art/ManishM/3dcube.gif',
author: 'Manish Mandal',
githubLink: 'https://github.com/manishdevelops'
},
{
pageLink: '.Art/yashraj2003e/index.html',
imageLink: '.Art/yashraj20033/animation.gif',
Expand Down

0 comments on commit 94aa39b

Please sign in to comment.