Skip to content

Solar_System Animation ART #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 195 additions & 0 deletions solar system art/solar_system.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
.solar-system {
position: relative;
width: 800px;
height: 800px;
margin: 50px auto;
background-color: #000;
border-radius: 50%;
}


.sun {
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
margin-top: -40px;
margin-left: -40px;
background: radial-gradient(circle, #ff9933 0%, #ff6600 100%);
border-radius: 50%;
box-shadow: 0 0 50px #ff9933;
z-index: 10;
}


.orbit {
position: absolute;
top: 50%;
left: 50%;
border: 1px solid rgba(255, 255, 255, 0.2);
border-radius: 50%;
transform-style: preserve-3d;
animation: orbit linear infinite;
}


.planet {
position: absolute;
top: -5px;
left: 50%;
width: 10px;
height: 10px;
margin-left: -5px;
border-radius: 50%;
transform-origin: 0 0;
}

.mercury-orbit {
width: 140px;
height: 140px;
margin-top: -70px;
margin-left: -70px;
animation-duration: 3s;
}

.venus-orbit {
width: 200px;
height: 200px;
margin-top: -100px;
margin-left: -100px;
animation-duration: 5s;
}

.earth-orbit {
width: 280px;
height: 280px;
margin-top: -140px;
margin-left: -140px;
animation-duration: 8s;
}

.mars-orbit {
width: 360px;
height: 360px;
margin-top: -180px;
margin-left: -180px;
animation-duration: 12s;
}

.jupiter-orbit {
width: 480px;
height: 480px;
margin-top: -240px;
margin-left: -240px;
animation-duration: 20s;
}

.saturn-orbit {
width: 580px;
height: 580px;
margin-top: -290px;
margin-left: -290px;
animation-duration: 25s;
}

.uranus-orbit {
width: 680px;
height: 680px;
margin-top: -340px;
margin-left: -340px;
animation-duration: 30s;
}


.mercury {
background: #b6bac5;
width: 8px;
height: 8px;
}

.venus {
background: #e7cdcd;
width: 15px;
height: 15px;
}

.earth {
background: #6b93d6;
width: 16px;
height: 16px;
}

.mars {
background: #c1440e;
width: 12px;
height: 12px;
}

.jupiter {
background: #e3dccb;
width: 36px;
height: 36px;
}

.saturn {
background: #c3a992;
width: 30px;
height: 30px;
}

.uranus {
background: #c1e7ea;
width: 20px;
height: 20px;
}


@keyframes orbit {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}


.planet::after {
content: attr(data-name);
position: absolute;
left: 50%;
top: -20px;
transform: translateX(-50%);
color: white;
font-size: 12px;
white-space: nowrap;
opacity: 0;
transition: opacity 0.2s;
}

.planet:hover::after {
opacity: 1;
}


.solar-system::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background-image: radial-gradient(white 1px, transparent 1px);
background-size: 50px 50px;
opacity: 0.3;
}


body {
background-color: #000;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
overflow: hidden;
}
21 changes: 21 additions & 0 deletions solar system art/solar_system.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS-Only Spinning Solar System</title>
<link rel="stylesheet" href="solar_system.css">
</head>
<body>
<div class="solar-system">
<div class="sun"></div>
<div class="orbit mercury-orbit"><div class="planet mercury" data-name="Mercury"></div></div>
<div class="orbit venus-orbit"><div class="planet venus" data-name="Venus"></div></div>
<div class="orbit earth-orbit"><div class="planet earth" data-name="Earth"></div></div>
<div class="orbit mars-orbit"><div class="planet mars" data-name="Mars"></div></div>
<div class="orbit jupiter-orbit"><div class="planet jupiter" data-name="Jupiter"></div></div>
<div class="orbit saturn-orbit"><div class="planet saturn" data-name="Saturn"></div></div>
<div class="orbit uranus-orbit"><div class="planet uranus" data-name="Uranus"></div></div>
</div>
</body>
</html>