-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
1 parent
b5bfa23
commit f706977
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,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> |
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,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); | ||
} | ||
} |
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