### Use-case template example Source: https://particles.js.org/guide/templates-resources Workflow to create, install, and run a portfolio application template. ```bash npx tsparticles-create app my-portfolio --template portfolio --framework vanilla cd my-portfolio npm install npm run dev ``` -------------------------------- ### CDN Setup for @tsparticles/slim Source: https://particles.js.org/guide/bundles Example of loading the engine and slim bundle via CDN, initializing the loader, and loading the particles configuration. ```html ``` -------------------------------- ### Scaffold template example Source: https://particles.js.org/guide/templates-resources Workflow to create, install, and run a React scaffold project. ```bash npx tsparticles-create app my-react-app --template scaffold --framework react cd my-react-app npm install npm run dev ``` -------------------------------- ### Install @tsparticles/lit with pnpm Source: https://particles.js.org/guide/wrappers-lit Install the Lit wrapper, the core engine, and the slim package using pnpm. This is the first step in the quick setup flow. ```bash pnpm add @tsparticles/lit @tsparticles/engine @tsparticles/slim ``` -------------------------------- ### start() Source: https://particles.js.org/docs/classes/tsParticles_Sounds_Plugin.SoundsPluginInstance.SoundsPluginInstance.html Starts the audio playback. ```APIDOC ## Method: start ### Description Starts the audio playback. ### Signature start(): Promise ### Returns Promise ``` -------------------------------- ### Install optional preset configs Source: https://particles.js.org/guides/riot Optionally install preset configs for quick setup. These packages provide pre-built configurations for common particle effects. ```bash npm install @tsparticles/configs ``` ```bash npm install @tsparticles/slim ``` -------------------------------- ### start Source: https://particles.js.org/docs/classes/tsParticles_Interactivity_Plugin.InteractivityPluginInstance.InteractivityPluginInstance.html Starts the plugin. ```APIDOC ## start ### Description Starts the plugin. ### Signature start(): Promise ### Parameters None ### Returns Promise ``` -------------------------------- ### Quick Start: Load tsParticles Engine and Slim Bundle Source: https://particles.js.org/docs Sets up tsParticles with the slim bundle and loads an initial particle configuration. Used for starting a new project or integrating into an existing site. The example config sets a dark background and enables particle movement. ```javascript import { tsParticles } from "@tsparticles/engine"; import { loadSlim } from "@tsparticles/slim"; await loadSlim(tsParticles); await tsParticles.load({ id: "tsparticles", options: { background: { color: "#0d1117", }, particles: { move: { enable: true, }, number: { value: 60, }, }, }, }); ``` -------------------------------- ### Initialize and Control Matrix Preset Source: https://particles.js.org/demos/recipes/matrix Example showing how to load the matrix preset and implement manual start, stop, and resume functions for the particle container. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadMatrixPreset } from "@tsparticles/preset-matrix"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadMatrixPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "matrix", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### Ready-to-use Links Preset with manual start/stop Source: https://particles.js.org/demos/recipes/links TypeScript example showing how to load the Links Preset and control the container with start, stop, and resume functions. The container is destroyed before loading a new one. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadLinksPreset } from "@tsparticles/preset-links"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadLinksPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "links", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### Run tsParticles demo locally with pnpm Source: https://particles.js.org/docs Clone the repository and run these commands to start the vanilla demo. The demo will be available at http://localhost:3000. Note that demo/wordpress contains documentation only and runs as a plugin inside a WordPress installation. ```bash $ pnpm i $ pnpm run build $ cd demo/vanilla $ pnpm start Copy ``` -------------------------------- ### Getting Started with CDN Source: https://particles.js.org/guides/vanilla Add a placeholder div and script tags to your HTML to initialize tsParticles via CDN. ```html tsParticles – Getting Started
``` -------------------------------- ### Ready-to-use Snow Preset (manual start/stop) Source: https://particles.js.org/demos/recipes/snow TypeScript example that loads the Snow preset and provides start, stop, and resume functions. The start function destroys any existing container before loading a new one with the 'snow' preset. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadSnowPreset } from "@tsparticles/preset-snow"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadSnowPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "snow", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### Manual start/stop with loadPartyPreset Source: https://particles.js.org/demos/recipes/party TypeScript example showing how to load the Party preset and manually control the particle container. It defines start, stop, and resume functions. The start function destroys any existing container and loads a new one with the 'party' preset. The stop function pauses the container, and resume plays it. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadPartyPreset } from "@tsparticles/preset-party"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadPartyPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "party", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### start Source: https://particles.js.org/docs/classes/tsParticles_Engine.Core_Container.Container.html Starts the container animation. ```APIDOC ## start ### Description Starts the container animation. ### Method start ``` -------------------------------- ### Install with npm Source: https://particles.js.org/docs/modules/tsParticles_Opacity_Updater.html Install the updater-opacity package using npm. ```bash $ npm install @tsparticles/updater-opacity ``` -------------------------------- ### tsParticles setup with loadRedsPalette and palette option Source: https://particles.js.org/docs/modules/tsParticles_Reds_Palette.html Example of initializing tsParticles with the reds palette, including loading the basic engine and palette, defining particle options with 200 particles, circle shape, and enabled movement, and setting the palette to "reds". Requires the CDN scripts to be loaded beforehand. ```javascript (async engine => { await loadBasic(engine); await loadRedsPalette(engine); const options = { particles: { number: { value: 200 }, shape: { type: "circle" }, size: { value: { min: 10, max: 15 } }, move: { enable: true, speed: 2, }, }, palette: "reds", }; await engine.load({ id: "tsparticles", options, }); })(tsParticles); ``` -------------------------------- ### Install with yarn Source: https://particles.js.org/docs/modules/tsParticles_Background_Mask_Plugin.html Install the plugin package using yarn. ```bash $ yarn add @tsparticles/plugin-background-mask ``` -------------------------------- ### Install slim preset Source: https://particles.js.org/guides/inferno Optionally install the slim preset for a smaller bundle. ```bash npm install @tsparticles/slim ``` -------------------------------- ### Install with npm Source: https://particles.js.org/docs/modules/tsParticles_Background_Mask_Plugin.html Install the plugin package using npm. ```bash $ npm install @tsparticles/plugin-background-mask ``` -------------------------------- ### Install with yarn Source: https://particles.js.org/docs/modules/tsParticles_Opacity_Updater.html Install the updater-opacity package using yarn. ```bash $ yarn add @tsparticles/updater-opacity ``` -------------------------------- ### Install @tsparticles/angular dependencies Source: https://particles.js.org/guide/wrappers-angular Install the required packages using pnpm to get started with the Angular wrapper. ```bash pnpm add @tsparticles/angular @tsparticles/engine @tsparticles/slim ``` -------------------------------- ### Install optional presets and full bundle Source: https://particles.js.org/guides/vue3 Optionally install the full bundle or specific presets and utility configs. ```bash # Full bundle (all features) npm install tsparticles # Specific presets npm install @tsparticles/preset-confetti npm install @tsparticles/preset-fireworks npm install @tsparticles/preset-snow npm install @tsparticles/preset-stars # Utility configs npm install @tsparticles/configs ``` -------------------------------- ### Customize fireworks preset options Source: https://particles.js.org/docs/modules/tsParticles_Fireworks_Preset.html You can override all options like in any standard tsParticles installation. This example changes the particle shape to square, which requires the square shape script starting from v2. ```javascript tsParticles.load({ id: "tsparticles", options: { particles: { shape: { type: "square", // starting from v2, this require the square shape script }, }, preset: "fireworks", }, }); ``` -------------------------------- ### Install tsParticles packages with pnpm Source: https://particles.js.org/guide/installation Commands to install tsParticles packages using pnpm. The table lists scenarios: quick start, minimal setup, full feature set, everything in the repo, confetti only, fireworks only, particle background, and ribbon effect. Note that @tsparticles/engine alone draws nothing; you must add a bundle or plugins. ```bash pnpm add @tsparticles/engine @tsparticles/slim ``` ```bash pnpm add @tsparticles/engine @tsparticles/basic ``` ```bash pnpm add @tsparticles/engine tsparticles ``` ```bash pnpm add @tsparticles/engine @tsparticles/all ``` ```bash pnpm add @tsparticles/confetti ``` ```bash pnpm add @tsparticles/fireworks ``` ```bash pnpm add @tsparticles/particles ``` ```bash pnpm add @tsparticles/ribbons ``` -------------------------------- ### Install @tsparticles/particles with pnpm Source: https://particles.js.org/guide/bundles-particles Install the @tsparticles/particles package using pnpm. This is the recommended package manager for this example. ```bash pnpm add @tsparticles/particles ``` -------------------------------- ### Minimal complete configuration example Source: https://particles.js.org/docs/documents/tsParticles_Engine.Options.html A basic JSON configuration object demonstrating essential settings like background color, frame rate limit, interactivity, and particle movement. ```json { "background": { "color": "#0f172a" }, "fpsLimit": 60, "detectRetina": true, "interactivity": { "events": { "onHover": { "enable": true, "mode": "repulse" } } }, "particles": { "links": { "enable": true }, "move": { "enable": true }, "number": { "value": 80 } } } ``` -------------------------------- ### Manual Start and Stop Control Source: https://particles.js.org/demos/recipes/fountain This TypeScript example demonstrates how to initialize the fountain preset and provides functions to start, stop, and resume the particle container. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadFountainPreset } from "@tsparticles/preset-fountain"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadFountainPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "fountain", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### init(): void Source: https://particles.js.org/docs/classes/tsParticles_Connect_External_Interaction.Connector.Connector.html Initializes the connector. ```APIDOC ## Method ### init(): void #### Description Initializes the connector. #### Returns - **void** - No return value. ``` -------------------------------- ### Manual Start and Stop Control Source: https://particles.js.org/demos/recipes/confetti-cannon Example showing how to initialize the confetti cannon preset and manage the particle container with start, stop, and resume functions. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadConfettiCannonPreset } from "@tsparticles/preset-confetti-cannon"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadConfettiCannonPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "confettiCannon", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### Install via npm Source: https://particles.js.org/docs/modules/tsParticles_Easing_Back_Plugin.html Install the package using npm. ```bash $ npm install @tsparticles/plugin-easing-back ``` -------------------------------- ### Quick example: Interactivity configuration Source: https://particles.js.org/docs/documents/tsParticles_Engine.Options_Interactivity.html Example configuration for the interactivity option, setting detectsOn to 'canvas', enabling hover repulse and click push modes, and configuring their options. ```json { "interactivity": { "detectsOn": "canvas", "events": { "onHover": { "enable": true, "mode": "repulse" }, "onClick": { "enable": true, "mode": "push" }, "resize": true }, "modes": { "repulse": { "distance": 150 }, "push": { "quantity": 4 } } } } ``` -------------------------------- ### Install @tsparticles/vue2 with pnpm Source: https://particles.js.org/guide/wrappers-vue2 Install the Vue 2 wrapper, engine, and slim loader package using pnpm. This is the first step in the quick setup flow. ```bash pnpm add @tsparticles/vue2 @tsparticles/engine @tsparticles/slim ``` -------------------------------- ### init Source: https://particles.js.org/docs/interfaces/tsParticles_Basic_Bundle.bundle.Container.html Initializes the container, setting up all internal resources. ```APIDOC ## init ### Description Initializes the container, preparing it for particle simulation. ### Returns - Promise ``` -------------------------------- ### Install full bundle and presets Source: https://particles.js.org/guides/svelte Install the full tsParticles bundle and specific presets for additional effects. ```bash npm install tsparticles npm install @tsparticles/preset-snow npm install @tsparticles/preset-stars npm install @tsparticles/preset-confetti npm install @tsparticles/preset-fireworks ``` -------------------------------- ### Quick Color Configuration Examples Source: https://particles.js.org/docs/documents/tsParticles_Engine.Color.html Examples showing how to define colors for particles, links, and background elements within the tsParticles configuration object. ```json { "particles": { "color": { "value": "#ffffff" }, "links": { "color": "#4f46e5" } } } ``` ```json { "background": { "color": { "value": "rgb(15, 23, 42)" } } } ``` -------------------------------- ### Full HTML Implementation Source: https://particles.js.org/guides/jquery A complete example showing CDN imports and initialization of a particle scene within an HTML document. ```html tsParticles + jQuery
``` -------------------------------- ### CDN Setup for @tsparticles/confetti Source: https://particles.js.org/guide/bundles Example of loading the self-contained confetti bundle via CDN and invoking the confetti function directly. ```html ``` -------------------------------- ### Multiple Containers Setup Source: https://particles.js.org/guides/vanilla Demonstrates how to set up multiple independent particle instances on the same page using distinct container IDs. ```html Multiple Containers
``` ``` -------------------------------- ### init Source: https://particles.js.org/docs/classes/tsParticles_Engine.Core_Container.Container.html Initializes the container with options. ```APIDOC ## init ### Description Initializes the container with options. ### Method init ``` -------------------------------- ### init(): void Source: https://particles.js.org/docs/classes/tsParticles_Branches_Path.BranchesPathGenerator.BranchesPathGenerator.html Initializes the path generator options. ```APIDOC ## Method: init ### init(): void Initializes the path generator options. #### Parameters None. #### Returns - **void** - No return value. ``` -------------------------------- ### Customize Snow Preset options Source: https://particles.js.org/docs/modules/tsParticles_Snow_Preset.html Override any standard tsParticles option. This example changes the particle shape to square, which requires the square shape script starting from v2. ```javascript tsParticles.load({ id: "tsparticles", options: { particles: { shape: { type: "square", // starting from v2, this require the square shape script }, }, preset: "snow", }, }); ``` -------------------------------- ### init Source: https://particles.js.org/docs/classes/tsParticles_Light_Interaction.ExternalLighter.ExternalLighter.html Initializes the external light interaction. ```APIDOC ## init ### Description Initializes the external light interaction. ### Signature init(): void ### Parameters None ### Returns void ``` -------------------------------- ### Manual start/stop with Sea Anemone preset Source: https://particles.js.org/demos/recipes/sea-anemone TypeScript example showing how to load the Sea Anemone preset and control the animation container with start, stop, and resume functions. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadSeaAnemonePreset } from "@tsparticles/preset-sea-anemone"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadSeaAnemonePreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "seaAnemone", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### init() Source: https://particles.js.org/docs/classes/tsParticles_Interactivity_Plugin.BaseClasses_ExternalInteractorBase.ExternalInteractorBase.html Initializes the interactivity manager. Should set up any necessary state. ```APIDOC ## init ### Description Initializes the interactivity manager. This is called when the manager is set up. ### Method `init` ### Returns `void` ``` -------------------------------- ### Svelte: Load full bundle and initialize particles Source: https://particles.js.org/docs/modules/tsParticles_Full_Bundle.html Svelte example. Defines options and an async init function that loads the full bundle. ```javascript let options = {/* custom options */}; let particlesInit = async engine => { await loadFull(engine); }; ``` -------------------------------- ### Minimal typed tsParticles options (TypeScript) Source: https://particles.js.org/options A minimal `ISourceOptions` configuration with `fpsLimit` and basic particle number and movement settings. Use as a starting point for a typed tsParticles setup. ```typescript import type { ISourceOptions } from "@tsparticles/engine"; export const particlesOptions: ISourceOptions = { fpsLimit: 60, particles: { number: { value: 70 }, move: { enable: true, speed: 1.5 }, }, }; ``` -------------------------------- ### init() Source: https://particles.js.org/docs/classes/tsParticles_Repulse_External_Interaction.Repulser.Repulser.html Initializes the repulser. ```APIDOC ## Method: init() ### Description Initializes the repulser. ### Parameters None ### Returns void ``` -------------------------------- ### React Class Component: Load full bundle and render particles Source: https://particles.js.org/docs/modules/tsParticles_Full_Bundle.html Class component example for React (also works for Preact and Inferno). It customizes the tsParticles installation by loading the full bundle in the init callback. ```tsx import React from "react"; import Particles from "react-particles"; import type { Engine } from "@tsparticles/engine"; import { loadFull } from "tsparticles"; export class ParticlesContainer extends PureComponent { // this customizes the component tsParticles installation async customInit(engine: Engine): Promise { // this adds the bundle to tsParticles await loadFull(engine); } render() { const options = { /* custom options */ }; return ; } } ``` -------------------------------- ### Load and Control Meteors Preset in TypeScript Source: https://particles.js.org/demos/recipes/meteors TypeScript example for loading the Meteors preset and managing the particle container. The start function destroys any existing container before loading a new one with the meteors preset. The stop and resume functions pause and play the container respectively. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadMeteorsPreset } from "@tsparticles/preset-meteors"; import type { Container } from "@tsparticles/engine"; let container: Container | undefined; await loadMeteorsPreset(tsParticles); export async function start(): Promise { container?.destroy(); container = await tsParticles.load({ id: "tsparticles", options: { preset: "meteors", }, }); } export function stop(): void { container?.pause(); } export function resume(): void { container?.play(); } ``` -------------------------------- ### Basic Usage Example Source: https://particles.js.org/guides/webcomponents A complete example showing initialization, element definition, and configuration of the web-particles element. ```html tsParticles Web Components ``` -------------------------------- ### Usage example with loadBokehGoldPalette and palette option Source: https://particles.js.org/docs/modules/tsParticles_BokehGold_Palette.html Initializes tsParticles by loading the basic runtime and calling loadBokehGoldPalette before engine.load. Sets a minimal particle configuration and the palette name "bokehGold" for the colored smoke amber effect. All options can be overridden as in any standard tsParticles installation. ```javascript (async engine => { await loadBasic(engine); await loadBokehGoldPalette(engine); const options = { particles: { number: { value: 200 }, shape: { type: "circle" }, size: { value: { min: 10, max: 15 } }, move: { enable: true, speed: 2, }, }, palette: "bokehGold", }; await engine.load({ id: "tsparticles", options, }); })(tsParticles); ``` -------------------------------- ### Custom configuration with multiple shapes, interactivity, and themes for @tsparticles/react Source: https://particles.js.org/guides/react A full custom example combining multiple particle shapes (circle, triangle, polygon), hover attract and click repulse interactivity, a light theme option, and a gradient background. Use this as a starting point for complex particle configurations that require interactivity and theme switching. ```jsx import { useCallback, useMemo } from "react"; import Particles from "@tsparticles/react"; export default function CustomConfig() { const particlesLoaded = useCallback(async (container) => { console.log("Custom config loaded", container); }, []); const options = useMemo( () => ({ fullScreen: { enable: true, zIndex: 0 }, fpsLimit: 60, particles: { number: { value: 60, density: { enable: true, width: 800, height: 800 } }, color: { value: ["#ff6b6b", "#feca57", "#48dbfb", "#ff9ff3", "#54a0ff"], }, shape: { type: ["circle", "triangle", "polygon"], options: { polygon: { sides: 6 }, }, }, opacity: { value: { min: 0.4, max: 0.8 } }, size: { value: { min: 3, max: 8 } }, links: { enable: true, distance: 200, color: "#ffffff", opacity: 0.15, width: 1, }, move: { enable: true, speed: 2, direction: "none", random: true, outModes: { default: "out" }, }, }, interactivity: { events: { onHover: { enable: true, mode: "attract" }, onClick: { enable: true, mode: "repulse" }, }, modes: { attract: { distance: 200, duration: 0.4, factor: 1 }, repulse: { distance: 200, duration: 0.4 }, }, }, background: { color: "#0f0f23" }, themes: [ { name: "light", default: { value: false }, options: { background: { color: "#f0f0f5" }, particles: { color: { value: ["#e74c3c", "#2ecc71", "#3498db", "#f1c40f"] }, links: { color: "#333333", opacity: 0.2 }, opacity: { value: { min: 0.5, max: 0.9 } }, }, }, }, ], }), [], ); return ; } ``` -------------------------------- ### Configuration for push mode Source: https://particles.js.org/docs/modules/tsParticles_Push_External_Interaction.html Example configuration enabling the push mode on hover and setting the push mode options. ```json { "interactivity": { "events": { "onHover": { "enable": true, "mode": "push" } }, "modes": { "push": {} } } } ``` -------------------------------- ### Container.start() Source: https://particles.js.org/docs/documents/tsParticles_Engine.Container.html (Re)start the container with full initialization. ```APIDOC ## start() ### Description Starts (or restarts) the container, performing a full initialization. ### Method start ### Parameters None ### Returns void ### Example ``` container.start(); ``` ``` -------------------------------- ### init(): Promise Source: https://particles.js.org/docs/interfaces/tsParticles_Basic_Bundle.bundle.PluginManager.html Initializes the plugin manager. This method is used to perform any necessary setup. ```APIDOC ## init(): Promise ### Description Initializes the plugin manager. This method is used to perform any necessary setup. ### Method init ### Parameters None ### Returns Promise ``` -------------------------------- ### Setup HTML Container Source: https://particles.js.org/docs The basic HTML structure required to host the particles. ```html
``` -------------------------------- ### get Source: https://particles.js.org/docs/classes/tsParticles_Engine.Core_ParticlesManager.ParticlesManager.html Gets a particle by index. ```APIDOC ## get ### Description Gets a particle by index. ### Signature get(index: number): Particle | undefined ### Parameters - **index** (number) - Required - The index ### Returns Particle | undefined - the particle at the index ``` -------------------------------- ### Load slim bundle and initialize particles (npm/pnpm/yarn) Source: https://particles.js.org/guide/bundles-slim Import tsParticles and loadSlim, then load the slim bundle and initialize particles with options for background, particle count, links, movement, and shape types. ```ts import { tsParticles } from "@tsparticles/engine"; import { loadSlim } from "@tsparticles/slim"; await loadSlim(tsParticles); await tsParticles.load({ id: "tsparticles", options: { background: { color: "#0b1020" }, particles: { number: { value: 80 }, links: { enable: true, distance: 150 }, move: { enable: true, speed: 2 }, shape: { type: ["circle", "star", "square"] }, }, }, }); ``` -------------------------------- ### maxDistance (get) Source: https://particles.js.org/docs/classes/tsParticles_Attract_External_Interaction.Attractor.Attractor.html Gets the maximum distance for the attract interaction. ```APIDOC ## maxDistance (get) ### Description Gets the maximum distance for the attract interaction. ### Signature get maxDistance(): number ### Returns number ``` -------------------------------- ### Engine initialization patterns Source: https://particles.js.org/guides/solid Examples of initializing the engine with different feature sets including slim, full, and specific presets. ```tsx import { initParticlesEngine } from "@tsparticles/solid"; import { loadFull } from "tsparticles"; import { loadSlim } from "@tsparticles/slim"; import { loadConfettiPreset } from "@tsparticles/preset-confetti"; import type { Engine } from "@tsparticles/engine"; // Minimal — only basic shapes and moves initParticlesEngine((engine: Engine) => loadSlim(engine)).then(() => { console.log("Engine ready (slim)"); }); // Full — every feature included initParticlesEngine((engine: Engine) => loadFull(engine)).then(() => { console.log("Engine ready (full)"); }); // Preset-only — just the features needed for a specific preset initParticlesEngine((engine: Engine) => loadConfettiPreset(engine)).then(() => { console.log("Confetti preset loaded"); }); ``` -------------------------------- ### Install with yarn - @tsparticles/updater-wobble Source: https://particles.js.org/docs/modules/tsParticles_Wobble_Updater.html Install the package using yarn. ```bash $ yarn add @tsparticles/updater-wobble Copy ``` -------------------------------- ### Install with npm - @tsparticles/updater-wobble Source: https://particles.js.org/docs/modules/tsParticles_Wobble_Updater.html Install the package using npm. ```bash $ npm install @tsparticles/updater-wobble Copy ``` -------------------------------- ### Usage example with loadMudAndDirtPalette and options Source: https://particles.js.org/docs/modules/tsParticles_MudAndDirt_Palette.html Set up tsParticles with the basic package and the MudAndDirt palette. The example loads the palette, defines particle options, and applies the palette by name. ```javascript (async engine => { await loadBasic(engine); await loadMudAndDirtPalette(engine); const options = { particles: { number: { value: 200 }, shape: { type: "circle" }, size: { value: { min: 10, max: 15 } }, move: { enable: true, speed: 2, }, }, palette: "mudAndDirt", }; await engine.load({ id: "tsparticles", options, }); })(tsParticles); ``` -------------------------------- ### init Source: https://particles.js.org/docs/classes/tsParticles_Themes_Plugin.ThemesPluginInstance.ThemesPluginInstance.html Initializes the plugin instance. ```APIDOC ## init ### Description Initializes the plugin instance. ### Method init ### Signature init(): Promise ### Returns Promise ``` -------------------------------- ### Install with yarn Source: https://particles.js.org/docs/modules/tsParticles_Trail_Effect.html Install the `@tsparticles/effect-trail` package using yarn. ```bash $ yarn add @tsparticles/effect-trail ``` -------------------------------- ### Install tsParticles with @tsparticles/react and @tsparticles/slim Source: https://particles.js.org/guides/nextjs Installs the React wrapper and the slim bundle for smaller build size. Use this alternative if you don't need the full engine. ```bash npm install @tsparticles/react @tsparticles/slim ``` -------------------------------- ### Install with npm Source: https://particles.js.org/docs/modules/tsParticles_Trail_Effect.html Install the `@tsparticles/effect-trail` package using npm. ```bash $ npm install @tsparticles/effect-trail ``` -------------------------------- ### Interactivity Modes Configuration Example Source: https://particles.js.org/docs/documents/tsParticles_Engine.Options_Interactivity_Modes.html A JSON configuration example demonstrating how to define interactivity events and their corresponding mode parameters. ```json { "interactivity": { "events": { "onHover": { "enable": true, "mode": "repulse" }, "onClick": { "enable": true, "mode": ["push", "bubble"] } }, "modes": { "repulse": { "distance": 150, "duration": 0.4, "speed": 1 }, "push": { "quantity": 4 }, "bubble": { "distance": 200, "size": 20, "duration": 0.5 } } } } ``` -------------------------------- ### Install with yarn Source: https://particles.js.org/docs/modules/tsParticles_Spiral_Shape.html Install the @tsparticles/shape-spiral package using yarn. ```bash $ yarn add @tsparticles/shape-spiral ``` -------------------------------- ### Install with npm Source: https://particles.js.org/docs/modules/tsParticles_Spiral_Shape.html Install the @tsparticles/shape-spiral package using npm. ```bash $ npm install @tsparticles/shape-spiral ``` -------------------------------- ### Install with yarn Source: https://particles.js.org/docs/modules/tsParticles_Shadow_Effect.html Installs the @tsparticles/effect-shadow package using yarn. ```bash $ yarn add @tsparticles/effect-shadow ``` -------------------------------- ### Install with npm Source: https://particles.js.org/docs/modules/tsParticles_Shadow_Effect.html Installs the @tsparticles/effect-shadow package using npm. ```bash $ npm install @tsparticles/effect-shadow ``` -------------------------------- ### Install @tsparticles/path-polygon with yarn Source: https://particles.js.org/docs/modules/tsParticles_Polygon_Path.html Install the package using yarn. ```bash $ yarn add @tsparticles/path-polygon ``` -------------------------------- ### Dynamic Controls Setup Source: https://particles.js.org/guides/vanilla HTML and CSS structure for a control panel to manage particle states, including the necessary script imports for the engine and slim bundle. ```html Dynamic Controls