Spaces:
Running
Running
make the animated particles visible
Browse files- components/particles.js +7 -7
- style.css +4 -4
components/particles.js
CHANGED
|
@@ -15,17 +15,17 @@ class ParticlesBackground extends HTMLElement {
|
|
| 15 |
}
|
| 16 |
.particle {
|
| 17 |
position: absolute;
|
| 18 |
-
background-color: rgba(255, 255, 255, 0.
|
| 19 |
border-radius: 50%;
|
| 20 |
pointer-events: none;
|
| 21 |
-
filter: blur(
|
| 22 |
}
|
| 23 |
.particle:nth-child(3n) {
|
| 24 |
-
background-color: rgba(100, 220, 255, 0.
|
| 25 |
}
|
| 26 |
.particle:nth-child(5n) {
|
| 27 |
-
background-color: rgba(255, 100, 220, 0.
|
| 28 |
-
|
| 29 |
</style>
|
| 30 |
<div id="particles-container"></div>
|
| 31 |
`;
|
|
@@ -36,12 +36,12 @@ class ParticlesBackground extends HTMLElement {
|
|
| 36 |
|
| 37 |
createParticles() {
|
| 38 |
const container = this.shadowRoot.getElementById('particles-container');
|
| 39 |
-
const particleCount =
|
| 40 |
for (let i = 0; i < particleCount; i++) {
|
| 41 |
const particle = document.createElement('div');
|
| 42 |
particle.classList.add('particle');
|
| 43 |
// Random size between 0.5 and 2px
|
| 44 |
-
const size = Math.random() *
|
| 45 |
particle.style.width = `${size}px`;
|
| 46 |
particle.style.height = `${size}px`;
|
| 47 |
|
|
|
|
| 15 |
}
|
| 16 |
.particle {
|
| 17 |
position: absolute;
|
| 18 |
+
background-color: rgba(255, 255, 255, 0.15);
|
| 19 |
border-radius: 50%;
|
| 20 |
pointer-events: none;
|
| 21 |
+
filter: blur(1px);
|
| 22 |
}
|
| 23 |
.particle:nth-child(3n) {
|
| 24 |
+
background-color: rgba(100, 220, 255, 0.15);
|
| 25 |
}
|
| 26 |
.particle:nth-child(5n) {
|
| 27 |
+
background-color: rgba(255, 100, 220, 0.15);
|
| 28 |
+
}
|
| 29 |
</style>
|
| 30 |
<div id="particles-container"></div>
|
| 31 |
`;
|
|
|
|
| 36 |
|
| 37 |
createParticles() {
|
| 38 |
const container = this.shadowRoot.getElementById('particles-container');
|
| 39 |
+
const particleCount = 50;
|
| 40 |
for (let i = 0; i < particleCount; i++) {
|
| 41 |
const particle = document.createElement('div');
|
| 42 |
particle.classList.add('particle');
|
| 43 |
// Random size between 0.5 and 2px
|
| 44 |
+
const size = Math.random() * 2 + 1;
|
| 45 |
particle.style.width = `${size}px`;
|
| 46 |
particle.style.height = `${size}px`;
|
| 47 |
|
style.css
CHANGED
|
@@ -49,9 +49,9 @@ body::before {
|
|
| 49 |
left: 0;
|
| 50 |
width: 100%;
|
| 51 |
height: 100%;
|
| 52 |
-
background:
|
| 53 |
-
radial-gradient(circle at 20% 30%, rgba(40,40,40,0.
|
| 54 |
-
radial-gradient(circle at 80% 70%, rgba(40,40,40,0.
|
| 55 |
-
|
| 56 |
z-index: -2;
|
| 57 |
}
|
|
|
|
| 49 |
left: 0;
|
| 50 |
width: 100%;
|
| 51 |
height: 100%;
|
| 52 |
+
background:
|
| 53 |
+
radial-gradient(circle at 20% 30%, rgba(40,40,40,0.4) 0%, transparent 30%),
|
| 54 |
+
radial-gradient(circle at 80% 70%, rgba(40,40,40,0.4) 0%, transparent 30%);
|
| 55 |
+
pointer-events: none;
|
| 56 |
z-index: -2;
|
| 57 |
}
|