@tsparticles/pjs
| Install | |
|---|---|
npm install @tsparticles/pjs |
|
| Latest Version: | 4.4.0 |
| License: | MIT |
| Last Updated: | Oct 21, 2026 |
| Links: | GitHub · npm |
tsParticles Particles.js Compatibility Package
tsParticles particles.js compatibility library.
[!WARNING] This package is legacy compatibility glue for particles.js-style APIs. It is considered obsolete, and it may be removed in v5. Prefer direct
tsParticlesAPIs for new code.
Included Packages
Dependency Graph
flowchart TD
subgraph b [Bundle]
bp[tsparticles/pjs]
bf[tsparticles]
end
subgraph c [Core]
ce[tsparticles/engine]
end
subgraph p [Plugins]
pr[tsparticles/plugin-responsive]
end
bp --> bf
bp --> ce
bp --> p
Exposed API
The package exports only one API from its main entrypoint:
import { initPjs } from "@tsparticles/pjs";
Signature:
initPjs(engine: Engine): Promise<void>
initPjs does not return compatibility objects directly.
It initializes compatibility and populates global objects.
Installation
pnpm add @tsparticles/pjs @tsparticles/engine
How it works
Calling initPjs(engine) performs these steps:
- Checks runtime version compatibility.
- Registers required plugins (
tsparticlesfull bundle + responsive plugin). - Creates and exposes legacy globals:
globalThis.particlesJSglobalThis.pJSDomglobalThis.Particles
After initialization, you can use particles.js-compatible APIs.
How to use it
ESM / TypeScript
import { tsParticles } from "@tsparticles/engine";
import { initPjs } from "@tsparticles/pjs";
await initPjs(tsParticles);
await globalThis.particlesJS("tsparticles", {/* particles.js-style options */});
CDN / Vanilla JS / jQuery
The CDN/Vanilla JS version has two files:
- One is a bundle file with all the scripts included in a single file
- One includes only
initPjs, where dependencies must be loaded manually
After loading the bundle, call initPjs(tsParticles) once, then use legacy globals.
Bundle
Use the bundle when you want a single script with all required dependencies.
Not Bundle
This installation requires more work since all dependencies must be included in the page. Some lines above are all specified in the Included Packages section.
Usage
Using particlesJS compatibility:
(async engine => {
await initPjs(engine);
particlesJS("tsparticles", {/* options */});
})(tsParticles);
Using Particles compatibility:
(async engine => {
await initPjs(engine);
Particles.init({/* options */});
})(tsParticles);
Compatibility globals (after initPjs)
| Global | Description | Modern equivalent |
|---|---|---|
particlesJS |
particles.js-compatible loader function (plus .load and .setOnClickHandler) |
tsParticles.load, tsParticles.loadJSON, tsParticles.setOnClickHandler |
pJSDom |
array of loaded containers | tsParticles.dom |
Particles |
marcbruederlin/particles.js style wrapper (init, pauseAnimation, resumeAnimation, destroy) |
direct tsParticles.load + container methods |
If you need explicit references in TS/JS code:
const particlesJSCompat = globalThis.particlesJS;
const pJSDomCompat = globalThis.pJSDom;
const particlesCompat = globalThis.Particles;
Particles Options (only for Particles.init)
| Option | Type | Default | Description |
|---|---|---|---|
selector |
string | - | Required: The CSS selector of your canvas element |
maxParticles |
integer | 100 |
Optional: Maximum amount of particles |
sizeVariations |
integer | 3 |
Optional: Amount of size variations |
speed |
integer | 0.5 |
Optional: Movement speed of the particles |
color |
string or string[] | #000000 |
Optional: Color(s) of the particles and connecting lines |
minDistance |
integer | 120 |
Optional: Distance in px for connecting lines |
connectParticles |
boolean | false |
Optional: true/false if connecting lines should be drawn or not |
responsive |
array | null |
Optional: Array of objects containing breakpoints and options |
Responsive Options
| Option | Type | Default | Description |
|---|---|---|---|
breakpoint |
integer | - | Required: Breakpoint in px |
options |
object | - | Required: Options object, that overrides default values |
Methods
| Method | Description |
|---|---|
pauseAnimation |
Pauses/stops the particle animation |
resumeAnimation |
Continues the particle animation |
destroy |
Destroys the plugin |
Deprecation status
particlesJS,pJSDom, andParticlesare deprecated compatibility APIs.- This package is obsolete and maintained for legacy integration only.
- It may be removed in v5, so migration to direct
tsParticlesAPIs is strongly recommended.
See migration guide: markdown/pjsMigration.md
Common pitfalls
- Calling legacy globals before awaiting
initPjs(...) - Expecting
initPjsto returnparticlesJS/Particlesdirectly - Mixing new
tsParticlesand legacy particles.js options in one config object
Related docs
- All packages catalog: https://github.com/tsparticles/tsparticles
- Main docs: https://particles.js.org/docs/
Related Packages
Easily create highly customizable particle, confetti and fireworks animations an...
Basic tsParticles bundle — minimal core engine with only the essential features...
Slim tsParticles bundle — core engine with essential plugins, presets, and inter...
Full-featured tsParticles bundle — create stunning particle, confetti and firewo...
tsParticles confetti bundle — easily create confetti, confetti cannon, confetti...
Version History
| Version | Released | License |
|---|---|---|
| 4.4.0 | MIT | |
| 4.3.2 | MIT | |
| 4.3.1 | MIT | |
| 4.3.0 | MIT | |
| 4.2.1 | MIT | |
| 4.2.0 | MIT | |
| 4.1.3 | MIT | |
| 4.1.2 | MIT | |
| 4.1.1 | MIT | |
| 4.1.0 | MIT | |
| 4.0.5 | MIT | |
| 4.0.4 | MIT | |
| 4.0.3 | MIT | |
| 4.0.2 | MIT | |
| 4.0.1 | MIT | |
| 4.0.0 | MIT | |
| 3.9.1 | MIT | |
| 3.9.0 | MIT | |
| 3.8.1 | MIT | |
| 3.8.0 | MIT | |
| 3.7.1 | MIT | |
| 3.7.0 | MIT | |
| 3.6.0 | MIT | |
| 3.5.0 | MIT | |
| 3.4.0 | MIT | |
| 3.3.0 | MIT | |
| 3.2.2 | MIT | |
| 3.2.1 | MIT | |
| 3.2.0 | MIT | |
| 3.1.0 | MIT |
Showing the latest 30 of 34. See every release on npm
Pre-releases (42)
| Version | Released | License |
|---|---|---|
| 4.0.0-beta.17 | MIT | |
| 4.0.0-beta.16 | MIT | |
| 4.0.0-beta.15 | MIT | |
| 4.0.0-beta.12 | MIT | |
| 4.0.0-beta.11 | MIT | |
| 4.0.0-beta.10 | MIT | |
| 4.0.0-beta.9 | MIT | |
| 4.0.0-beta.8 | MIT | |
| 4.0.0-beta.6 | MIT | |
| 4.0.0-beta.5 | MIT | |
| 4.0.0-beta.4 | MIT | |
| 4.0.0-beta.3 | MIT | |
| 4.0.0-beta.2 | MIT | |
| 4.0.0-beta.1 | MIT | |
| 4.0.0-beta.0 | MIT | |
| 4.0.0-alpha.28 | MIT | |
| 4.0.0-alpha.27 | MIT | |
| 4.0.0-alpha.26 | MIT | |
| 4.0.0-alpha.25 | MIT | |
| 4.0.0-alpha.24 | MIT | |
| 4.0.0-alpha.23 | MIT | |
| 4.0.0-alpha.22 | MIT | |
| 4.0.0-alpha.21 | MIT | |
| 4.0.0-alpha.20 | MIT | |
| 4.0.0-alpha.18 | MIT | |
| 4.0.0-alpha.17 | MIT | |
| 4.0.0-alpha.16 | MIT | |
| 4.0.0-alpha.15 | MIT | |
| 4.0.0-alpha.14 | MIT | |
| 4.0.0-alpha.8 | MIT |
Showing the latest 30 of 42. See every release on npm
