File tree 8 files changed +128
-0
lines changed
8 files changed +128
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+
4
+ < head >
5
+ < meta charset ="UTF-8 ">
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=edge ">
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
8
+ < title > Space Image animation</ title >
9
+ <!-- Remix icons -->
10
+ < link href ="
https://cdn.jsdelivr.net/npm/[email protected] /fonts/remixicon.css "
rel ="
stylesheet "
>
11
+ <!-- Link to your stylesheet -->
12
+ < link rel ="stylesheet " href ="./style.css ">
13
+ </ head >
14
+
15
+ < body >
16
+
17
+ < div class ="scene ">
18
+ < img src ="./stars.png " class ="stars ">
19
+ < img src ="./space_ship.png " class ="ship ">
20
+ < img src ="./astronaut.png " class ="astronaut ">
21
+ < img src ="./comet.png " class ="comet ">
22
+ < img src ="./moon.png " class ="moon ">
23
+ </ div >
24
+
25
+ </ body >
26
+
27
+ </ html >
Original file line number Diff line number Diff line change
1
+ @import url ('https://fonts.googleapis.com/css2?family=Poppins:wght@300&display=swap' );
2
+
3
+ * {
4
+ margin : 0 ;
5
+ padding : 0 ;
6
+ box-sizing : border-box;
7
+ }
8
+
9
+ body {
10
+ font-family : 'Poppins' , sans-serif;
11
+ background-color : # 151515 ;
12
+ display : grid;
13
+ place-content : center;
14
+ height : 100vh ;
15
+ padding : 5px ;
16
+ color : # fff ;
17
+ }
18
+
19
+ /* ======================== */
20
+
21
+ .scene {
22
+ width : 230px ;
23
+ height : 200px ;
24
+ background : url ('./background.jpg' ) center no-repeat;
25
+ background-size : cover;
26
+ border : 5px solid # 191919 ;
27
+ border-radius : 20px ;
28
+ position : relative;
29
+ overflow : hidden;
30
+ }
31
+
32
+ .scene img {
33
+ position : absolute;
34
+ }
35
+
36
+ .stars {
37
+ width : 100% ;
38
+ height : 100% ;
39
+ object-fit : cover;
40
+ animation : stars-rotate 100s linear forwards;
41
+ }
42
+
43
+ .astronaut {
44
+ top : 40px ;
45
+ right : 10px ;
46
+ width : 40px ;
47
+ animation : astronaut-move 20s forwards;
48
+ }
49
+
50
+ .ship {
51
+ top : 60px ;
52
+ left : 120px ;
53
+ width : 50px ;
54
+ transform : scale (0 );
55
+ animation : ship-move 15s 3s forwards;
56
+ }
57
+
58
+ .comet {
59
+ top : 150px ;
60
+ left : -250px ;
61
+ width : 150px ;
62
+ animation : comet-move 20s 5s forwards;
63
+ }
64
+
65
+ .moon {
66
+ bottom : -50px ;
67
+ right : -50px ;
68
+ width : 150px ;
69
+ }
70
+
71
+ @keyframes astronaut-move {
72
+ to {
73
+ transform :
74
+ translate (-300px , -150px ) rotate (-360deg );
75
+ }
76
+ }
77
+
78
+ @keyframes ship-move {
79
+ 25% {
80
+ transform : scale (.5 ) translate (-170px , -25px );
81
+ }
82
+
83
+ 50% ,
84
+ 100% {
85
+ transform : scale (4 ) translate (250px , 300px );
86
+ }
87
+ }
88
+
89
+ @keyframes stars-rotate {
90
+ to {
91
+ transform : rotate (360deg );
92
+ }
93
+ }
94
+
95
+ @keyframes comet-move {
96
+ to {
97
+ transform :
98
+ translate (500px , -150px );
99
+ filter : hue-rotate (360deg );
100
+ }
101
+ }
You can’t perform that action at this time.
0 commit comments