Skip to content

Commit fcedca2

Browse files
committed
Add sun animation
1 parent 4c4e79f commit fcedca2

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Experiments in drawing and animating with pure CSS.
55
1. [Blinking cat](/cat)
66
2. [Jumping mustache](/mustache)
77
3. [Cat eyes in a signle div](/cat-eyes)
8+
4. [Spinning sun](/sun)

sun/sun.css

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
body {
2+
background-color: khaki;
3+
height: 100%;
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
}
8+
9+
.container {
10+
position: relative;
11+
height: 100px;
12+
width: 100px;
13+
}
14+
15+
.sun {
16+
position: absolute;
17+
width: 100px;
18+
height: 100px;
19+
background-color: gold;
20+
border-radius: 50%;
21+
animation: circleAround 1s linear infinite;
22+
}
23+
24+
.sun:after {
25+
content: '';
26+
position: absolute;
27+
top: 40px;
28+
left: -40px;
29+
background-color: gold;
30+
color: gold;
31+
height: 20px;
32+
width: 20px;
33+
border-radius: 50%;
34+
box-shadow: 80px -80px 0 currentColor,
35+
160px 0px 0 currentColor,
36+
80px 80px 0 currentColor,
37+
25px 55px 0 currentColor,
38+
135px 55px 0 currentColor,
39+
25px -55px 0 currentColor,
40+
135px -55px 0 currentColor;
41+
}
42+
43+
@keyframes circleAround {
44+
0% { transform: rotate(0deg); }
45+
100% { transform: rotate(360deg); }
46+
}

sun/sun.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<html>
2+
<head>
3+
<link rel="stylesheet" href="sun.css">
4+
</head>
5+
<body>
6+
<div class="container">
7+
<div class="sun"></div>
8+
</div>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)