惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
J
Java Code Geeks
爱范儿
爱范儿
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Google DeepMind News
Google DeepMind News
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
I
InfoQ
月光博客
月光博客
博客园 - 聂微东
博客园 - Franky
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Meet tsParticles v4: richer colors, modular plugins, and ...
Matteo Bruni · 2026-05-18 · via DEV Community

tsParticles v4: HDR Colors, Paint Variants, and a Fully Modular Ecosystem

tsParticles v4.0 is finally here.

This release introduces long-requested features, major rendering improvements, and a completely modernized plugin architecture.

Compared to v3.9.1, nearly every subsystem has evolved.

Let's take a look at what's new.


✨ HDR & Display P3 Support

tsParticles v4 introduces HDR-ready rendering with automatic Display P3 color support.

Modern devices like recent Macbooks, iPhones, iPads, and high-end monitors can display a much wider color gamut than classic sRGB. v4 detects support automatically and switches the canvas to display-p3 when available.

{
  "hdr": true
}

Enter fullscreen mode Exit fullscreen mode

(enabled by default)

The difference is immediately visible on compatible displays: reds, purples, neon tones, and gradients appear noticeably richer and more vibrant.

If Display P3 isn't supported, tsParticles gracefully falls back to standard sRGB.

Additionally, canvas contexts now use:

desynchronized: true

Enter fullscreen mode Exit fullscreen mode

to reduce rendering latency and improve animation smoothness.


🎨 The New Paint System

One of the biggest configuration improvements in v4 is the new unified paint system.

In v3, fills and strokes were configured separately:

  • particles.color
  • particles.stroke

In v4, both are merged into a single paint model:

