tsParticles interaction plugin for pop effect around mouse or HTML elements.
@tsparticles/engine (or use the CDN bundle below)tsParticles.load(...)tsParticles.load(...) configThe CDN/Vanilla version JS has one required file in vanilla configuration:
Including the tsparticles.interaction.external.pop.min.js file will export the function to load the interaction
plugin:
loadExternalPopInteraction;
Once the scripts are loaded you can set up tsParticles and the interaction plugin like this:
(async () => {
await loadInteractivityPlugin(tsParticles);
await loadExternalPopInteraction(tsParticles);
await tsParticles.load({
id: "tsparticles",
options: {
/* options */
},
});
})();
This package is compatible also with ES or CommonJS modules, firstly this needs to be installed, like this:
$ npm install @tsparticles/interaction-external-pop
or
$ yarn add @tsparticles/interaction-external-pop
Then you need to import it in the app, like this:
const { tsParticles } = require("@tsparticles/engine");
const { loadInteractivityPlugin } = require("@tsparticles/plugin-interactivity");
const { loadExternalPopInteraction } = require("@tsparticles/interaction-external-pop");
(async () => {
await loadInteractivityPlugin(tsParticles);
await loadExternalPopInteraction(tsParticles);
})();
or
import { tsParticles } from "@tsparticles/engine";
import { loadExternalPopInteraction } from "@tsparticles/interaction-external-pop";
(async () => {
await loadExternalPopInteraction(tsParticles);
})();
interactivity.events.onHover.mode or interactivity.events.onClick.mode with value "pop"interactivity.modes.pop{
"interactivity": {
"events": {
"onHover": {
"enable": true,
"mode": "pop"
}
},
"modes": {
"pop": {}
}
}
}
tsParticles.load(...) before loadInteractivityPlugin(...)