Get started with tsparticles-interaction-external-push CDN
MIT licensed
TSParticles: extend with external push for custom JS particle manipulation.
Tags:- tsparticles
- particles.js
- particlesjs
- particles
- particle
- canvas
- jsparticles
- xparticles
- particles-js
- particles-bg
- particles-bg-vue
- particles-ts
- particles.ts
- react-particles-js
- react-particles.js
- react-particles
- react
- reactjs
- vue-particles
- ngx-particles
- angular-particles
- particleground
- vue
- vuejs
- preact
- preactjs
- jquery
- angularjs
- angular
- typescript
- javascript
- animation
- web
- html5
- web-design
- webdesign
- css
- html
- css3
- animated
- background
- confetti
- fireworks
- fireworks-js
- confetti-js
- confettijs
- fireworksjs
- canvas-confetti
Stable version
Copied!
How to start using tsparticles-interaction-external-push CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with tsparticles-interaction-external-push CDN - cdnhub.io</title>
<style>
#tsparticles {
height: 100vh;
width: 100%;
}
</style>
</head>
<body>
<div id="tsparticles"></div>
<script src="https://cdn.jsdelivr.net/npm/tsparticles@2.12.0/dist/tsparticles.min.js"></script>
<script src="https://cdn.cdnhub.io/tsparticles-interaction-external-push/2.12.0/tsparticles.interaction.external.push.min.js"></script>
<script>
const particles = new TSParticles({
container: document.querySelector("#tsparticles"),
backgroundMode: {
enable: true,
color: "#000",
opacity: 0.5,
},
fpsLimit: 60,
interactivity: {
events: {
onClick: {
mode: "push",
action: {
x: 100,
y: 100,
amount: 1,
instant: true,
},
},
},
modes: {
push: {
distance: 100,
duration: 0.5,
},
},
},
particles: {
color: {
value: "#ffffff",
},
links: {
color: "#ffffff",
distance: 150,
opacity: 0.5,
width: 1,
},
collisions: {
enable: true,
mode: "bounce",
},
move: {
direction: "none",
enable: true,
speed: 0.5,
random: true,
straight: false,
},
size: {
value: 5,
random: true,
anim: {
enable: false,
speed: 1,
size_min: 0.1,
sync: false,
},
},
opacity: {
value: 0.5,
random: true,
anim: {
enable: false,
speed: 1,
opacity_min: 0.1,
sync: false,
},
},
},
interactivity_modules: [
TSParticles.InteractivityExternalPush,
],
particles_modules: [
TSParticles.InteractivityModes,
TSParticles.InteractivityPush,
],
});
document.addEventListener("click", (event) => {
particles.interactivity.events.onClick.action.x = event.clientX;
particles.interactivity.events.onClick.action.y = event.clientY;
particles.update();
});
particles.init();
</script>
</body>
</html>
Copied!
Copied!