forked from strivedi4u/hacktoberfest2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sun_earth_moon.html
84 lines (76 loc) · 1.54 KB
/
sun_earth_moon.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
.sun{
height: 175px;
width: 175px;
border-radius: 50%;
background-color: rgb(255, 81, 0);
position: absolute;
box-shadow: 0 0 75px rgba(255, 141, 0, 1);
}
.container{
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: black;
}
.earth{
height: 75px;
width: 75px;
border-radius: 50%;
background-color: navy;
position: relative;
animation: earth-orbit 7s linear infinite;
}
.earth:after{
content: "";
position: absolute;
width: 45px;
height: 45px;
border-radius: 50%;
background-color: #b1a8a8;
border: none;
background-size: cover;
animation: moon-orbit 3.5s linear infinite;
}
@keyframes earth-orbit
{
from{
transform: rotate(0deg) translateX(220px) rotate(0deg);
}
to{
transform: rotate(360deg) translateX(220px) rotate(-360deg);
}
}
@keyframes moon-orbit
{
from{
transform: rotate(0deg) translateX(75px) rotate(0deg);
}
to{
transform: rotate(360deg) translateX(75px) rotate(-360deg);
}
}
</style>
</head>
<body>
<div class="container">
<div class="sun">
<div class="earth"></div>
<div class="moon"></div>
</div>
</div>
</body>
</html>