-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
143 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
|
||
<div class="cube"> | ||
<div class="side front"></div> | ||
<div class="side back"></div> | ||
<div class="side right"></div> | ||
<div class="side left"></div> | ||
<div class="side top"></div> | ||
<div class="side bottom"></div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
.container { | ||
perspective: 2000px; | ||
margin: 10rem 20rem; | ||
animation: rotate-cube 20s linear infinite alternate-reverse forwards; | ||
perspective-origin: 50% 50%; | ||
|
||
.cube { | ||
width: 200px; | ||
height: 200px; | ||
/* border: 1.5px solid whitesmoke; */ | ||
position: relative; | ||
border-radius: 10px; | ||
transform-style: preserve-3d; | ||
transition: transform 2s ease-in-out; | ||
|
||
.side { | ||
width: 200px; | ||
height: 200px; | ||
border: 1.5px solid teal; | ||
border-radius: 5px; | ||
position: absolute; | ||
transition: transform 2s ease-in-out; | ||
|
||
&.front { | ||
background-color: teal; | ||
transform: translateZ(100px); | ||
} | ||
|
||
&.back { | ||
background-color: turquoise; | ||
transform: translateZ(-100px); | ||
} | ||
|
||
&.right { | ||
background-color: rgb(14, 60, 60); | ||
transform: translateX(100px) rotateY(90deg); | ||
} | ||
&.left { | ||
background-color:deepskyblue; | ||
transform: translateX(-100px) rotateY(-90deg); | ||
} | ||
&.top { | ||
background-color:dodgerblue; | ||
transform: translateY(100px) rotateX(90deg); | ||
} | ||
&.bottom { | ||
background-color: mediumaquamarine; | ||
transform: translateY(-100px) rotateX(-90deg); | ||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
.cube:hover { | ||
.side.front { | ||
transform: translateZ(150px); | ||
} | ||
.side.back { | ||
transform: translateZ(-150px); | ||
} | ||
.side.right { | ||
transform: translateX(150px) rotateY(90deg); | ||
} | ||
.side.left { | ||
transform: translateX(-150px) rotateY(-90deg); | ||
} | ||
.side.top { | ||
transform: translateY(150px) rotateX(90deg); | ||
} | ||
.side.bottom { | ||
transform: translateY(-150px) rotateX(-90deg); | ||
} | ||
|
||
} | ||
|
||
|
||
@keyframes rotate-cube { | ||
0% { | ||
perspective-origin: 50% 50%; | ||
} | ||
25% { | ||
perspective-origin: 1000px 50%; | ||
} | ||
50% { | ||
perspective-origin: 50% 1000px; | ||
} | ||
75% { | ||
perspective-origin: -1000px 50%; | ||
} | ||
100% { | ||
perspective-origin: 50% -1000px; | ||
} | ||
} |
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