Package Exports
- @genart-dev/plugin-particles
Readme
@genart-dev/plugin-particles
Depth-aware atmospheric particle layers for genart.dev — falling, floating, scatter, mist, and trailing effects. 34 presets across 5 categories, with 9 MCP tools for AI-agent control.
Part of genart.dev — a generative art platform with an MCP server, desktop app, and IDE extensions.
Install
npm install @genart-dev/plugin-particlesUsage
import particlesPlugin from "@genart-dev/plugin-particles";
import { createDefaultRegistry } from "@genart-dev/core";
const registry = createDefaultRegistry();
registry.registerPlugin(particlesPlugin);
// Or access individual exports
import {
ALL_PRESETS,
getPreset,
filterPresets,
searchPresets,
fallingLayerType,
floatingLayerType,
scatterLayerType,
mistLayerType,
} from "@genart-dev/plugin-particles";Layer Types (5)
| Layer Type | Category | Default Preset | Description |
|---|---|---|---|
particles:falling |
Falling (9) | snow |
Snow, rain, leaves, petals, ash, embers, needles — depth-aware falling particles |
particles:floating |
Floating (8) | dust-motes |
Dust motes, fireflies, fog wisps, pollen, seeds, butterflies — organic noise drift |
particles:scatter |
Scatter (6) | fallen-leaves |
Fallen leaves, stones, flowers, shells, acorns — perspective-aware ground plane |
particles:mist |
Mist (6) | morning-mist |
Noise-modulated fog bands rendered at 1/4 resolution for performance |
particles:trailing |
Trailing (5) | meteor-shower |
Meteors, speed rain, shooting stars, light trails — streak particles with glow |
Presets (34)
Falling (9)
Floating (8)
Scatter (6)
Mist (6)
Trailing (5)
Shared Depth System
All particle layers share a common depth model that controls how particles recede into the scene:
- DepthEasing —
linear,quadratic,cubic,exponentialcurves for size and opacity falloff - DepthDistribution —
uniform,foreground-heavy,background-heavy,midgroundcontrol particle density placement computeDepth()— Returns 0..1 depth value for a particle based on its position and the horizon lineapplyDepthToParticle()— Scales size and opacity for a particle given its depth value and easing curvesampleDepthDistribution()— Samples a random depth value biased by the chosen distribution mode
import {
applyDepthEasing,
computeDepth,
applyDepthToParticle,
sampleDepthDistribution,
} from "@genart-dev/plugin-particles";22 Shape Renderers
Each particle type has a dedicated canvas2d shape renderer:
| Category | Shapes |
|---|---|
| Falling (9) | circle, snowflake, raindrop, leaf, petal, ash, dust, ember, needle |
| Floating (8) | dot, wisp, firefly, pollen, sparkle, butterfly, bubble, seed-tuft |
| Scatter (7) | leaf, stone, flower, debris, petal, acorn, shell |
import {
getFallingShape,
getFloatingShape,
getScatterShape,
drawSnowflake,
drawFirefly,
drawStone,
} from "@genart-dev/plugin-particles";MCP Tools (9)
Exposed to AI agents through the MCP server when this plugin is registered:
| Tool | Description |
|---|---|
add_particles |
Add a particle layer by preset (auto-resolves layer type from preset category). 34 presets. |
list_particle_presets |
List all presets, optionally filtered by category (falling/floating/scatter/mist/trailing) |
set_particle_depth |
Configure depth: horizonY, depthEasing, depthDistribution, depthBandMin/Max |
set_particle_motion |
Configure motion: windAngle, windStrength, fallProgress, driftRange, driftPhase, driftX |
set_particle_style |
Configure style: color, colorVariation, opacity, glow, glowColor, sizeMin, sizeMax |
set_depth_lane |
Assign a particle layer to a depth lane (foreground/midground/background) with sub-level |
create_atmosphere |
Compose a multi-layer atmospheric scene from 6 built-in recipes |
randomize_particles |
Generate a random particle layer, optionally constrained by category |
set_mist_band |
Configure mist: bandTop, bandBottom, edgeSoftness, density, noiseScale, layerCount |
Atmosphere Recipes (6)
The create_atmosphere tool composes multi-layer scenes from curated preset combinations:
Rendering
Each layer type renders via canvas2d:
- Falling — Seed-deterministic positions with depth-scaled size and opacity; 7 shape renderers (snowflake, raindrop, leaf, petal, ash, dust, circle)
- Floating — Fractal noise drift per particle (no grid sync artifacts);
driftPhaseoffsets the noise field;verticalBiasskews the Y distribution;glowRadiuscontrols halo size - Scatter — Elements scattered between
groundYand canvas bottom with perspective depth scaling size and opacity - Mist — Fractal noise sampled into a 1/4-resolution buffer, then scaled up for soft fog bands with configurable edge softness
Utilities
Shared utilities exported for advanced use:
import {
mulberry32, // Deterministic PRNG
createValueNoise, createFractalNoise, // Procedural noise generators
parseHex, toHex, lerpColor, varyColor, // Color interpolation and variation
applyDepthEasing, // Depth curve functions
} from "@genart-dev/plugin-particles";Preset Discovery
import { ALL_PRESETS, filterPresets, searchPresets, getPreset } from "@genart-dev/plugin-particles";
// All 34 presets
console.log(ALL_PRESETS.length); // 34
// Filter by category
const falling = filterPresets({ category: "falling" }); // 9 presets
const mist = filterPresets({ category: "mist" }); // 6 presets
// Full-text search
const results = searchPresets("fire"); // fireflies
// Look up by ID
const preset = getPreset("snow");Examples
The examples/ directory contains 40 .genart files (34 individual presets + 6 atmosphere recipes) with rendered PNG thumbnails.
# Generate .genart example files
node generate-examples.cjs
# Render all examples to PNG (requires @genart-dev/cli)
node render-examples.cjs
# Generate per-category gallery montages
bash generate-galleries.shA workspace file at examples/particles-gallery.genart-workspace lays out all examples in a grid for browsing in the desktop app.
Related Packages
| Package | Purpose |
|---|---|
@genart-dev/core |
Plugin host, layer system (dependency) |
@genart-dev/mcp-server |
MCP server that surfaces plugin tools to AI agents |
@genart-dev/plugin-terrain |
Sky, terrain profiles, clouds, water surfaces (21 presets) |
@genart-dev/plugin-painting |
Vector-field-driven painting layers |
@genart-dev/plugin-perspective |
Perspective grids and depth guides |
@genart-dev/plugin-plants |
Algorithmic plant generation (110 presets) |
@genart-dev/plugin-patterns |
Geometric and cultural pattern fills (153 presets) |
Support
Questions, bugs, or feedback — support@genart.dev or open an issue.
License
MIT













