{
  "particles": {
    "paint": {
      "color": { "value": "#ff0000" },
      "fill": {
        "enable": true,
        "opacity": { "min": 0.3, "max": 0.8 }
      },
      "stroke": {
        "color": { "value": "#000000" },
        "width": { "min": 1, "max": 3 },
        "opacity": 1
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

The real power comes from paint variants.

paint can now be an array that combines both options. this allows to have hollow particles or no-stroke particles, or filled particles with a border, and you are in full control without going crazy with configurations:

{
  "particles": {
    "paint": [
      {
        "fill": {
          "enable": true,
          "color": { "value": "#ff0000" }
        },
        "stroke": {
          "color": { "value": "#00ff00" },
          "width": 2
        }
      },
      {
        "fill": {
          "enable": true,
          "color": { "value": "#0000ff" }
        },
        "stroke": {
          "color": { "value": "#ffff00" },
          "width": 1
        }
      }
    ]
  }
}

Enter fullscreen mode Exit fullscreen mode

Each particle randomly selects a variant at creation time.

In v3, this usually required duplicated configs and particle groups. In v4, it's built directly into the engine.

Migration

- particles.color
+ particles.paint.fill

- particles.stroke
+ particles.paint.stroke

Enter fullscreen mode Exit fullscreen mode


🌈 Palette System

v4 introduces a completely new concept: Palettes.

Palettes provide curated combinations of:

  • background colors
  • blend modes
  • fill colors
  • stroke colors

with a single configuration entry.

import { loadFireworksGoldPalette } from "@tsparticles/palette-fireworks-gold";

await loadFireworksGoldPalette(engine);

Enter fullscreen mode Exit fullscreen mode

{
  "palette": "fireworks-gold"
}

Enter fullscreen mode Exit fullscreen mode

This automatically configures:

  • background.color
  • particles.paint
  • blend modes like "screen" or "lighter"

More than 100 palettes are already available across categories like:

Category Examples
🎆 Fireworks gold, neon, rainbow, silver
🌌 Space nebula, pulsar, supernova
🌿 Nature autumnLeaves, cherryBlossom
🌊 Water deepOcean, splash
🔥 Fire embersAndAsh, moltenMetal
🎮 Gaming minecraft, pacman, tetris
🖥️ Tech matrixRain, hologram, vaporwave
🎨 Spectrum rainbow, rgbPrimaries
🎯 Vibrant neon, retro, tropical

Each palette is distributed as its own npm package for optimal tree-shaking and lazy loading.


🧩 Fully Modular Plugin Architecture

The largest architectural change in v4 is the move toward a truly modular ecosystem.

Many features previously embedded in the core have been extracted into standalone plugins managed through the new PluginManager.

Benefits include:

  • smaller bundles
  • improved tree-shaking
  • easier maintenance
  • independent feature releases
  • lazy-loaded functionality

New Plugins

Plugin Description
@tsparticles/plugin-blend Blend modes (screen, lighter, multiply)
@tsparticles/plugin-manual-particles Precise particle positioning
@tsparticles/plugin-zoom Particle zoom effects
@tsparticles/plugin-move Unified movement system
@tsparticles/plugin-background-mask Background masking
@tsparticles/plugin-trail Particle trails
@tsparticles/plugin-interactivity Mouse/touch interactions
@tsparticles/plugin-themes Theme support
@tsparticles/plugin-responsive Responsive configurations

🔷 New Shapes

Two new built-in shapes are now available:

Shape Package
Matrix @tsparticles/shape-matrix
Squircle @tsparticles/shape-squircle

The Matrix shape supports animated katakana, ASCII, and kanji characters with randomized updates for classic cyberpunk effects.


🖥️ OffscreenCanvas Support

Rendering internals have been modernized using OffscreenCanvas.

When possible, tsParticles automatically transfers rendering using:

transferControlToOffscreen()

Enter fullscreen mode Exit fullscreen mode

Benefits include:

  • reduced main-thread overhead
  • zero-copy rendering
  • lower rendering latency
  • a unified rendering pipeline

ILoadParams.element now accepts both:

  • HTMLCanvasElement
  • OffscreenCanvas

⚡ SpatialHashGrid Replaces QuadTree

The old QuadTree implementation has been replaced with a SpatialHashGrid.

This improves:

  • collision performance
  • particle link queries
  • memory efficiency
  • scalability in high-particle scenes

🔄 New Easing Functions

v4 adds three new easing families:

Easing Family Package
Gaussian @tsparticles/easing-gaussian
Sigmoid @tsparticles/easing-sigmoid
Smoothstep @tsparticles/easing-smoothstep

Example:

{
  "particles": {
    "move": {
      "speed": {
        "min": 1,
        "max": 5,
        "easing": "ease-in-out-sigmoid"
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode


📦 Migration Summary

New Root Options

+ hdr: boolean
+ palette?: string
+ resize: ResizeEvent

Enter fullscreen mode Exit fullscreen mode

New Particle Options

+ paint: Paint | Paint[]
+ palette?: string

Enter fullscreen mode Exit fullscreen mode

Moved to Plugins

- backgroundMask
- interactivity
- manualParticles
- responsive
- themes

Enter fullscreen mode Exit fullscreen mode

Removed / Replaced

- color
+ paint.fill

- stroke
+ paint.stroke

Enter fullscreen mode Exit fullscreen mode


📋 Quick Migration Guide

- "@tsparticles/engine": "^3.9.1"
+ "@tsparticles/engine": "^4.0.0"

Enter fullscreen mode Exit fullscreen mode

- particles.color.value
+ particles.paint.fill.color.value

Enter fullscreen mode Exit fullscreen mode

- particles.stroke.width
+ particles.paint.stroke.width

Enter fullscreen mode Exit fullscreen mode

- interactivity.resize.enable
+ resize.enable

Enter fullscreen mode Exit fullscreen mode

Package Renames

- @tsparticles/move-base
+ @tsparticles/plugin-move

- @tsparticles/updater-color
+ @tsparticles/updater-paint

- @tsparticles/updater-stroke-color
+ @tsparticles/updater-paint

Enter fullscreen mode Exit fullscreen mode

Complete migration guide:

https://particles.js.org/migrations/from-v3


🔜 What's Next

v4 establishes the foundation for the future of tsParticles.

The new architecture enables faster experimentation and community-driven extensions without bloating the core engine.

Planned areas of expansion include:

  • community-created palettes
  • additional standalone effects
  • new shapes

Useful Links

Happy coding 🚀

Note: This post was generated with the help of AI, then reviewed and refined manually.