@@ -139,109 +139,114 @@ main {
139139 opacity : 1 ;
140140 transform : translateY (0 );
141141}
142- /* --- Glitch Effect --- */
142+
143+ /* --- Corrected Glitch Effect --- */
144+
143145.glitch {
144146 position : relative;
145- /* Use Catppuccin colors for a cohesive theme */
147+ /* Using Catppuccin colors for better theme integration */
146148 color : # cba6f7 ; /* Mauve */
147- /* Animation: name duration timing-function delay iteration-count direction fill-mode */
148- animation : glitch-skew 1s infinite linear alternate-reverse;
149149}
150150
151+ /* Common styles for the glitch layers */
151152.glitch ::before ,
152153.glitch ::after {
153- content : attr (data-text);
154+ content : attr (data-text); /* Use the text from the HTML element */
154155 position : absolute;
155156 top : 0 ;
156157 left : 0 ;
157158 width : 100% ;
158159 height : 100% ;
159- background : # 1e1e2e ; /* Base color to prevent transparency issues */
160+ overflow : hidden;
161+ background : # 1e1e2e ; /* Base color */
160162}
161163
162- /* Red channel glitch */
164+ /* Red channel effect */
163165.glitch ::before {
164- left : 2 px ;
166+ left : 3 px ;
165167 text-shadow : -2px 0 # f38ba8 ; /* Red */
166- clip-path : inset ( 50 % 0 51 % 0 );
167- animation : glitch-anim -1 2s infinite linear alternate-reverse ;
168+ /* This animation uses steps for a sharp, random-feeling clip effect */
169+ animation : glitch-animation -1 2s linear infinite reverse alternate;
168170}
169171
170- /* Blue channel glitch */
172+ /* Blue channel effect */
171173.glitch ::after {
172- left : -2 px ;
174+ left : -3 px ;
173175 text-shadow : -2px 0 # 89b4fa ; /* Blue */
174- clip-path : inset (0% 0 95% 0 );
175- animation : glitch-anim-2 3s infinite linear alternate-reverse;
176+ animation : glitch-animation-2 2s linear infinite reverse alternate;
176177}
177178
178179/* --- Keyframes --- */
180+ /* Manually creating steps to simulate the Sass @for loop and random() function */
179181
180- /* Main element's skewing animation */
181- @keyframes glitch-skew {
182+ @keyframes glitch-animation-1 {
182183 0% {
183- transform : skew (0deg );
184- }
185- 5% {
186- transform : skew (1deg );
184+ clip-path : inset (45px 0 105px 0 );
187185 }
188186 10% {
189- transform : skew (1deg );
190- }
191- 15% {
192- transform : skew (-1deg );
187+ clip-path : inset (10px 0 90px 0 );
193188 }
194189 20% {
195- transform : skew (-1deg );
196- }
197- 25% {
198- transform : skew (0deg );
199- }
200- 100% {
201- transform : skew (0deg );
202- }
203- }
204-
205- /* Animation for the red channel pseudo-element */
206- @keyframes glitch-anim-1 {
207- 0% {
208- clip-path : inset (50% 0 51% 0 );
190+ clip-path : inset (130px 0 5px 0 );
209191 }
210- 20 % {
211- clip-path : inset (10 % 0 85 % 0 );
192+ 30 % {
193+ clip-path : inset (50 px 0 80 px 0 );
212194 }
213195 40% {
214- clip-path : inset (80% 0 10% 0 );
196+ clip-path : inset (70px 0 15px 0 );
197+ }
198+ 50% {
199+ clip-path : inset (140px 0 10px 0 );
215200 }
216201 60% {
217- clip-path : inset (40% 0 45% 0 );
202+ clip-path : inset (20px 0 125px 0 );
203+ }
204+ 70% {
205+ clip-path : inset (100px 0 30px 0 );
218206 }
219207 80% {
220- clip-path : inset (90% 0 5% 0 );
208+ clip-path : inset (60px 0 40px 0 );
209+ }
210+ 90% {
211+ clip-path : inset (120px 0 25px 0 );
221212 }
222213 100% {
223- clip-path : inset (25 % 0 70 % 0 );
214+ clip-path : inset (5 px 0 110 px 0 );
224215 }
225216}
226217
227- /* Animation for the blue channel pseudo-element */
228- @keyframes glitch-anim-2 {
218+ @keyframes glitch-animation-2 {
229219 0% {
230- clip-path : inset (0% 0 95% 0 );
220+ clip-path : inset (120px 0 15px 0 );
221+ }
222+ 10% {
223+ clip-path : inset (40px 0 80px 0 );
231224 }
232225 20% {
233- clip-path : inset (60% 0 35% 0 );
226+ clip-path : inset (5px 0 130px 0 );
227+ }
228+ 30% {
229+ clip-path : inset (90px 0 20px 0 );
234230 }
235231 40% {
236- clip-path : inset (20% 0 75% 0 );
232+ clip-path : inset (10px 0 100px 0 );
233+ }
234+ 50% {
235+ clip-path : inset (115px 0 5px 0 );
237236 }
238237 60% {
239- clip-path : inset (95% 0 2% 0 );
238+ clip-path : inset (30px 0 70px 0 );
239+ }
240+ 70% {
241+ clip-path : inset (145px 0 10px 0 );
240242 }
241243 80% {
242- clip-path : inset (15% 0 80% 0 );
244+ clip-path : inset (25px 0 95px 0 );
245+ }
246+ 90% {
247+ clip-path : inset (105px 0 35px 0 );
243248 }
244249 100% {
245- clip-path : inset (70 % 0 25 % 0 );
250+ clip-path : inset (15 px 0 120 px 0 );
246251 }
247252}
0 commit comments