Skip to content

Commit 9adbc28

Browse files
committed
chore: fix circuit pulse
1 parent 54e7866 commit 9adbc28

2 files changed

Lines changed: 38 additions & 32 deletions

File tree

assets/scss/_kmcd.scss

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,3 +604,37 @@ ul.icons li a {
604604
}
605605
}
606606
}
607+
608+
@keyframes circuit-pulse-vertical {
609+
from {
610+
transform: translateY(0);
611+
}
612+
to {
613+
transform: translateY(1740px);
614+
}
615+
}
616+
617+
@keyframes circuit-pulse-horizontal {
618+
from {
619+
transform: translateX(0);
620+
}
621+
to {
622+
transform: translateX(1180px);
623+
}
624+
}
625+
626+
.circuit-pulse-vertical,
627+
.circuit-pulse-horizontal {
628+
animation-duration: 1.6s;
629+
animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
630+
animation-fill-mode: forwards;
631+
animation-iteration-count: 1;
632+
}
633+
634+
.circuit-pulse-vertical {
635+
animation-name: circuit-pulse-vertical;
636+
}
637+
638+
.circuit-pulse-horizontal {
639+
animation-name: circuit-pulse-horizontal;
640+
}

layouts/partials/circuit-bg.html

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -176,29 +176,15 @@
176176
if (!mask) return;
177177

178178
const rect = document.createElementNS(circuitSvgNS, 'rect');
179+
rect.setAttribute('class', 'circuit-pulse-vertical');
179180
rect.setAttribute('x', '0');
180181
rect.setAttribute('y', '-240');
181182
rect.setAttribute('width', '300');
182183
rect.setAttribute('height', '240');
183184
rect.setAttribute('fill', 'url(#sweep-grad)');
184185

185-
const anim = document.createElementNS(circuitSvgNS, 'animate');
186-
anim.setAttribute('attributeName', 'y');
187-
anim.setAttribute('from', '-240');
188-
anim.setAttribute('to', '1500');
189-
anim.setAttribute('dur', '1.6s');
190-
anim.setAttribute('begin', 'indefinite');
191-
anim.setAttribute('repeatCount', '1');
192-
anim.setAttribute('fill', 'freeze');
193-
anim.setAttribute('keyTimes', '0; 1');
194-
anim.setAttribute('keySplines', '0.4 0 0.2 1');
195-
anim.setAttribute('calcMode', 'spline');
196-
197-
rect.appendChild(anim);
198186
mask.appendChild(rect);
199187

200-
anim.beginElement();
201-
202188
setTimeout(() => {
203189
rect.remove();
204190
}, 1800);
@@ -209,29 +195,15 @@
209195
if (!mask) return;
210196

211197
const rect = document.createElementNS(circuitSvgNS, 'rect');
212-
rect.setAttribute('x', '-300');
198+
rect.setAttribute('class', 'circuit-pulse-horizontal');
199+
rect.setAttribute('x', '-180');
213200
rect.setAttribute('y', '0');
214201
rect.setAttribute('width', '180');
215202
rect.setAttribute('height', '80');
216203
rect.setAttribute('fill', 'url(#sweep-grad-horizontal)');
217204

218-
const anim = document.createElementNS(circuitSvgNS, 'animate');
219-
anim.setAttribute('attributeName', 'x');
220-
anim.setAttribute('from', '-180');
221-
anim.setAttribute('to', '1000');
222-
anim.setAttribute('dur', '1.6s');
223-
anim.setAttribute('begin', 'indefinite');
224-
anim.setAttribute('repeatCount', '1');
225-
anim.setAttribute('fill', 'freeze');
226-
anim.setAttribute('keyTimes', '0; 1');
227-
anim.setAttribute('keySplines', '0.4 0 0.2 1');
228-
anim.setAttribute('calcMode', 'spline');
229-
230-
rect.appendChild(anim);
231205
mask.appendChild(rect);
232206

233-
anim.beginElement();
234-
235207
setTimeout(() => {
236208
rect.remove();
237209
}, 1800);
@@ -249,7 +221,7 @@
249221
spawnPulseHorizontal();
250222
}
251223

252-
// Trigger the page-load pulse automatically on DOM load
224+
// Trigger the page-load pulse automatically on DOM load.
253225
document.addEventListener('DOMContentLoaded', () => {
254226
randomizeCircuitDesign();
255227
spawnPulseVertical();

0 commit comments

Comments
 (0)