Skip to content

Commit fcac39d

Browse files
committed
Make background more performant
1 parent 1c331e3 commit fcac39d

File tree

1 file changed

+54
-25
lines changed

1 file changed

+54
-25
lines changed

src/index.css

+54-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@import url('https://fonts.googleapis.com/css2?family=Petrona:ital,wght@0,100..900;1,100..900&display=swap');
2-
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap');
1+
@import url("https://fonts.googleapis.com/css2?family=Petrona:ital,wght@0,100..900;1,100..900&display=swap");
2+
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&display=swap");
33

44
* {
55
box-sizing: border-box;
@@ -46,7 +46,8 @@ article {
4646
margin: 3em auto;
4747
}
4848

49-
section, footer {
49+
section,
50+
footer {
5051
max-width: var(--section-width);
5152
margin: auto;
5253
}
@@ -97,32 +98,60 @@ footer {
9798
opacity: 0.15;
9899
}
99100

100-
.orb {
101-
position: absolute;
102-
transform: translate(-50%, -50%);
103-
height: 33%;
104-
aspect-ratio: 1 / 1;
105-
border-radius: 100%;
106-
background-color: var(--orb-color, crimson);
101+
/* Mobile - Use linear gradients for the background */
107102

108-
filter: blur(20em);
103+
.fancy-orb-background {
104+
background-image: linear-gradient(
105+
to bottom,
106+
transparent,
107+
crimson,
108+
transparent,
109+
palegreen,
110+
transparent,
111+
cornflowerblue,
112+
transparent
113+
);
109114
}
110115

111-
.orb-red {
112-
top: calc(33% / 2);
113-
left: 10%;
114-
--orb-x: 10em;
115-
--orb-color: crimson;
116+
.orb {
117+
display: none;
116118
}
117119

118-
.orb-green {
119-
top: calc(33% + calc(33% / 2));
120-
left: 90%;
121-
--orb-color: palegreen;
122-
}
120+
/* Desktop - Use fancy orbs */
121+
122+
@media (min-width: 1024px) {
123+
.fancy-orb-background {
124+
background-image: none;
125+
}
123126

124-
.orb-blue {
125-
top: calc(66% + calc(33% / 2));
126-
left: 10%;
127-
--orb-color: cornflowerblue;
127+
.orb {
128+
display: block;
129+
position: absolute;
130+
transform: translate(-50%, -50%);
131+
height: 33%;
132+
aspect-ratio: 1 / 1;
133+
border-radius: 100%;
134+
background-color: var(--orb-color, crimson);
135+
136+
filter: blur(20em);
137+
}
138+
139+
.orb-red {
140+
top: calc(33% / 2);
141+
left: 10%;
142+
--orb-x: 10em;
143+
--orb-color: crimson;
144+
}
145+
146+
.orb-green {
147+
top: calc(33% + calc(33% / 2));
148+
left: 90%;
149+
--orb-color: palegreen;
150+
}
151+
152+
.orb-blue {
153+
top: calc(66% + calc(33% / 2));
154+
left: 10%;
155+
--orb-color: cornflowerblue;
156+
}
128157
}

0 commit comments

Comments
 (0)