Skip to content

Commit

Permalink
Added a Cube Animation (#2409)
Browse files Browse the repository at this point in the history
* Create CubeAnimation.html

* "Uploaded a css file and gif"

* Update include.js

* fix syntax error in include.js

---------

Co-authored-by: Sophia Brandt <16630701+sophiabrandt@users.noreply.github.com>
  • Loading branch information
stormworm9 and sophiabrandt committed Oct 31, 2023
1 parent a36f9d0 commit c7da44b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
Binary file added Art/stormworm9/CubeAnimation/CubeAnimation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Art/stormworm9/CubeAnimation/CubeAnimation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport">
<title>Cube CSS Animation with Bootstrap</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-12">
<div class="scene">
<div class="cube">
<div class="face front">Front</div>
<div class="face back">Back</div>
<div class="face left">Left</div>
<div class="face right">Right</div>
<div class="face top">Top</div>
<div class="face bottom">Bottom</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
63 changes: 63 additions & 0 deletions Art/stormworm9/CubeAnimation/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
body {
background: #333;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}

.scene {
perspective: 1200px;
width: 200px;
height: 200px;
animation: spin 10s linear infinite;
}

.cube {
width: 200px;
height: 200px;
position: relative;
transform-style: preserve-3d;
animation: rotate 10s linear infinite, change-color 5s infinite alternate;
margin: 0 auto;
}

.face {
position: absolute;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #fff;
background: var(--face-color);
}

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

@keyframes rotate {
0% { transform: rotateY(0deg) translateZ(0); }
100% { transform: rotateY(360deg) translateZ(0); }
}

@keyframes spin {
0% { transform: rotate(0deg) translateZ(0); }
100% { transform: rotate(360deg) translateZ(200px); }
}

@keyframes change-color {
0%, 100% { --face-color: #007bff; }
20% { --face-color: #ff6f61; }
40% { --face-color: #ffd166; }
60% { --face-color: #6b4226; }
80% { --face-color: #50b5e9; }
}
9 changes: 8 additions & 1 deletion include.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
let cards = [
{
{
artName: 'CubeAnimation',
pageLink: './Art/stormworm9/CubeAnimation/CubeAnimation.html',
imageLink: './Art/stormworm9/CubeAnimation/CubeAnimation.gif',
author: 'stormworm9',
githubLink: 'https://github.com/stormworm9
},
{
artName: 'RingAnimation',
pageLink: './Art/stormworm9/RingAnimation/ring.html',
imageLink: './Art/stormworm9/RingAnimation/ring.gif',
Expand Down

0 comments on commit c7da44b

Please sign in to comment.