-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Zero to Mastery
committed
Sep 4, 2023
1 parent
94aa39b
commit 99cbb06
Showing
2 changed files
with
73 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,74 @@ | ||
|
||
body { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
perspective: 1000px; | ||
background-color: #f0f0f0; | ||
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; | ||
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; | ||
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; } | ||
.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); } | ||
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; } | ||
} | ||
0%, | ||
100% { | ||
background-color: #3498db; | ||
} | ||
25% { | ||
background-color: #e74c3c; | ||
} | ||
50% { | ||
background-color: #2ecc71; | ||
} | ||
75% { | ||
background-color: #f1c40f; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +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> | ||
<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 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> | ||
</body> | ||
</html> | ||
|
||
! |