html
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Солнечная система</title>
<style>
body {
margin: 0;
padding: 0;
background: #000;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.solar-system {
position: relative;
width: 800px;
height: 800px;
}
/* Звездное небо */
.stars {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: transparent;
}
.star {
position: absolute;
background: white;
border-radius: 50%;
animation: twinkle 2s infinite;
}
@keyframes twinkle {
0%, 100% { opacity: 0.5; }
50% { opacity: 1; }
}
/* Солнце */
.sun {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80px;
height: 80px;
background: radial-gradient(circle, #FFD700, #FFA500);
border-radius: 50%;
box-shadow: 0 0 60px #FFA500, 0 0 100px #FF8C00;
animation: sun-glow 2s ease-in-out infinite alternate;
}
@keyframes sun-glow {
from { box-shadow: 0 0 60px #FFA500, 0 0 100px #FF8C00; }
to { box-shadow: 0 0 80px #FFD700, 0 0 120px #FFA500; }
}
/* Орбиты */
.orbit {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px dashed rgba(255, 255, 255, 0.2);
border-radius: 50%;
}
/* Планеты */
.planet-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.planet {
position: absolute;
border-radius: 50%;
top: -50%;
left: 50%;
transform: translateX(-50%);
}
/* Меркурий */
.mercury-orbit {
width: 120px;
height: 120px;
}
.mercury-container {
animation: rotate 4s linear infinite;
}
.mercury {
width: 8px;
height: 8px;
background: #8C7853;
}
/* Венера */
.venus-orbit {
width: 180px;
height: 180px;
}
.venus-container {
animation: rotate 7s linear infinite;
}
.venus {
width: 15px;
height: 15px;
background: #FFC649;
}
/* Земля */
.earth-orbit {
width: 260px;
height: 260px;
}
.earth-container {
animation: rotate 10s linear infinite;
}
.earth {
width: 16px;
height: 16px;
background: radial-gradient(circle at 30% 30%, #4B9BFF, #2E67CF);
box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.3);
}
/* Марс */
.mars-orbit {
width: 340px;
height: 340px;
}
.mars-container {
animation: rotate 15s linear infinite;
}
.mars {
width: 12px;
height: 12px;
background: #CD5C5C;
}
/* Юпитер */
.jupiter-orbit {
width: 480px;
height: 480px;
}
.jupiter-container {
animation: rotate 25s linear infinite;
}
.jupiter {
width: 36px;
height: 36px;
background: linear-gradient(to bottom, #D4A76A, #A0522D, #D4A76A);
}
/* Сатурн */
.saturn-orbit {
width: 600px;
height: 600px;
}
.saturn-container {
animation: rotate 30s linear infinite;
}
.saturn {
width: 30px;
height: 30px;
background: #FAD5A5;
position: relative;
}
.saturn::after {
content: '';
position: absolute;
width: 50px;
height: 8px;
background: linear-gradient(to right, transparent, #C4A57B, #C4A57B, transparent);
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotateZ(-20deg);
border-radius: 50%;
}
/* Анимация вращения */
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Информация о планетах */
.info {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
color: white;
font-family: Arial, sans-serif;
text-align: center;
background: rgba(0, 0, 0, 0.7);
padding: 10px 20px;
border-radius: 10px;
}
/* Мобильная адаптация */
@media (max-width: 768px) {
.solar-system {
transform: scale(0.6);
}
}
</style>
</head>
<body>
<!-- Звездное небо -->
<div class="stars" id="stars"></div>
<!-- Солнечная система -->
<div class="solar-system">
<!-- Солнце -->
<div class="sun"></div>
<!-- Меркурий -->
<div class="orbit mercury-orbit"></div>
<div class="planet-container mercury-container">
<div class="planet mercury"></div>
</div>
<!-- Венера -->
<div class="orbit venus-orbit"></div>
<div class="planet-container venus-container">
<div class="planet venus"></div>
</div>
<!-- Земля -->
<div class="orbit earth-orbit"></div>
<div class="planet-container earth-container">
<div class="planet earth"></div>
</div>
<!-- Марс -->
<div class="orbit mars-orbit"></div>
<div class="planet-container mars-container">
<div class="planet mars"></div>
</div>
<!-- Юпитер -->
<div class="orbit jupiter-orbit"></div>
<div class="planet-container jupiter-container">
<div class="planet jupiter"></div>
</div>
<!-- Сатурн -->
<div class="orbit saturn-orbit"></div>
<div class="planet-container saturn-container">
<div class="planet saturn"></div>
</div>
</div>
<div class="info">
<h3>Солнечная система</h3>
<p>Анимация планет, вращающихся вокруг Солнца</p>
</div>
<script>
// Создание звездного неба
function createStars() {
const starsContainer = document.getElementById('stars');
const numberOfStars = 200;
for (let i = 0; i < numberOfStars; i++) {
const star = document.createElement('div');
star.className = 'star';
star.style.width = Math.random() * 3 + 'px';
star.style.height = star.style.width;
star.style.left = Math.random() * 100 + '%';
star.style.top = Math.random() * 100 + '%';
star.style.animationDelay = Math.random() * 2 + 's';
starsContainer.appendChild(star);
}
}
// Добавление интерактивности (при наведении на планеты)
document.querySelectorAll('.planet').forEach(planet => {
planet.addEventListener('mouseenter', function() {
this.style.transform = 'translateX(-50%) scale(1.5)';
this.style.transition = 'transform 0.3s ease';
});
planet.addEventListener('mouseleave', function() {
this.style.transform = 'translateX(-50%) scale(1)';
});
});
// Инициализация
createStars();
</script>
</body>
</html>