@newkrok/three-particles 2.11.2 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms-full.txt CHANGED
@@ -345,11 +345,69 @@ enum RendererType {
345
345
  INSTANCED = 'INSTANCED', // Camera-facing quads via InstancedBufferGeometry.
346
346
  // Removes gl_PointSize hardware limit, supports large particles.
347
347
  // Recommended for 10 000+ particles or large on-screen sizes.
348
+ TRAIL = 'TRAIL', // Ribbon trails behind particles. Each particle records a position
349
+ // history and the renderer builds a camera-facing triangle-strip
350
+ // ribbon through those samples.
348
351
  }
349
352
  ```
350
353
 
351
354
  Common blending modes: `THREE.NormalBlending`, `THREE.AdditiveBlending`, `THREE.SubtractiveBlending`
352
355
 
356
+ ### Trail / Ribbon Configuration
357
+
358
+ When using `RendererType.TRAIL`, configure trail-specific properties via `renderer.trail`:
359
+
360
+ ```typescript
361
+ type TrailConfig = {
362
+ length?: number; // Position history samples per particle. Default: 20
363
+ width?: number; // Base ribbon width in world units. Default: 1.0
364
+ widthOverTrail?: LifetimeCurve; // Width taper from head (0) to tail (1)
365
+ opacityOverTrail?: LifetimeCurve; // Opacity taper from head (0) to tail (1)
366
+ colorOverTrail?: { // Optional per-channel color multiplier curves
367
+ isActive: boolean;
368
+ r: LifetimeCurve; // Red channel multiplier (0=head, 1=tail)
369
+ g: LifetimeCurve; // Green channel multiplier
370
+ b: LifetimeCurve; // Blue channel multiplier
371
+ };
372
+ };
373
+ ```
374
+
375
+ Trail features:
376
+ - GPU billboard rendering (vertex shader computes perpendicular offset from camera direction)
377
+ - Soft-edge fade on ribbon borders (no hard edges)
378
+ - Optional texture mapping (texture modulates brightness via luminance)
379
+ - `colorOverTrail` multiplies the particle's current color at each trail position — use white `startColor` for full color transitions
380
+ - Works with all particle features: colorOverLifetime, noise, gravity, force fields
381
+
382
+ Example — comet trail with color shift:
383
+
384
+ ```typescript
385
+ renderer: {
386
+ rendererType: RendererType.TRAIL,
387
+ blending: THREE.AdditiveBlending,
388
+ transparent: true,
389
+ depthWrite: false,
390
+ trail: {
391
+ length: 60,
392
+ width: 0.5,
393
+ widthOverTrail: {
394
+ type: LifeTimeCurve.BEZIER,
395
+ bezierPoints: [
396
+ { x: 0, y: 1, percentage: 0 },
397
+ { x: 0.5, y: 0.4 },
398
+ { x: 1, y: 0, percentage: 1 },
399
+ ],
400
+ },
401
+ colorOverTrail: {
402
+ isActive: true,
403
+ r: { type: LifeTimeCurve.BEZIER, bezierPoints: [{ x: 0, y: 0.2, percentage: 0 }, { x: 0.5, y: 0.5 }, { x: 1, y: 0.8, percentage: 1 }] },
404
+ g: { type: LifeTimeCurve.BEZIER, bezierPoints: [{ x: 0, y: 1.0, percentage: 0 }, { x: 0.5, y: 0.5 }, { x: 1, y: 0.1, percentage: 1 }] },
405
+ b: { type: LifeTimeCurve.BEZIER, bezierPoints: [{ x: 0, y: 0.4, percentage: 0 }, { x: 0.5, y: 0.9 }, { x: 1, y: 1.0, percentage: 1 }] },
406
+ },
407
+ },
408
+ }
409
+ ```
410
+
353
411
  ---
354
412
 
355
413
  ## Texture Sheet Animation
package/llms.txt CHANGED
@@ -75,6 +75,33 @@ function animate() {
75
75
 
76
76
  - `RendererType.POINTS` (default) — Classic point sprites via `THREE.Points`
77
77
  - `RendererType.INSTANCED` — Camera-facing quads via `InstancedBufferGeometry`, removes `gl_PointSize` hardware limit
78
+ - `RendererType.TRAIL` — Ribbon trails behind particles with configurable width, opacity, and color tapering
79
+
80
+ ## Trail / Ribbon Renderer
81
+
82
+ Configure via `renderer.trail`:
83
+
84
+ ```typescript
85
+ renderer: {
86
+ rendererType: RendererType.TRAIL,
87
+ blending: THREE.AdditiveBlending,
88
+ transparent: true,
89
+ trail: {
90
+ length: 40, // History samples per particle (default: 20)
91
+ width: 0.5, // Ribbon width in world units (default: 1.0)
92
+ widthOverTrail: { ... }, // LifetimeCurve: width taper (0=head, 1=tail)
93
+ opacityOverTrail: { ... }, // LifetimeCurve: opacity taper
94
+ colorOverTrail: { // Optional per-channel color multipliers
95
+ isActive: true,
96
+ r: { type: LifeTimeCurve.BEZIER, bezierPoints: [...] },
97
+ g: { type: LifeTimeCurve.BEZIER, bezierPoints: [...] },
98
+ b: { type: LifeTimeCurve.BEZIER, bezierPoints: [...] },
99
+ },
100
+ },
101
+ }
102
+ ```
103
+
104
+ Trails use GPU billboard rendering (vertex shader). Supports optional textures and soft-edge fade.
78
105
 
79
106
  ## Emitter Shapes
80
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newkrok/three-particles",
3
- "version": "2.11.2",
3
+ "version": "2.12.0",
4
4
  "type": "module",
5
5
  "description": "Three.js-based high-performance particle system library designed for creating visually stunning particle effects with ease. Perfect for game developers and 3D applications.",
6
6
  "main": "./dist/index.js",