I have been searching for a simple and efficient way to apply a single gradient to moving particles from the particles.js library. Ideally, I would like something using CSS only, but I am pretty sure now that it's not possible even if I have read interesting things about clip-path like there explanations on clipping and masking using CSS.
My goal is to make something dynamic like this (I have no real edition software other than Asesprite, please don't blame me, if you know a good vector tool for linux, tell me):
To have a look to an implementation of the library, have a look at the demo on CodePen.
I do not use a server with particles.js (also available there (GitHub) so I would like a solution I can implement on the app.js file linked to my .html one:
/* ---- particles.js config ---- */
// default shape: circles
particlesJS("particles-js", {
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#ffffff"
},
"shape": {
"type": "stroke",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
},
"image": {
"src": "../img/particle.png",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.5,
"random": true,
"anim": {
"enable": true,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 3,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 180,
"color": "#ffffff",
"opacity": 0.8,
"width": 2
},
"move": {
"enable": true,
"speed": 6,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": true,
"mode": "repulse"
},
"onclick": {
"enable": false,
"mode": "bubble"
},
"resize": true
},
"modes": {
"grab": {
"distance": 140,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 90,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
});
I know there are similar questions, but I don't understand how I could manage to make the particules behave as a filter for a behind fixed gradient: a similar case, another one.